From 70d0c64d9a8c5055c9b7e23dd55d3f255273bbb0 Mon Sep 17 00:00:00 2001 From: Dhaval Maniyar <100835289+logoutdhaval@users.noreply.github.com> Date: Mon, 27 Nov 2023 16:44:28 +0530 Subject: [PATCH] [PHEE-477] Create an orb that fetches the docker images and do helm upgrade (#77) * PHEE-477 Create an orb that fetches the docker images and do helm upgrade * fix command * added github template --- .circleci/config.yml | 18 +++++++++++++++++- .github/pull_request_template.md | 22 ++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .github/pull_request_template.md diff --git a/.circleci/config.yml b/.circleci/config.yml index 881af8bd..1402f71d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,6 +56,13 @@ jobs: command: | ./gradlew bootJar docker build -t openmf/message-gateway:latest . + if [ "$CIRCLE_BRANCH" != "master" ]; then + PR_NUMBER=$(basename $CIRCLE_PULL_REQUEST) + PR_TITLE=$(curl -sSL "https://api.github.com/repos/openmf/$CIRCLE_PR_REPONAME/pulls/$PR_NUMBER" | jq -r '.title') + JIRA_STORY=$(echo $PR_TITLE | cut -d "[" -f2 | cut -d "]" -f1 | tr '[A-Z]' '[a-z]') + if [ -z "$JIRA_STORY" ]; then echo "Invalid PR title" && exit 1; else echo "Ticket NO: $JIRA_STORY"; fi + docker image tag openmf/$CIRCLE_PR_REPONAME:latest openmf/$CIRCLE_PR_REPONAME:$JIRA_STORY + fi # Log in to DockerHub using environment variables - run: @@ -65,7 +72,16 @@ jobs: # Push the Docker image to DockerHub - run: name: Push Docker image to DockerHub - command: docker push openmf/message-gateway:latest + command: | + if [ "$CIRCLE_BRANCH" = "master" ]; then + docker push openmf/message-gateway:latest + fi + if [ "$CIRCLE_BRANCH" != "master" ]; then + PR_NUMBER=$(basename $CIRCLE_PULL_REQUEST) + PR_TITLE=$(curl -sSL "https://api.github.com/repos/openmf/$CIRCLE_PR_REPONAME/pulls/$PR_NUMBER" | jq -r '.title') + JIRA_STORY=$(echo $PR_TITLE | cut -d "[" -f2 | cut -d "]" -f1 | tr '[A-Z]' '[a-z]') + docker push openmf/$CIRCLE_PR_REPONAME:${JIRA_STORY} + fi workflows: version: 2 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..98a182a2 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,22 @@ +## Description + +* PR title should have jira ticket enclosed in `[]`.
+Format: ``` [jira_ticket] description```
+ex: [phee-123] PR title. +* Add a link to the Jira ticket. +* Describe the changes made and why they were made. + +## Checklist + +Please make sure these boxes are checked before submitting your pull request - thanks! +- [ ] Followed the PR title naming convention mentioned above. + +- [ ] Design related bullet points or design document link related to this PR added in the description above. + +- [ ] Updated corresponding Postman Collection or Api documentation for the changes in this PR. + +- [ ] Created/updated unit or integration tests for verifying the changes made. + +- [ ] Added required Swagger annotation and update API documentation with details of any API changes if applicable + +- [ ] Followed the naming conventions as given in https://docs.google.com/document/d/1Q4vaMSzrTxxh9TS0RILuNkSkYCxotuYk1Xe0CMIkkCU/edit?usp=sharing