diff --git a/.github/workflows/ci-integrated.yaml b/.github/workflows/ci.yaml similarity index 76% rename from .github/workflows/ci-integrated.yaml rename to .github/workflows/ci.yaml index f47ddaaa..773b6ff8 100644 --- a/.github/workflows/ci-integrated.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: CI-INTEGRATED +name: CI on: push: @@ -108,6 +108,9 @@ jobs: Build: needs: [Init] runs-on: ubuntu-20.04 + outputs: + envoyAlphaTag: ${{ steps.setVariables.outputs.alphaTag }} + ciImage: ${{ steps.setVariables.outputs.ciImage }} steps: - uses: actions/checkout@v2 @@ -133,12 +136,13 @@ jobs: - name: Set env variables run: | new_version=`cat VERSION` + alpha_tag="${new_version}-alpha" echo "New version is: $new_version" echo "VERSION=$new_version" >> "$GITHUB_ENV" - echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${new_version}-alpha" >> "$GITHUB_ENV" + echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${new_version}-${alpha_tag}" >> "$GITHUB_ENV" + echo "::set-output name=ciImage::${{ env.CI_IMAGE }}" echo "CI_LATEST_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:latest" >> "$GITHUB_ENV" - echo "BRANCH_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${{ steps.branch.outputs.branch_name }}-${new_version}" >> "$GITHUB_ENV" - echo "RC_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV" + echo "::set-output name=alphaTag::${alpha_tag}" - name: Docker Build run: | @@ -150,28 +154,27 @@ jobs: - name: Docker tag run: | - docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest ${{ env.BRANCH_IMAGE }} - docker push ${{ env.BRANCH_IMAGE }} + docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest ${{ env.CI_IMAGE }} + 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.BRANCH_IMAGE }} ${{ env.CI_IMAGE }} - docker push ${{ env.CI_IMAGE }} - - Deploy_And_GW_Integrated_Test: + Deploy_Test_HDS_AUTH_GATEWAY: needs: [Build, Blackduck, Fortify, unit-test] - if: github.ref == 'refs/heads/edi-foundation-integration' - uses: ./.github/workflows/api-gw-integrated-test.yaml + uses: ./.github/workflows/deploy-hds-auth-gateway.yaml + with: + OAUTH2_PROXY_IMAGE: ${{ needs.Build.outputs.envoyAlphaTag }} secrets: VAULT_HOST: ${{ secrets.VAULT_HOST }} VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }} VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }} - Release: + Promote_Version: + needs: [Deploy_Test_HDS_AUTH_GATEWAY] if: github.ref == 'refs/heads/edi-foundation-integration' - needs: Deploy_And_GW_Integrated_Test runs-on: ubuntu-20.04 + outputs: + versionTag: ${{ steps.setVariables.outputs.versionTag }} steps: - uses: actions/checkout@v2 @@ -190,17 +193,32 @@ jobs: 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}-alpha" >> "$GITHUB_ENV" - echo "CI_LATEST_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi-foundation-oauth2-proxy:latest" >> "$GITHUB_ENV" echo "RC_IMAGE=docker.na1.hsdp.io/edisp-releases/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV" + echo "::set-output name=versionTag::${new_version}-rc" + echo "${new_version}-rc" - - name: Login to Docker Repo - run: docker login ${{ env.HSDP_DOCKER_REGISTRY }} --username ${{ env.HSDP_DOCKER_USER }} --password ${{ env.HSDP_DOCKER_PASSWORD }} + - 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 }} \ No newline at end of file + 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 }} diff --git a/.github/workflows/ci-gated.yaml b/.github/workflows/deploy-hds-auth-gateway.yaml similarity index 56% rename from .github/workflows/ci-gated.yaml rename to .github/workflows/deploy-hds-auth-gateway.yaml index 347f0b70..632d9bae 100644 --- a/.github/workflows/ci-gated.yaml +++ b/.github/workflows/deploy-hds-auth-gateway.yaml @@ -1,20 +1,22 @@ -name: CI-GATED +name: Deploy HDS Auth Gateway with a given Oauth2 Proxy Image Tag -on: - pull_request: - branches: [ edi-foundation-integration ] - workflow_dispatch: +on: + workflow_call: + inputs: + OAUTH2_PROXY_IMAGE: + type: string + required: true + secrets: + VAULT_HOST: + required: true + VAULT_ROLE_ID: + required: true + VAULT_SECRET_ID: + required: true jobs: - Wokflow-Queue: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: ahmadnassri/action-workflow-queue@v1 - - Gated: - needs: [Wokflow-Queue] - runs-on: ubuntu-20.04 + Deploy_HDS_Auth_Gateway_With_Token_Authenticator_Image: + runs-on: ubuntu-20.04 steps: - name: Import Secrets id: secrets @@ -33,5 +35,6 @@ jobs: owner: philips-internal repo: hds-auth-gateway github_token: ${{ env.GITHUB_TOKEN }} + client_payload: '{"oauth2proxytag": "${{ inputs.OAUTH2_PROXY_IMAGE }}"}' workflow_file_name: ci.yaml ref: master \ No newline at end of file diff --git a/.github/workflows/update-oauth2-proxy-version-at-api-gw.yaml b/.github/workflows/update-oauth2-proxy-version-at-api-gw.yaml new file mode 100644 index 00000000..37bce543 --- /dev/null +++ b/.github/workflows/update-oauth2-proxy-version-at-api-gw.yaml @@ -0,0 +1,40 @@ +name: Update OAuth2 Proxy version at API-GW + +on: + workflow_call: + inputs: + OAUTH2_PROXY_IMAGE: + type: string + required: true + 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: terraform-api-gateway + github_token: ${{ env.GITHUB_TOKEN }} + client_payload: '{"oauth2proxytag": "${{ inputs.OAUTH2_PROXY_IMAGE }}"}' + workflow_file_name: set-images-version.yml + ref: main \ No newline at end of file diff --git a/.github/workflows/workflow-call-ci-gated.yml b/.github/workflows/workflow-call-ci-gated.yml deleted file mode 100644 index 4acfaa37..00000000 --- a/.github/workflows/workflow-call-ci-gated.yml +++ /dev/null @@ -1,144 +0,0 @@ -name: Deploy CI - -on: - workflow_call: - secrets: - INNER_SOURCE_ACTIONS_APP_ID: - required: true - INNER_SOURCE_ACTIONS_APP_PRIVATE_KEY_BASE64: - required: true - GH_PAT_TOKEN: - required: true - HSDP_DOCKER_USER: - required: true - HSDP_DOCKER_PASSWORD: - required: true - CODESCENE_CI_CD_GITHUB_TOKEN: - required: true - ARM_CLIENT_ID: - required: true - ARM_CLIENT_SECRET: - required: true - -env: - TF_IN_AUTOMATION: true - ARM_SUBSCRIPTION_ID: 74d03f75-4bdb-4666-8095-500178a40764 - ARM_TENANT_ID: 1a407a2d-7675-4d17-8692-b3ac285306e4 -jobs: - terragrunt-workflow-core: - name: Terragrunt - core - runs-on: ubuntu-20.04 - container: alpine/terragrunt:1.0.1 - outputs: - core: ${{ steps.tf_output.outputs.core }} - env: - ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} - ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} - defaults: - run: - working-directory: ./deploy/ci-gated/core - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v1 - - id: inner-source-action - uses: ./.github/workflows/innersource-action - with: - GH_PAT_TOKEN: ${{ secrets.GH_PAT_TOKEN }} - INNER_SOURCE_ACTIONS_APP_ID: ${{ secrets.INNER_SOURCE_ACTIONS_APP_ID }} - INNER_SOURCE_ACTIONS_APP_PRIVATE_KEY_BASE64: ${{ secrets.INNER_SOURCE_ACTIONS_APP_PRIVATE_KEY_BASE64 }} - - - id: plan - uses: ./../.actions/terragrunt-plan-action - with: - working-directory: ./deploy/ci-gated/core - key: client-test-core-plan - - - id: apply - uses: ./../.actions/terragrunt-apply-action - with: - working-directory: ./deploy/ci-gated/core - key: client-test-core-plan - - - id: output - uses: ./.github/workflows/terragrunt-output-action - with: - working-directory: ./deploy/ci-gated/core - key: client-test-core-output - - terragrunt-workflow-cloudfoundry: - name: Terragrunt - cloudfoundry - runs-on: ubuntu-20.04 - needs: [terragrunt-workflow-core] - container: alpine/terragrunt:1.0.1 - env: - ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} - ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} - defaults: - run: - working-directory: ./deploy/ci-gated/cloudfoundry - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v1 - - id: inner-source-action - uses: ./.github/workflows/innersource-action - with: - GH_PAT_TOKEN: ${{ secrets.GH_PAT_TOKEN }} - INNER_SOURCE_ACTIONS_APP_ID: ${{ secrets.INNER_SOURCE_ACTIONS_APP_ID }} - INNER_SOURCE_ACTIONS_APP_PRIVATE_KEY_BASE64: ${{ secrets.INNER_SOURCE_ACTIONS_APP_PRIVATE_KEY_BASE64 }} - - - id: plan - uses: ./../.actions/terragrunt-plan-action - with: - working-directory: ./deploy/ci-gated/cloudfoundry - key: client-test-cloudfoundry-plan - - - id: apply - uses: ./../.actions/terragrunt-apply-action - with: - working-directory: ./deploy/ci-gated/cloudfoundry - key: client-test-cloudfoundry-plan - - terragrunt-workflow-api-gateway: - name: Terragrunt - api-gateway - runs-on: ubuntu-20.04 - needs: [terragrunt-workflow-cloudfoundry] - container: alpine/terragrunt:1.0.1 - env: - ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} - ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} - CONFIG: ./envoyconfig_without_multitenancy.yml - SOURCE: url - defaults: - run: - working-directory: ./deploy/ci-gated/api-gateway - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v1 - - id: inner-source-action - uses: ./.github/workflows/innersource-action - with: - GH_PAT_TOKEN: ${{ secrets.GH_PAT_TOKEN }} - INNER_SOURCE_ACTIONS_APP_ID: ${{ secrets.INNER_SOURCE_ACTIONS_APP_ID }} - INNER_SOURCE_ACTIONS_APP_PRIVATE_KEY_BASE64: ${{ secrets.INNER_SOURCE_ACTIONS_APP_PRIVATE_KEY_BASE64 }} - - - - id: plan - uses: ./../.actions/terragrunt-plan-action - with: - working-directory: ./deploy/ci-gated/api-gateway - key: client-test-api-gateway-plan - - - id: apply - uses: ./../.actions/terragrunt-apply-action - with: - working-directory: ./deploy/ci-gated/api-gateway - key: client-test-api-gateway-plan - - - id: output - uses: ./.github/workflows/terragrunt-output-action - with: - working-directory: ./deploy/ci-gated/api-gateway - key: client-test-api-gateway-output \ No newline at end of file diff --git a/AutomationTest/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs b/AutomationTest/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs new file mode 100644 index 00000000..ad8dfe1a --- /dev/null +++ b/AutomationTest/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")] diff --git a/AutomationTest/obj/Debug/netcoreapp3.1/Philips.EDI.Foundation.APIGateway.AutomationTest.AssemblyInfo.cs b/AutomationTest/obj/Debug/netcoreapp3.1/Philips.EDI.Foundation.APIGateway.AutomationTest.AssemblyInfo.cs new file mode 100644 index 00000000..a9c8bc92 --- /dev/null +++ b/AutomationTest/obj/Debug/netcoreapp3.1/Philips.EDI.Foundation.APIGateway.AutomationTest.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("Philips")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.2.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.2")] +[assembly: System.Reflection.AssemblyProductAttribute("Philips.EDI.Foundation.APIGateway.AutomationTest")] +[assembly: System.Reflection.AssemblyTitleAttribute("Philips.EDI.Foundation.APIGateway.AutomationTest")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.2.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/AutomationTest/obj/Debug/netcoreapp3.1/Philips.EDI.Foundation.APIGateway.AutomationTest.AssemblyInfoInputs.cache b/AutomationTest/obj/Debug/netcoreapp3.1/Philips.EDI.Foundation.APIGateway.AutomationTest.AssemblyInfoInputs.cache new file mode 100644 index 00000000..268a0967 --- /dev/null +++ b/AutomationTest/obj/Debug/netcoreapp3.1/Philips.EDI.Foundation.APIGateway.AutomationTest.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +7d70c0bc511987c3ae105cb98159f5949d6dabfa diff --git a/AutomationTest/obj/Debug/netcoreapp3.1/Philips.EDI.Foundation.APIGateway.AutomationTest.GeneratedMSBuildEditorConfig.editorconfig b/AutomationTest/obj/Debug/netcoreapp3.1/Philips.EDI.Foundation.APIGateway.AutomationTest.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 00000000..63458cd0 --- /dev/null +++ b/AutomationTest/obj/Debug/netcoreapp3.1/Philips.EDI.Foundation.APIGateway.AutomationTest.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,3 @@ +is_global = true +build_property.RootNamespace = Philips.EDI.Foundation.APIGateway.AutomationTest +build_property.ProjectDir = c:\oauth2-proxy\AutomationTest\