From e8f4a5cb818b967ffb117d96a22b02d34d609831 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 11:04:00 +0530 Subject: [PATCH 01/19] test run --- .github/workflows/ci.yaml | 397 ++++++++++++++++---------------- build/ps/Invoke-FortifyScan.ps1 | 11 +- 2 files changed, 207 insertions(+), 201 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b27c6c6f..eb03892a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,236 +13,239 @@ on: workflow_dispatch: jobs: - Wokflow-Queue: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: ahmadnassri/action-workflow-queue@v1 + # Wokflow-Queue: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - uses: ahmadnassri/action-workflow-queue@v1 - Init: - needs: [Wokflow-Queue] - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - with: - token: ${{ secrets.ADMIN_TOKEN }} + # Init: + # needs: [Wokflow-Queue] + # runs-on: ubuntu-20.04 + # outputs: + # Version: ${{ steps.setVariables.outputs.version }} + # steps: + # - uses: actions/checkout@v2 + # with: + # token: ${{ secrets.ADMIN_TOKEN }} - - name: Extract branch name - uses: vazco/github-actions-branch-name@v1 - id: branch + # - name: Extract branch name + # uses: vazco/github-actions-branch-name@v1 + # id: branch - - name: Bump version - if: github.ref == 'refs/heads/edi-foundation-integration' - run: | - sudo apt update - sudo apt install bumpversion - bumpversion patch - new_version=`cat VERSION` - echo "New version is: $new_version" + # - name: Bump version + # if: github.ref == 'refs/heads/edi-foundation-integration' + # id: setVariables + # run: | + # sudo apt update + # sudo apt install bumpversion + # bumpversion patch + # new_version=`cat VERSION` + # echo "New version is: $new_version" + # echo "version=$new_version" >> $GITHUB_OUTPUT + # 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 - 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: + # needs: [Init] + # env: + # COVER: true + # runs-on: ubuntu-20.04 + # steps: - unit-test: - needs: [Init] - env: - COVER: true - runs-on: ubuntu-20.04 - steps: + # - name: Check out code + # uses: actions/checkout@v2 - - 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: 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: 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: Verify Code Generation - run: | - make verify-generate + # - name: Lint + # run: | + # make lint - - name: Lint - run: | - make lint + # - name: Build + # run: | + # make build - - name: Build - run: | - make build + # - name: Test + # env: + # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + # run: | + # ./.github/workflows/test.sh - - name: Test - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - run: | - ./.github/workflows/test.sh - - 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 }} + BlackduckScan: + #needs: [Init] + uses: philips-internal/edi-reusable-workflows/.github/workflows/Blackduck.yml@main + with: + project_name: 'SA_edifoundation-oauth2proxy' + project_version: '1.0' + hostname: 'https://blackduck.philips.com' + secrets: + blackduck_token: ${{ secrets.BLACKDUCK_TOKEN }} Fortify: - needs: [Init] - runs-on: builder_blr + #needs: [Init] + runs-on: builder_blr_2 steps: - name: checkout uses: actions/checkout@v2 - name: Fortify scan - run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1 + run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1 -PublishAuthToken ${{ secrets.FORTIFY_TOKEN }} - Build: - needs: [Init] - runs-on: ubuntu-20.04 - outputs: - oauth2proxyPRTag: ${{ steps.setVariables.outputs.alphaTag }} - oauth2proxyCITag: ${{ steps.setVariables.outputs.betaTag }} - steps: - - uses: actions/checkout@v2 + # Build: + # needs: [Init] + # runs-on: ubuntu-20.04 + # outputs: + # oauth2proxyPRTag: ${{ steps.setVariables.outputs.prTag }} + # oauth2proxyCITag: ${{ steps.setVariables.outputs.betaTag }} + # 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 ; - devops/data/github/users/sal-devops token | GITHUB_TOKEN ; + # - 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: Extract branch name + # uses: vazco/github-actions-branch-name@v1 + # id: branch - - name: Set env variables - run: | - new_version=`cat VERSION` - alpha_tag="${new_version}-alpha" - beta_tag="${new_version}-beta" - echo "New version is: $new_version" - echo "VERSION=$new_version" >> "$GITHUB_ENV" - echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${beta_tag}" >> "$GITHUB_ENV" - echo "PR_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${alpha_tag}" >> "$GITHUB_ENV" - echo "CI_LATEST_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:latest" >> "$GITHUB_ENV" - echo "alphaTag=${alpha_tag}" >> $GITHUB_OUTPUT - echo "betaTag=${beta_tag}" >> $GITHUB_OUTPUT + # - name: Set env variables + # run: | + # new_version=${{ needs.Init.outputs.Version }} + # pr_tag="PR-${{ github.run_id }}" + # beta_tag="${new_version}-beta" + # echo "New version is: $new_version" + # echo "VERSION=$new_version" >> "$GITHUB_ENV" + # echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${beta_tag}" >> "$GITHUB_ENV" + # echo "PR_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${pr_tag}" >> "$GITHUB_ENV" + # echo "prTag=${pr_tag}" >> $GITHUB_OUTPUT + # echo "betaTag=${beta_tag}" >> $GITHUB_OUTPUT - - name: Docker Build - run: | - make docker + # - 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 login + # run: | + # docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}' - - name: Docker tag - run: | - docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest ${{ env.CI_IMAGE }} - docker tag ${{ env.CI_IMAGE }} ${{ env.PR_IMAGE }} + # - name: Docker tag + # run: | + # docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest ${{ env.PR_IMAGE }} - - name: PR Image Docker Push - if: github.event_name == 'pull_request' - run: | - docker push ${{ env.PR_IMAGE }} + # - name: PR Image Docker Push + # if: github.event_name == 'pull_request' + # run: | + # docker push ${{ env.PR_IMAGE }} - - name: Docker Push - if: github.ref == 'refs/heads/edi-foundation-integration' - run: | - docker tag ${{ env.CI_IMAGE }} ${{ env.CI_LATEST_IMAGE }} - docker push ${{ env.CI_LATEST_IMAGE }} - docker push ${{ env.CI_IMAGE }} + # - name: Docker Push + # if: github.ref == 'refs/heads/edi-foundation-integration' + # run: | + # docker tag ${{ env.PR_IMAGE }} ${{ env.CI_IMAGE }} + # docker push ${{ env.CI_IMAGE }} - PR_Deploy_Test_HDS_AUTH_GATEWAY: - if: github.event_name == 'pull_request' - needs: [Build, Blackduck, Fortify, unit-test] - uses: ./.github/workflows/deploy-hds-auth-gateway.yaml - with: - OAUTH2_PROXY_IMAGE: ${{ needs.Build.outputs.envoyPRTag }} - secrets: - VAULT_HOST: ${{ secrets.VAULT_HOST }} - VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} - VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} + # PR_Deploy_Test_HDS_AUTH_GATEWAY: + # if: github.event_name == 'pull_request' + # needs: [Build, Blackduck, Fortify, unit-test] + # uses: ./.github/workflows/deploy-hds-auth-gateway.yaml + # with: + # OAUTH2_PROXY_IMAGE: ${{ needs.Build.outputs.envoyPRTag }} + # secrets: + # VAULT_HOST: ${{ secrets.VAULT_HOST }} + # VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} + # VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} - CI_Deploy_Test_HDS_AUTH_GATEWAY: - if: github.ref == 'refs/heads/edi-foundation-integration' - needs: [Build, Blackduck, Fortify, unit-test] - uses: ./.github/workflows/api-gw-integrated-test.yaml - with: - OAUTH2_PROXY_IMAGE: ${{ needs.Build.outputs.envoyCITag }} - secrets: - VAULT_HOST: ${{ secrets.VAULT_HOST }} - VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} - VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} + # CI_Deploy_Test_HDS_AUTH_GATEWAY: + # if: github.ref == 'refs/heads/edi-foundation-integration' + # needs: [Build, Blackduck, Fortify, unit-test] + # uses: ./.github/workflows/api-gw-integrated-test.yaml + # with: + # OAUTH2_PROXY_IMAGE: ${{ needs.Build.outputs.envoyCITag }} + # secrets: + # VAULT_HOST: ${{ secrets.VAULT_HOST }} + # VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} + # VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} - Promote_Version: - needs: [CI_Deploy_Test_HDS_AUTH_GATEWAY] - if: github.ref == 'refs/heads/edi-foundation-integration' - runs-on: ubuntu-20.04 - outputs: - versionTag: ${{ steps.setVariables.outputs.versionTag }} - steps: - - uses: actions/checkout@v2 + # Promote_Version: + # needs: [CI_Deploy_Test_HDS_AUTH_GATEWAY] + # if: github.ref == 'refs/heads/edi-foundation-integration' + # runs-on: ubuntu-20.04 + # outputs: + # versionTag: ${{ steps.setVariables.outputs.versionTag }} + # 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: 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 - id: setVariables - run: | - new_version=`cat VERSION` - echo "New version is: $new_version" - echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${new_version}-beta" >> "$GITHUB_ENV" - echo "RC_IMAGE=docker.na1.hsdp.io/edisp-releases/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV" - echo "versionTag=${new_version}-rc" >> $GITHUB_OUTPUT - echo "${new_version}-rc" + # - name: Set env variables + # id: setVariables + # run: | + # sudo apt update + # sudo apt install bumpversion + # bumpversion patch + # new_version=`cat VERSION` + # echo "New version is: $new_version" + # echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${new_version}-beta" >> "$GITHUB_ENV" + # echo "RC_IMAGE=docker.na1.hsdp.io/edisp-releases/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV" + # echo "versionTag=${new_version}-rc" >> $GITHUB_OUTPUT + # echo "${new_version}-rc" - - name: Docker login - run: | - docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}' + # - name: Docker login + # run: | + # docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}' - - name: Docker Push - run: | - docker pull ${{ env.CI_IMAGE }} - docker tag ${{ env.CI_IMAGE }} ${{ env.RC_IMAGE }} - docker push ${{ env.RC_IMAGE }} + # - name: Docker Push + # run: | + # docker pull ${{ env.CI_IMAGE }} + # docker tag ${{ env.CI_IMAGE }} ${{ env.RC_IMAGE }} + # docker push ${{ env.RC_IMAGE }} - Replace_OAuth2_Proxy_Tag_in_Terraform_API_Gateway: - needs: [Promote_Version] - if: github.ref == 'refs/heads/edi-foundation-integration' - uses: ./.github/workflows/update-oauth2-proxy-version-at-api-gw.yaml - with: - OAUTH2_PROXY_IMAGE: ${{ needs.Promote_Version.outputs.versionTag }} - secrets: - VAULT_HOST: ${{ secrets.VAULT_HOST }} - VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} - VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} + # Replace_OAuth2_Proxy_Tag_in_Terraform_API_Gateway: + # needs: [Promote_Version] + # if: github.ref == 'refs/heads/edi-foundation-integration' + # uses: ./.github/workflows/update-oauth2-proxy-version-at-api-gw.yaml + # with: + # OAUTH2_PROXY_IMAGE: ${{ needs.Promote_Version.outputs.versionTag }} + # secrets: + # VAULT_HOST: ${{ secrets.VAULT_HOST }} + # VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} + # VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} diff --git a/build/ps/Invoke-FortifyScan.ps1 b/build/ps/Invoke-FortifyScan.ps1 index d21a55bb..6c6ec8ba 100644 --- a/build/ps/Invoke-FortifyScan.ps1 +++ b/build/ps/Invoke-FortifyScan.ps1 @@ -2,10 +2,12 @@ param( $FortifyProjectId = "edifoundation-oauth2proxy", $FortifyVersionId = "Main", $FortifyBuildId = "fortify_fl", - $FortifyFprPath = "$PSScriptRoot\$FortifyProjectId.$FortifyVersionId.fpr", + $FortifyFprPath = "$PSScriptRoot\$FortifyProjectId.fpr", $PublishURL = "https://fortify.philips.com/ssc", - $PublishAuthToken = "785de478-dc2d-4829-959c-ea5cb8cd1adc", - $RepositoryRoot = "$PSScriptRoot\..\..\" + [string]$PublishAuthToken, + $RepositoryRoot = "$PSScriptRoot\..\..\", + $Sourceanalyzer = "C:\Program Files\Fortify\Fortify_SCA_and_Apps_22.1.1\bin\sourceanalyzer.exe", + $FortifyClient = "C:\Program Files\Fortify\Fortify_SCA_and_Apps_22.1.1\bin\fortifyclient.bat" ) function Invoke-VswhereDownload ( @@ -21,11 +23,12 @@ function Invoke-VswhereDownload ( try { $RepositoryRoot = [System.IO.Path]::GetFullPath($RepositoryRoot) + & sourceanalyzer -b $FortifyBuildId -clean -logfile "$PSScriptRoot\fortify-clean.txt" & sourceanalyzer -Xmx8G -b $FortifyBuildId "$RepositoryRoot\contrib" & sourceanalyzer -b $FortifyBuildId -show-files - & sourceanalyzer -Xmx8G -b $FortifyBuildId -Dcom.fortify.sca.Phase0HigherOrder.Languages=javascript,typescript -scan -f $FortifyFprPath -logfile "$PSScriptRoot\fortify-scan.txt" + & sourceanalyzer -Xmx8G -b $FortifyBuildId -Dcom.fortify.sca.Phase0HigherOrder.Languages=go -scan -f $FortifyFprPath -logfile "$PSScriptRoot\fortify-scan.txt" #Upload fpr reports to fortify server Write-Output "Uploading '$FortifyFprPath' of '$FortifyProjectId' with version '$FortifyVersionId' to '$PublishURL'" From d3fd631fc01f631e88d21f1ba22ac1c807f12c58 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 11:05:17 +0530 Subject: [PATCH 02/19] adding blackduck and fortify --- .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 eb03892a..f0ace54a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -90,7 +90,7 @@ jobs: BlackduckScan: #needs: [Init] - uses: philips-internal/edi-reusable-workflows/.github/workflows/Blackduck.yml@main + uses: philips-internal/edi-reusable-workflows/.github/workflows/Blackduck-js.yml@main with: project_name: 'SA_edifoundation-oauth2proxy' project_version: '1.0' From 52bdfa6a4234b389d41c2433876f93f048a60e05 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 11:06:20 +0530 Subject: [PATCH 03/19] test --- .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 f0ace54a..d6c24222 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - 'edi-foundation-integration' + - 'pr-tag-update' # - $default-branch paths-ignore: - 'VERSION' From fd601df0f73b12167076bccf610cc02552dd4175 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 11:25:33 +0530 Subject: [PATCH 04/19] test --- .github/workflows/ci.yaml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d6c24222..9a5dd475 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -90,13 +90,29 @@ jobs: BlackduckScan: #needs: [Init] - uses: philips-internal/edi-reusable-workflows/.github/workflows/Blackduck-js.yml@main - with: - project_name: 'SA_edifoundation-oauth2proxy' - project_version: '1.0' - hostname: 'https://blackduck.philips.com' - secrets: - blackduck_token: ${{ secrets.BLACKDUCK_TOKEN }} + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.4.1 + + - name: Scan blackduck + run: | + docker run -v ${{ github.workspace}}:/code \ + philipssoftware/blackduck:8.5 \ + /bin/bash -c \ + "(cd /code && \ + /app/detect.sh \ + --blackduck.url=https://blackduck.philips.com \ + --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} \ + --blackduck.trust.cert=true \ + --detect.policy.check=true \ + --detect.source.path=/code \ + --detect.project.name=edifoundation-apigatewaytokenauthenticator \ + --detect.project.version.name=1.0 \ + --detect.blackduck.signature.scanner.individual.file.matching=ALL \ + --detect.bom.aggregate.name={agregator})" Fortify: #needs: [Init] From a9def5ea4de08ea780820436fd17a238ce6ea3ea Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 11:40:11 +0530 Subject: [PATCH 05/19] test --- .github/workflows/ci.yaml | 6 +++--- build/ps/Invoke-FortifyScan.ps1 | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9a5dd475..5b54e97e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -104,13 +104,13 @@ jobs: /bin/bash -c \ "(cd /code && \ /app/detect.sh \ - --blackduck.url=https://blackduck.philips.com \ + --blackduck.url='https://blackduck.philips.com' \ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} \ --blackduck.trust.cert=true \ --detect.policy.check=true \ --detect.source.path=/code \ - --detect.project.name=edifoundation-apigatewaytokenauthenticator \ - --detect.project.version.name=1.0 \ + --detect.project.name='edifoundation-apigatewaytokenauthenticator' \ + --detect.project.version.name='1.0' \ --detect.blackduck.signature.scanner.individual.file.matching=ALL \ --detect.bom.aggregate.name={agregator})" diff --git a/build/ps/Invoke-FortifyScan.ps1 b/build/ps/Invoke-FortifyScan.ps1 index 6c6ec8ba..844860f0 100644 --- a/build/ps/Invoke-FortifyScan.ps1 +++ b/build/ps/Invoke-FortifyScan.ps1 @@ -26,9 +26,10 @@ try { & sourceanalyzer -b $FortifyBuildId -clean -logfile "$PSScriptRoot\fortify-clean.txt" - & sourceanalyzer -Xmx8G -b $FortifyBuildId "$RepositoryRoot\contrib" + & sourceanalyzer -Xmx8G -b $FortifyBuildId -gopath $RepositoryRoot -goroot $RepositoryRoot "$RepositoryRoot\**\*.go" & sourceanalyzer -b $FortifyBuildId -show-files - & sourceanalyzer -Xmx8G -b $FortifyBuildId -Dcom.fortify.sca.Phase0HigherOrder.Languages=go -scan -f $FortifyFprPath -logfile "$PSScriptRoot\fortify-scan.txt" + #& sourceanalyzer -Xmx8G -b $FortifyBuildId -Dcom.fortify.sca.Phase0HigherOrder.Languages=go -scan -f $FortifyFprPath -logfile "$PSScriptRoot\fortify-scan.txt" + & sourceanalyzer -Xmx8G -b $FortifyBuildId -logfile "$PSScriptRoot\fortify-scan.txt" -scan -f $FortifyFprPath #Upload fpr reports to fortify server Write-Output "Uploading '$FortifyFprPath' of '$FortifyProjectId' with version '$FortifyVersionId' to '$PublishURL'" From 4789f0b10960374bd7472bf7e0b1d590625792e8 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 11:52:43 +0530 Subject: [PATCH 06/19] blackduck test --- .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 5b54e97e..daf6682d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -104,13 +104,13 @@ jobs: /bin/bash -c \ "(cd /code && \ /app/detect.sh \ - --blackduck.url='https://blackduck.philips.com' \ + --blackduck.url={https://blackduck.philips.com} \ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} \ --blackduck.trust.cert=true \ --detect.policy.check=true \ --detect.source.path=/code \ - --detect.project.name='edifoundation-apigatewaytokenauthenticator' \ - --detect.project.version.name='1.0' \ + --detect.project.name={edifoundation-apigatewaytokenauthenticator} \ + --detect.project.version.name={1.0} \ --detect.blackduck.signature.scanner.individual.file.matching=ALL \ --detect.bom.aggregate.name={agregator})" From 05731bac5dc5dec85ddaaebdefa882147cf45070 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 11:56:37 +0530 Subject: [PATCH 07/19] test --- .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 daf6682d..63c9dc5c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -104,7 +104,7 @@ jobs: /bin/bash -c \ "(cd /code && \ /app/detect.sh \ - --blackduck.url={https://blackduck.philips.com} \ + --blackduck.url='https://blackduck.philips.com' \ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} \ --blackduck.trust.cert=true \ --detect.policy.check=true \ From 43b9edc4c033d4e4c803adad9884d5ad486a5649 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 12:05:13 +0530 Subject: [PATCH 08/19] adding secrets --- .github/workflows/ci.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 63c9dc5c..aecbf4fb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -104,25 +104,25 @@ jobs: /bin/bash -c \ "(cd /code && \ /app/detect.sh \ - --blackduck.url='https://blackduck.philips.com' \ + --blackduck.url=${{ secrets.BLACKDUCK_URL }} \ --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} \ --blackduck.trust.cert=true \ --detect.policy.check=true \ --detect.source.path=/code \ - --detect.project.name={edifoundation-apigatewaytokenauthenticator} \ - --detect.project.version.name={1.0} \ + --detect.project.name=${{ secrets.BLACKDUCK_PROJECT }} \ + --detect.project.version.name=${{ secrets.BLACKDUCK_VERSION }} \ --detect.blackduck.signature.scanner.individual.file.matching=ALL \ --detect.bom.aggregate.name={agregator})" - Fortify: - #needs: [Init] - runs-on: builder_blr_2 - steps: - - name: checkout - uses: actions/checkout@v2 + # Fortify: + # #needs: [Init] + # runs-on: builder_blr_2 + # steps: + # - name: checkout + # uses: actions/checkout@v2 - - name: Fortify scan - run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1 -PublishAuthToken ${{ secrets.FORTIFY_TOKEN }} + # - name: Fortify scan + # run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1 -PublishAuthToken ${{ secrets.FORTIFY_TOKEN }} # Build: # needs: [Init] From b9172cee05896814410724808f45069c4c1e44e8 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 12:13:43 +0530 Subject: [PATCH 09/19] blackduck test --- .github/workflows/ci.yaml | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index aecbf4fb..6f6c5925 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -92,27 +92,13 @@ jobs: #needs: [Init] runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.4.1 - - - name: Scan blackduck - run: | - docker run -v ${{ github.workspace}}:/code \ - philipssoftware/blackduck:8.5 \ - /bin/bash -c \ - "(cd /code && \ - /app/detect.sh \ - --blackduck.url=${{ secrets.BLACKDUCK_URL }} \ - --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} \ - --blackduck.trust.cert=true \ - --detect.policy.check=true \ - --detect.source.path=/code \ - --detect.project.name=${{ secrets.BLACKDUCK_PROJECT }} \ - --detect.project.version.name=${{ secrets.BLACKDUCK_VERSION }} \ - --detect.blackduck.signature.scanner.individual.file.matching=ALL \ - --detect.bom.aggregate.name={agregator})" + - uses: philips-labs/blackduck-scanner-action@v1 + with: + token: ${{ secrets.BLACKDUCK_TOKEN }} + projectName: ${{ secrets.BLACKDUCK_PROJECT }} + versionPrefix: ${{ secrets.BLACKDUCK_VERSION }} + url: ${{ secrets.BLACKDUCK_URL }} + sourcePath: ${{ github.workspace}} # Fortify: # #needs: [Init] From e63942f14318ba107098cee6ee06054c4809f74d Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 12:19:50 +0530 Subject: [PATCH 10/19] test --- .github/workflows/ci.yaml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6f6c5925..5b692c61 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -92,13 +92,27 @@ jobs: #needs: [Init] runs-on: ubuntu-20.04 steps: - - uses: philips-labs/blackduck-scanner-action@v1 - with: - token: ${{ secrets.BLACKDUCK_TOKEN }} - projectName: ${{ secrets.BLACKDUCK_PROJECT }} - versionPrefix: ${{ secrets.BLACKDUCK_VERSION }} - url: ${{ secrets.BLACKDUCK_URL }} - sourcePath: ${{ github.workspace}} + - uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2.4.1 + + - name: Scan blackduck + run: | + docker run -v ${{ github.workspace}}:/code \ + philipssoftware/blackduck:8.5 \ + /bin/bash -c \ + "(cd /code && \ + /app/detect.sh \ + --blackduck.url=${https://blackduck.philips.com} \ + --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} \ + --blackduck.trust.cert=true \ + --detect.policy.check=true \ + --detect.source.path=/code \ + --detect.project.name=${SA_edifoundation-oauth2proxy} \ + --detect.project.version.name=${1.0} \ + --detect.blackduck.signature.scanner.individual.file.matching=ALL \ + --detect.bom.aggregate.name={agregator})" # Fortify: # #needs: [Init] From 594175bd3027ee7b52f9f7af61c55f02b37540bf Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 12:30:36 +0530 Subject: [PATCH 11/19] blackduck test --- .github/workflows/ci.yaml | 25 +++++-------------------- build/ps/Invoke-BlackDuckDetect.ps1 | 2 +- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5b692c61..53827e6d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -90,29 +90,14 @@ jobs: BlackduckScan: #needs: [Init] - runs-on: ubuntu-20.04 + runs-on: builder_blr steps: - - uses: actions/checkout@v2 + - name: checkout + uses: actions/checkout@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.4.1 + - name: blackduck scan + run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\Build\PS\Invoke-BlackduckDetect.ps1 -SourcePath ${{ github.workspace }} -ApiToken ${{ secrets.BLACKDUCK_TOKEN }} - - name: Scan blackduck - run: | - docker run -v ${{ github.workspace}}:/code \ - philipssoftware/blackduck:8.5 \ - /bin/bash -c \ - "(cd /code && \ - /app/detect.sh \ - --blackduck.url=${https://blackduck.philips.com} \ - --blackduck.api.token=${{ secrets.BLACKDUCK_TOKEN }} \ - --blackduck.trust.cert=true \ - --detect.policy.check=true \ - --detect.source.path=/code \ - --detect.project.name=${SA_edifoundation-oauth2proxy} \ - --detect.project.version.name=${1.0} \ - --detect.blackduck.signature.scanner.individual.file.matching=ALL \ - --detect.bom.aggregate.name={agregator})" # Fortify: # #needs: [Init] diff --git a/build/ps/Invoke-BlackDuckDetect.ps1 b/build/ps/Invoke-BlackDuckDetect.ps1 index d9fd1fd2..04c541d1 100644 --- a/build/ps/Invoke-BlackDuckDetect.ps1 +++ b/build/ps/Invoke-BlackDuckDetect.ps1 @@ -3,7 +3,7 @@ param( $ProjectVersionName = "1.0", $SourcePath, $BlackduckUrl = "https://blackduck.philips.com/", - $ApiToken = "OWFkOWM0NGMtM2FlMy00ODFiLThjMTctM2I1OTdkMTY2MTQ2OmNlMGI4NmNhLWRjMzAtNGU0Yy04NTIwLWEzZDI5NDFlNjdkMg==", + $ApiToken, $ProxyHost = "apac.zscaler.philips.com", $ProxyPort = "10015", $ProxyIgnoreHosts = "blackduck.philips.com" From 6209272b46a2fdccb63d878479d4567e7bf59095 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 12:46:11 +0530 Subject: [PATCH 12/19] test --- .github/workflows/ci.yaml | 44 ++++++++++++++++++++++++++++++++------- sonar-project.properties | 6 ++++++ 2 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 53827e6d..232fc6cc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -88,15 +88,43 @@ jobs: # run: | # ./.github/workflows/test.sh - BlackduckScan: - #needs: [Init] - runs-on: builder_blr - steps: - - name: checkout - uses: actions/checkout@v2 + # BlackduckScan: + # #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 }} -ApiToken ${{ secrets.BLACKDUCK_TOKEN }} + # - name: blackduck scan + # run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\Build\PS\Invoke-BlackduckDetect.ps1 -SourcePath ${{ github.workspace }} -ApiToken ${{ secrets.BLACKDUCK_TOKEN }} + + CodeAnalysis: + runs-on: ubuntu-20.04 + #needs: [Init] + defaults: + run: + working-directory: ${{ github.workspace }} + steps: + - uses: actions/checkout@v2 + + - name: install Go + run: | + sudo apt update + sudo apt install golang + + - name: coverage-report + run: | + cd ${{ github.workspace }} + go test -cover + + # - name: SonarQube Scan + # uses: sonarsource/sonarqube-scan-action@master + # env: + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # SONAR_HOST_URL: https://sonarqube.ta.philips.com/ + # with: + # projectBaseDir: ${{ github.workspace }} + # Fortify: diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..98173487 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=EDI-hds-oauth2-proxy +sonar.projectName=EDI-hds-oauth2-proxy +sonar.sources=. +sonar.exclusions=**/*_test.go +sonar.tests=. +sonar.test.inclusions=**/*_test.go \ No newline at end of file From 642ccbef85944b04acb1856c2dc96b4000fd4423 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 12:57:48 +0530 Subject: [PATCH 13/19] test --- .github/workflows/ci.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 232fc6cc..91ca0855 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -107,14 +107,14 @@ jobs: steps: - uses: actions/checkout@v2 - - name: install Go - run: | - sudo apt update - sudo apt install golang + - name: Set up Go 1.16 + uses: actions/setup-go@v2 + with: + go-version: 1.16.x + id: go - - name: coverage-report + - name: coverage run: | - cd ${{ github.workspace }} go test -cover # - name: SonarQube Scan From de4ca50d9bcd551213f569b7a96aa8868a369851 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 13:01:04 +0530 Subject: [PATCH 14/19] testing sonar --- .github/workflows/ci.yaml | 14 +++++++------- sonar-project.properties | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 91ca0855..605708da 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -117,13 +117,13 @@ jobs: run: | go test -cover - # - name: SonarQube Scan - # uses: sonarsource/sonarqube-scan-action@master - # env: - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - # SONAR_HOST_URL: https://sonarqube.ta.philips.com/ - # with: - # projectBaseDir: ${{ github.workspace }} + - name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: https://sonarqube.ta.philips.com/ + with: + projectBaseDir: ${{ github.workspace }} diff --git a/sonar-project.properties b/sonar-project.properties index 98173487..fc436707 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,5 +1,6 @@ sonar.projectKey=EDI-hds-oauth2-proxy sonar.projectName=EDI-hds-oauth2-proxy +sonar.go.coverage.reportPaths=coverage.out sonar.sources=. sonar.exclusions=**/*_test.go sonar.tests=. From b42f53d174a3e14524d6d3a96bf3f7bb8d3d4dc5 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 13:10:52 +0530 Subject: [PATCH 15/19] coverage test --- .github/workflows/ci.yaml | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 605708da..2817dc7a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,8 +3,8 @@ name: CI on: push: branches: - - 'pr-tag-update' - # - $default-branch + - 'edi-foundation-integration' + - $default-branch paths-ignore: - 'VERSION' - '.bumpversion.cfg' @@ -89,7 +89,7 @@ jobs: # ./.github/workflows/test.sh # BlackduckScan: - # #needs: [Init] + # needs: [Init] # runs-on: builder_blr # steps: # - name: checkout @@ -97,9 +97,19 @@ jobs: # - name: blackduck scan # run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\Build\PS\Invoke-BlackduckDetect.ps1 -SourcePath ${{ github.workspace }} -ApiToken ${{ secrets.BLACKDUCK_TOKEN }} - + + # Fortify: + # needs: [Init] + # runs-on: builder_blr_2 + # steps: + # - name: checkout + # uses: actions/checkout@v2 + + # - name: Fortify scan + # run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1 -PublishAuthToken ${{ secrets.FORTIFY_TOKEN }} + CodeAnalysis: - runs-on: ubuntu-20.04 + runs-on: builder_blr #needs: [Init] defaults: run: @@ -124,18 +134,6 @@ jobs: SONAR_HOST_URL: https://sonarqube.ta.philips.com/ with: projectBaseDir: ${{ github.workspace }} - - - - # Fortify: - # #needs: [Init] - # runs-on: builder_blr_2 - # steps: - # - name: checkout - # uses: actions/checkout@v2 - - # - name: Fortify scan - # run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1 -PublishAuthToken ${{ secrets.FORTIFY_TOKEN }} # Build: # needs: [Init] From 2b3f72d59c1c203e1dc0684ff361a7a7a33098d3 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 13:11:56 +0530 Subject: [PATCH 16/19] branch update --- .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 2817dc7a..8eee1a7c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - 'edi-foundation-integration' + - 'pr-tag-update' - $default-branch paths-ignore: - 'VERSION' From b63dd5bdc6f025868877a690c86912f7afca3c08 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 13:28:46 +0530 Subject: [PATCH 17/19] updating branch --- .github/workflows/ci.yaml | 460 ++++++++++++++++++-------------------- 1 file changed, 217 insertions(+), 243 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8eee1a7c..0636cfd9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - 'pr-tag-update' + - 'edi-foundation-integration' - $default-branch paths-ignore: - 'VERSION' @@ -13,266 +13,240 @@ on: workflow_dispatch: jobs: - # Wokflow-Queue: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - uses: ahmadnassri/action-workflow-queue@v1 + Wokflow-Queue: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ahmadnassri/action-workflow-queue@v1 - # Init: - # needs: [Wokflow-Queue] - # runs-on: ubuntu-20.04 - # outputs: - # Version: ${{ steps.setVariables.outputs.version }} - # steps: - # - uses: actions/checkout@v2 - # with: - # token: ${{ secrets.ADMIN_TOKEN }} + Init: + needs: [Wokflow-Queue] + runs-on: ubuntu-20.04 + outputs: + Version: ${{ steps.setVariables.outputs.version }} + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.ADMIN_TOKEN }} - # - name: Extract branch name - # uses: vazco/github-actions-branch-name@v1 - # id: branch + - name: Extract branch name + uses: vazco/github-actions-branch-name@v1 + id: branch - # - name: Bump version - # if: github.ref == 'refs/heads/edi-foundation-integration' - # id: setVariables - # run: | - # sudo apt update - # sudo apt install bumpversion - # bumpversion patch - # new_version=`cat VERSION` - # echo "New version is: $new_version" - # echo "version=$new_version" >> $GITHUB_OUTPUT - # 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 + - name: Bump version + if: github.ref == 'refs/heads/edi-foundation-integration' + id: setVariables + run: | + sudo apt update + sudo apt install bumpversion + bumpversion patch + new_version=`cat VERSION` + echo "New version is: $new_version" + echo "version=$new_version" >> $GITHUB_OUTPUT + 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: - # needs: [Init] - # env: - # COVER: true - # runs-on: ubuntu-20.04 - # steps: + unit-test: + needs: [Init] + env: + COVER: true + runs-on: ubuntu-20.04 + steps: - # - name: Check out code - # uses: actions/checkout@v2 + - 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: 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: 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: Verify Code Generation + run: | + make verify-generate - # - name: Lint - # run: | - # make lint + - name: Lint + run: | + make lint - # - name: Build - # run: | - # make build + - name: Build + run: | + make build - # - name: Test - # env: - # CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - # run: | - # ./.github/workflows/test.sh + - name: Test + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + run: | + ./.github/workflows/test.sh - # BlackduckScan: - # 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 }} -ApiToken ${{ secrets.BLACKDUCK_TOKEN }} - - # Fortify: - # needs: [Init] - # runs-on: builder_blr_2 - # steps: - # - name: checkout - # uses: actions/checkout@v2 - - # - name: Fortify scan - # run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1 -PublishAuthToken ${{ secrets.FORTIFY_TOKEN }} - - CodeAnalysis: + BlackduckScan: + needs: [Init] runs-on: builder_blr - #needs: [Init] - defaults: - run: - working-directory: ${{ github.workspace }} + 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 }} -ApiToken ${{ secrets.BLACKDUCK_TOKEN }} + + Fortify: + needs: [Init] + runs-on: builder_blr_2 + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: Fortify scan + run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1 -PublishAuthToken ${{ secrets.FORTIFY_TOKEN }} + + + Build: + needs: [Init] + runs-on: ubuntu-20.04 + outputs: + oauth2proxyPRTag: ${{ steps.setVariables.outputs.prTag }} + oauth2proxyCITag: ${{ steps.setVariables.outputs.betaTag }} + 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 ; + 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=${{ needs.Init.outputs.Version }} + pr_tag="PR-${{ github.run_id }}" + beta_tag="${new_version}-beta" + echo "New version is: $new_version" + echo "VERSION=$new_version" >> "$GITHUB_ENV" + echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${beta_tag}" >> "$GITHUB_ENV" + echo "PR_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${pr_tag}" >> "$GITHUB_ENV" + echo "prTag=${pr_tag}" >> $GITHUB_OUTPUT + echo "betaTag=${beta_tag}" >> $GITHUB_OUTPUT + + - 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 + run: | + docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest ${{ env.PR_IMAGE }} + + - name: PR Image Docker Push + if: github.event_name == 'pull_request' + run: | + docker push ${{ env.PR_IMAGE }} + + - name: Docker Push + if: github.ref == 'refs/heads/edi-foundation-integration' + run: | + docker tag ${{ env.PR_IMAGE }} ${{ env.CI_IMAGE }} + docker push ${{ env.CI_IMAGE }} + + PR_Deploy_Test_HDS_AUTH_GATEWAY: + if: github.event_name == 'pull_request' + needs: [Build, Blackduck, Fortify, unit-test] + uses: ./.github/workflows/deploy-hds-auth-gateway.yaml + with: + OAUTH2_PROXY_IMAGE: ${{ needs.Build.outputs.envoyPRTag }} + secrets: + VAULT_HOST: ${{ secrets.VAULT_HOST }} + VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} + VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} + + CI_Deploy_Test_HDS_AUTH_GATEWAY: + if: github.ref == 'refs/heads/edi-foundation-integration' + needs: [Build, Blackduck, Fortify, unit-test] + uses: ./.github/workflows/api-gw-integrated-test.yaml + with: + OAUTH2_PROXY_IMAGE: ${{ needs.Build.outputs.envoyCITag }} + secrets: + VAULT_HOST: ${{ secrets.VAULT_HOST }} + VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} + VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} + + Promote_Version: + needs: [CI_Deploy_Test_HDS_AUTH_GATEWAY] + if: github.ref == 'refs/heads/edi-foundation-integration' + runs-on: ubuntu-20.04 + outputs: + versionTag: ${{ steps.setVariables.outputs.versionTag }} steps: - uses: actions/checkout@v2 - - name: Set up Go 1.16 - uses: actions/setup-go@v2 + - name: Import Secrets + id: secrets + uses: hashicorp/vault-action@v2.3.1 with: - go-version: 1.16.x - id: go - - - name: coverage - run: | - go test -cover - - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: https://sonarqube.ta.philips.com/ - with: - projectBaseDir: ${{ github.workspace }} - - # Build: - # needs: [Init] - # runs-on: ubuntu-20.04 - # outputs: - # oauth2proxyPRTag: ${{ steps.setVariables.outputs.prTag }} - # oauth2proxyCITag: ${{ steps.setVariables.outputs.betaTag }} - # 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 ; - # 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=${{ needs.Init.outputs.Version }} - # pr_tag="PR-${{ github.run_id }}" - # beta_tag="${new_version}-beta" - # echo "New version is: $new_version" - # echo "VERSION=$new_version" >> "$GITHUB_ENV" - # echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${beta_tag}" >> "$GITHUB_ENV" - # echo "PR_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${pr_tag}" >> "$GITHUB_ENV" - # echo "prTag=${pr_tag}" >> $GITHUB_OUTPUT - # echo "betaTag=${beta_tag}" >> $GITHUB_OUTPUT - - # - 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 - # run: | - # docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest ${{ env.PR_IMAGE }} - - # - name: PR Image Docker Push - # if: github.event_name == 'pull_request' - # run: | - # docker push ${{ env.PR_IMAGE }} - - # - name: Docker Push - # if: github.ref == 'refs/heads/edi-foundation-integration' - # run: | - # docker tag ${{ env.PR_IMAGE }} ${{ env.CI_IMAGE }} - # docker push ${{ env.CI_IMAGE }} - - # PR_Deploy_Test_HDS_AUTH_GATEWAY: - # if: github.event_name == 'pull_request' - # needs: [Build, Blackduck, Fortify, unit-test] - # uses: ./.github/workflows/deploy-hds-auth-gateway.yaml - # with: - # OAUTH2_PROXY_IMAGE: ${{ needs.Build.outputs.envoyPRTag }} - # secrets: - # VAULT_HOST: ${{ secrets.VAULT_HOST }} - # VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} - # VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} - - # CI_Deploy_Test_HDS_AUTH_GATEWAY: - # if: github.ref == 'refs/heads/edi-foundation-integration' - # needs: [Build, Blackduck, Fortify, unit-test] - # uses: ./.github/workflows/api-gw-integrated-test.yaml - # with: - # OAUTH2_PROXY_IMAGE: ${{ needs.Build.outputs.envoyCITag }} - # secrets: - # VAULT_HOST: ${{ secrets.VAULT_HOST }} - # VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} - # VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} - - # Promote_Version: - # needs: [CI_Deploy_Test_HDS_AUTH_GATEWAY] - # if: github.ref == 'refs/heads/edi-foundation-integration' - # runs-on: ubuntu-20.04 - # outputs: - # versionTag: ${{ steps.setVariables.outputs.versionTag }} - # 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 ; + 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 - # id: setVariables - # run: | - # sudo apt update - # sudo apt install bumpversion - # bumpversion patch - # new_version=`cat VERSION` - # echo "New version is: $new_version" - # echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${new_version}-beta" >> "$GITHUB_ENV" - # echo "RC_IMAGE=docker.na1.hsdp.io/edisp-releases/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV" - # echo "versionTag=${new_version}-rc" >> $GITHUB_OUTPUT - # echo "${new_version}-rc" + - name: Set env variables + id: setVariables + run: | + sudo apt update + sudo apt install bumpversion + bumpversion patch + new_version=`cat VERSION` + echo "New version is: $new_version" + echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${new_version}-beta" >> "$GITHUB_ENV" + echo "RC_IMAGE=docker.na1.hsdp.io/edisp-releases/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV" + echo "versionTag=${new_version}-rc" >> $GITHUB_OUTPUT + echo "${new_version}-rc" - # - name: Docker login - # run: | - # docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}' + - name: Docker login + run: | + docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}' - # - name: Docker Push - # run: | - # docker pull ${{ env.CI_IMAGE }} - # docker tag ${{ env.CI_IMAGE }} ${{ env.RC_IMAGE }} - # docker push ${{ env.RC_IMAGE }} + - name: Docker Push + run: | + docker pull ${{ env.CI_IMAGE }} + docker tag ${{ env.CI_IMAGE }} ${{ env.RC_IMAGE }} + docker push ${{ env.RC_IMAGE }} - # Replace_OAuth2_Proxy_Tag_in_Terraform_API_Gateway: - # needs: [Promote_Version] - # if: github.ref == 'refs/heads/edi-foundation-integration' - # uses: ./.github/workflows/update-oauth2-proxy-version-at-api-gw.yaml - # with: - # OAUTH2_PROXY_IMAGE: ${{ needs.Promote_Version.outputs.versionTag }} - # secrets: - # VAULT_HOST: ${{ secrets.VAULT_HOST }} - # VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} - # VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} + Replace_OAuth2_Proxy_Tag_in_Terraform_API_Gateway: + needs: [Promote_Version] + if: github.ref == 'refs/heads/edi-foundation-integration' + uses: ./.github/workflows/update-oauth2-proxy-version-at-api-gw.yaml + with: + OAUTH2_PROXY_IMAGE: ${{ needs.Promote_Version.outputs.versionTag }} + secrets: + VAULT_HOST: ${{ secrets.VAULT_HOST }} + VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} + VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} From 6e0f60e78319ecc82d9318013c65515cb8b3d66c Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 13:32:59 +0530 Subject: [PATCH 18/19] updating job name --- .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 0636cfd9..bc797d15 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -88,7 +88,7 @@ jobs: run: | ./.github/workflows/test.sh - BlackduckScan: + Blackduck: needs: [Init] runs-on: builder_blr steps: From c9e1955117590d04e1aa705495eba48221170b60 Mon Sep 17 00:00:00 2001 From: aswin-in-philips Date: Fri, 17 Feb 2023 14:07:14 +0530 Subject: [PATCH 19/19] updating branch name --- .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 bc797d15..34048c8a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,7 +4,7 @@ on: push: branches: - 'edi-foundation-integration' - - $default-branch + # - $default-branch paths-ignore: - 'VERSION' - '.bumpversion.cfg'