From 2d3e42c4122c5414f87e9e627629a596bbb07384 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Thu, 5 May 2022 14:17:39 +0530 Subject: [PATCH 01/16] Adding init and bumpversion --- .github/workflows/ci.yaml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 827d8fd5..bf873566 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,11 +3,36 @@ name: CI on: push: branches: - - 'edi-foundation-integration' + - 'refator-pipeline' # - $default-branch - workflow_dispatch: + paths-ignore: + - 'VERSION' + - '.bumpversion.cfg' + workflow_dispatch: jobs: + Init: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.ADMIN_TOKEN }} + + - name: Extract branch name + uses: vazco/github-actions-branch-name@v1 + id: branch + + - name: Bump version + run: | + bumpversion patch + new_version=`cat VERSION` + echo "New version is: $new_version" + + git config --global user.name "CI Build" + git config --global user.email "ci.build@philips.com" + git commit -am "Bump version $new_version" + git push --force + unit-test: env: COVER: true From 40e48af09d10fefd733d52ff3b817fcda7eff12d Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Thu, 5 May 2022 14:19:48 +0530 Subject: [PATCH 02/16] adding install command for bump version --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bf873566..66c505a4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,6 +24,8 @@ jobs: - name: Bump version run: | + apt update + apt install bumpversion bumpversion patch new_version=`cat VERSION` echo "New version is: $new_version" From 35a32f1a6682a083d00c15756976c1da9f4d292a Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Thu, 5 May 2022 14:21:02 +0530 Subject: [PATCH 03/16] adding sudo --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 66c505a4..d25b0441 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,8 +24,8 @@ jobs: - name: Bump version run: | - apt update - apt install bumpversion + sudo apt update + sudo apt install bumpversion bumpversion patch new_version=`cat VERSION` echo "New version is: $new_version" From 056c3af0b9b62c32c724092d73924f5f4ad4b9d7 Mon Sep 17 00:00:00 2001 From: CI Build Date: Thu, 5 May 2022 09:00:02 +0000 Subject: [PATCH 04/16] Bump version 1.0.8 --- .bumpversion.cfg | 4 ++-- VERSION | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index cedae98c..6ea131d5 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,6 +1,6 @@ [bumpversion] -current_version = 1.0.7 +current_version = 1.0.8 commit = False tag = False -[bumpversion:file:VERSION] \ No newline at end of file +[bumpversion:file:VERSION] diff --git a/VERSION b/VERSION index f9cbc01a..337a6a8f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.7 \ No newline at end of file +1.0.8 \ No newline at end of file From b9496e5a07796b2105a72ed68ba025d7a86a6ec8 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Thu, 5 May 2022 14:40:49 +0530 Subject: [PATCH 05/16] chaing docker --- .github/workflows/ci.yaml | 47 +++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d25b0441..99001a62 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,6 +36,7 @@ jobs: git push --force unit-test: + needs: [Init] env: COVER: true runs-on: ubuntu-20.04 @@ -75,11 +76,39 @@ jobs: ./.github/workflows/test.sh docker: + needs: [Init] runs-on: ubuntu-20.04 steps: + - uses: actions/checkout@v2 - - name: Check out code - uses: actions/checkout@v2 + - name: Import Secrets + id: secrets + uses: hashicorp/vault-action@v2.3.1 + with: + url: ${{ secrets.VAULT_HOST }} + method: approle + roleId: ${{ secrets.VAULT_ROLE_ID }} + secretId: ${{ secrets.VAULT_SECRET_ID }} + exportEnv: true + secrets: | + devops/data/docker-repos/hsdp-edi endPoint | HSDP_DOCKER_REGISTRY ; + devops/data/docker-repos/hsdp-edi user | HSDP_DOCKER_USER ; + devops/data/docker-repos/hsdp-edi password | HSDP_DOCKER_PASSWORD ; + devops/data/github/users/sal-devops token | GITHUB_TOKEN ; + + - name: Extract branch name + uses: vazco/github-actions-branch-name@v1 + id: branch + + - name: Set env variables + run: | + new_version=`cat VERSION` + echo "New version is: $new_version" + echo "VERSION=$new_version" >> "$GITHUB_ENV" + echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${new_version}-alpha" >> "$GITHUB_ENV" + echo "CI_LATEST_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:latest" >> "$GITHUB_ENV" + echo "BRANCH_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${{ steps.branch.outputs.branch_name }}-${new_version}" >> "$GITHUB_ENV" + echo "RC_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV" - name: Docker Build run: | @@ -89,9 +118,13 @@ jobs: run: | docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}' - - name: Docker tag & Push + - name: Docker tag run: | - docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:${{ github.sha }} - docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:latest - docker push '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:${{ github.sha }} - docker push '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:latest \ No newline at end of file + docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest ${{ env.BRANCH_IMAGE }} + docker push ${{ env.BRANCH_IMAGE }} + + - name: Docker Push + if: github.ref == 'refs/heads/edi-foundation-integration' + run: | + docker tag ${{ env.BRANCH_IMAGE }} ${{ env.CI_IMAGE }} + docker push ${{ env.CI_IMAGE }} \ No newline at end of file From 02b0395a17aa59386cfdda4060439f15fe15562f Mon Sep 17 00:00:00 2001 From: CI Build Date: Thu, 5 May 2022 09:12:27 +0000 Subject: [PATCH 06/16] Bump version 1.0.9 --- .bumpversion.cfg | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 6ea131d5..5aeb732e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.8 +current_version = 1.0.9 commit = False tag = False diff --git a/VERSION b/VERSION index 337a6a8f..e5a4a5e7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.8 \ No newline at end of file +1.0.9 \ No newline at end of file From fcfead835fedb83104e524c17040c98e1227adc8 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Thu, 5 May 2022 15:07:14 +0530 Subject: [PATCH 07/16] adding trigger workflow --- .github/workflows/api-gw-integrated-test.yaml | 35 ++++++++++ .github/workflows/ci.yaml | 70 ++++++++++++++++++- 2 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/api-gw-integrated-test.yaml diff --git a/.github/workflows/api-gw-integrated-test.yaml b/.github/workflows/api-gw-integrated-test.yaml new file mode 100644 index 00000000..71254964 --- /dev/null +++ b/.github/workflows/api-gw-integrated-test.yaml @@ -0,0 +1,35 @@ +name: API-GW-INTEGRATED-TEST + +on: + workflow_call: + secrets: + VAULT_HOST: + required: true + VAULT_ROLE_ID: + required: true + VAULT_SECRET_ID: + required: true + +jobs: + Deploy: + runs-on: ubuntu-20.04 + steps: + - name: Import Secrets + id: secrets + uses: hashicorp/vault-action@v2.3.1 + with: + url: ${{ secrets.VAULT_HOST }} + method: approle + roleId: ${{ secrets.VAULT_ROLE_ID }} + secretId: ${{ secrets.VAULT_SECRET_ID }} + exportEnv: true + secrets: | + devops/data/github/users/sal-devops token | GITHUB_TOKEN ; + + - uses: convictional/trigger-workflow-and-wait@v1.6.1 + with: + owner: philips-internal + repo: hds-auth-gateway + github_token: ${{ env.GITHUB_TOKEN }} + workflow_file_name: cd.yaml + ref: terraform \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 99001a62..80ffcfd3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -75,7 +75,27 @@ jobs: run: | ./.github/workflows/test.sh - docker: + Blackduck: + needs: [Init] + runs-on: builder_blr + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: blackduck scan + run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\Build\PS\Invoke-BlackduckDetect.ps1 -SourcePath ${{ github.workspace }} + + Fortify: + needs: [Init] + runs-on: builder_blr + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: Fortify scan + run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1 + + Build: needs: [Init] runs-on: ubuntu-20.04 steps: @@ -127,4 +147,50 @@ jobs: if: github.ref == 'refs/heads/edi-foundation-integration' run: | docker tag ${{ env.BRANCH_IMAGE }} ${{ env.CI_IMAGE }} - docker push ${{ env.CI_IMAGE }} \ No newline at end of file + docker push ${{ env.CI_IMAGE }} + + Deploy_And_GW_Integrated_Test: + needs: [Build] + if: github.ref == 'refs/heads/refator-pipeline' + uses: ./.github/workflows/api-gw-integrated-test.yaml + secrets: + VAULT_HOST: ${{ secrets.VAULT_HOST }} + VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} + VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} + + Release: + if: github.ref == 'refs/heads/refator-pipeline' + needs: Deploy_And_GW_Integrated_Test + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Import Secrets + id: secrets + uses: hashicorp/vault-action@v2.3.1 + with: + url: ${{ secrets.VAULT_HOST }} + method: approle + roleId: ${{ secrets.VAULT_ROLE_ID }} + secretId: ${{ secrets.VAULT_SECRET_ID }} + exportEnv: true + secrets: | + devops/data/docker-repos/hsdp-edi endPoint | HSDP_DOCKER_REGISTRY ; + devops/data/docker-repos/hsdp-edi user | HSDP_DOCKER_USER ; + devops/data/docker-repos/hsdp-edi password | HSDP_DOCKER_PASSWORD ; + + - name: Set env variables + run: | + new_version=`cat VERSION` + echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${new_version}-alpha" >> "$GITHUB_ENV" + echo "CI_LATEST_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:latest" >> "$GITHUB_ENV" + echo "RC_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV" + + - name: Login to Docker Repo + run: docker login ${{ env.HSDP_DOCKER_REGISTRY }} --username ${{ env.HSDP_DOCKER_USER }} --password ${{ env.HSDP_DOCKER_PASSWORD }} + + - name: Docker Push + run: | + docker pull ${{ env.CI_IMAGE }} + docker tag ${{ env.CI_IMAGE }} ${{ env.RC_IMAGE }} + docker push ${{ env.RC_IMAGE }} \ No newline at end of file From 15393b8ebe71ef35c29908ca08aba8dcb0a34abf Mon Sep 17 00:00:00 2001 From: CI Build Date: Thu, 5 May 2022 09:37:56 +0000 Subject: [PATCH 08/16] Bump version 1.0.10 --- .bumpversion.cfg | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 5aeb732e..70adf30e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.9 +current_version = 1.0.10 commit = False tag = False diff --git a/VERSION b/VERSION index e5a4a5e7..437d26b1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.9 \ No newline at end of file +1.0.10 \ No newline at end of file From 4181ec103efa1e1ee46c8c2972f0ad647fec0289 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Thu, 5 May 2022 15:09:10 +0530 Subject: [PATCH 09/16] changing job names --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 80ffcfd3..5d8deb97 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -150,7 +150,7 @@ jobs: docker push ${{ env.CI_IMAGE }} Deploy_And_GW_Integrated_Test: - needs: [Build] + needs: [Build, Blackduck, Fortify, unit-test] if: github.ref == 'refs/heads/refator-pipeline' uses: ./.github/workflows/api-gw-integrated-test.yaml secrets: From bf89b892752462f725c32edba29bbab82e632062 Mon Sep 17 00:00:00 2001 From: CI Build Date: Thu, 5 May 2022 09:40:11 +0000 Subject: [PATCH 10/16] Bump version 1.0.11 --- .bumpversion.cfg | 2 +- VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 70adf30e..cb8fa5b5 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.10 +current_version = 1.0.11 commit = False tag = False diff --git a/VERSION b/VERSION index 437d26b1..86844988 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.10 \ No newline at end of file +1.0.11 \ No newline at end of file From 02601f9eae3d19107c808ae17520166c0dbec45c Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Thu, 5 May 2022 15:36:06 +0530 Subject: [PATCH 11/16] changing branch name --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5d8deb97..21fc4890 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - 'refator-pipeline' + - 'edi-foundation-integration' # - $default-branch paths-ignore: - 'VERSION' @@ -151,7 +151,7 @@ jobs: Deploy_And_GW_Integrated_Test: needs: [Build, Blackduck, Fortify, unit-test] - if: github.ref == 'refs/heads/refator-pipeline' + if: github.ref == 'refs/heads/edi-foundation-integration' uses: ./.github/workflows/api-gw-integrated-test.yaml secrets: VAULT_HOST: ${{ secrets.VAULT_HOST }} @@ -159,7 +159,7 @@ jobs: VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} Release: - if: github.ref == 'refs/heads/refator-pipeline' + if: github.ref == 'refs/heads/edi-foundation-integration' needs: Deploy_And_GW_Integrated_Test runs-on: ubuntu-20.04 steps: From c890d329ff97726adf82c260386cfe46452d50c1 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Mon, 9 May 2022 21:55:44 +0530 Subject: [PATCH 12/16] changing branch name --- .github/workflows/api-gw-integrated-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api-gw-integrated-test.yaml b/.github/workflows/api-gw-integrated-test.yaml index 71254964..f37c18cf 100644 --- a/.github/workflows/api-gw-integrated-test.yaml +++ b/.github/workflows/api-gw-integrated-test.yaml @@ -32,4 +32,4 @@ jobs: repo: hds-auth-gateway github_token: ${{ env.GITHUB_TOKEN }} workflow_file_name: cd.yaml - ref: terraform \ No newline at end of file + ref: master \ No newline at end of file From d1916115f00e7071b703a70242f395c7b3e423f4 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Mon, 9 May 2022 22:13:20 +0530 Subject: [PATCH 13/16] adding branch name --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 21fc4890..b12beeb5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,6 +8,8 @@ on: paths-ignore: - 'VERSION' - '.bumpversion.cfg' + pull_request: + branches: [ edi-foundation-integration ] workflow_dispatch: jobs: From 7defb13357288ccedcfeff7e26e954a9ea1c6838 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Mon, 9 May 2022 23:32:03 +0530 Subject: [PATCH 14/16] change --- .github/workflows/api-gw-integrated-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/api-gw-integrated-test.yaml b/.github/workflows/api-gw-integrated-test.yaml index f37c18cf..71254964 100644 --- a/.github/workflows/api-gw-integrated-test.yaml +++ b/.github/workflows/api-gw-integrated-test.yaml @@ -32,4 +32,4 @@ jobs: repo: hds-auth-gateway github_token: ${{ env.GITHUB_TOKEN }} workflow_file_name: cd.yaml - ref: master \ No newline at end of file + ref: terraform \ No newline at end of file From 6587a2137d8a415ab760c73f9b3dcefa4daa3c58 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Mon, 9 May 2022 23:32:41 +0530 Subject: [PATCH 15/16] removing pr --- .github/workflows/pr.yaml | 64 --------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 .github/workflows/pr.yaml diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml deleted file mode 100644 index 6f4b3cf0..00000000 --- a/.github/workflows/pr.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: PR - -on: - pull_request: - branches: - - 'edi-foundation-integration' - # - $default-branch - -jobs: - build: - env: - COVER: true - runs-on: ubuntu-20.04 - steps: - - - name: Check out code - uses: actions/checkout@v2 - - - name: Set up Go 1.16 - uses: actions/setup-go@v2 - with: - go-version: 1.16.x - id: go - - - name: Get dependencies - run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.36.0 - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - - name: Verify Code Generation - run: | - make verify-generate - - name: Lint - run: | - make lint - - name: Build - run: | - make build - - name: Test - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - run: | - ./.github/workflows/test.sh - docker: - runs-on: ubuntu-20.04 - steps: - - - name: Check out code - uses: actions/checkout@v2 - - - name: Docker Build - run: | - make docker - - - name: Docker login - run: | - docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}' - - - name: Docker tag & Push - run: | - docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:prlatest - docker push '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:prlatest - - From 3cbdaa2ce1806d4993c78958aaceed6efd6b4613 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Mon, 9 May 2022 23:45:57 +0530 Subject: [PATCH 16/16] adding condition --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b12beeb5..a073fc81 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,6 +25,7 @@ jobs: id: branch - name: Bump version + if: github.ref == 'refs/heads/edi-foundation-integration' run: | sudo apt update sudo apt install bumpversion