From 685b63c41fa3c07b6f5f5e3a45207a967f3ae374 Mon Sep 17 00:00:00 2001 From: Micaiah Martin <77340197+mimartin12@users.noreply.github.com> Date: Wed, 16 Mar 2022 15:18:35 +0000 Subject: [PATCH] Updated actions & applied linting (#1912) --- .github/workflows/build.yml | 69 ++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 072f9ffc1..db0887d8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Install cloc run: | @@ -55,7 +55,7 @@ jobs: nuget-version: '5' - name: Set up MSBuild - uses: microsoft/setup-msbuild@c26a08ba26249b81327e26f6ef381897b6a8754d + uses: microsoft/setup-msbuild@ab534842b4bdf384b8aaf93765dc6f721d9f5fab - name: Print environment run: | @@ -66,14 +66,7 @@ jobs: echo "GitHub event: $GITHUB_EVENT" - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f - - - uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # 2.1.7 - with: - path: ${{ github.workspace }}/.nuget/packages - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - restore-keys: | - ${{ runner.os }}-nuget- + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Restore run: msbuild /t:restore /p:RestoreLockedMode=true @@ -131,7 +124,7 @@ jobs: node: true steps: - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Set up Node uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0 @@ -178,7 +171,7 @@ jobs: ls -atlh ../../../ - name: Upload service artifact - uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 + uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 with: name: ${{ matrix.service_name }}.zip path: ${{ matrix.base_path }}/${{ matrix.service_name }}/${{ matrix.service_name }}.zip @@ -247,7 +240,7 @@ jobs: dotnet: true steps: - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 ########## Build Docker Image ########## - name: Setup service name @@ -260,7 +253,7 @@ jobs: - name: Get build artifact if: ${{ matrix.dotnet }} - uses: actions/download-artifact@3be87be14a055c47b01d3bd88f8fe02320a9bb60 # v2.0.10 + uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 with: name: ${{ matrix.service_name }}.zip @@ -283,7 +276,7 @@ jobs: ########## ACR ########## - name: Login to Azure - QA Subscription - uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a + uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf with: creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }} @@ -310,17 +303,21 @@ jobs: - name: Login to Azure - Prod Subscription if: | contains(matrix.docker_repos, 'bitwarden') - && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') - uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a + && (github.ref == 'refs/heads/master' || + github.ref == 'refs/heads/rc' || + github.ref == 'refs/heads/hotfix-rc') + uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf with: creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} - name: Retrieve secrets if: | contains(matrix.docker_repos, 'bitwarden') - && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') + && (github.ref == 'refs/heads/master' || + github.ref == 'refs/heads/rc' || + github.ref == 'refs/heads/hotfix-rc') id: retrieve-secrets - uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403 + uses: Azure/get-keyvault-secrets@b5c723b9ac7870c022b8c35befe620b7009b336f with: keyvault: "bitwarden-prod-kv" secrets: "docker-password, @@ -331,7 +328,9 @@ jobs: - name: Log into Docker if: | contains(matrix.docker_repos, 'bitwarden') - && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') + && (github.ref == 'refs/heads/master' || + github.ref == 'refs/heads/rc' || + github.ref == 'refs/heads/hotfix-rc') env: DOCKER_USERNAME: ${{ steps.retrieve-secrets.outputs.docker-username }} DOCKER_PASSWORD: ${{ steps.retrieve-secrets.outputs.docker-password }} @@ -340,7 +339,9 @@ jobs: - name: Setup Docker Trust if: | contains(matrix.docker_repos, 'bitwarden') - && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') + && (github.ref == 'refs/heads/master' || + github.ref == 'refs/heads/rc' || + github.ref == 'refs/heads/hotfix-rc') env: DCT_DELEGATION_KEY_ID: "c9bde8ec820701516491e5e03d3a6354e7bd66d05fa3df2b0062f68b116dc59c" DCT_DELEGATE_KEY: ${{ steps.retrieve-secrets.outputs.dct-delegate-2-key }} @@ -354,7 +355,9 @@ jobs: - name: Tag and Push RC to Docker Hub if: | contains(matrix.docker_repos, 'bitwarden') - && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') + && (github.ref == 'refs/heads/master' || + github.ref == 'refs/heads/rc' || + github.ref == 'refs/heads/hotfix-rc') env: REGISTRY: bitwarden run: | @@ -370,7 +373,9 @@ jobs: - name: Log out of Docker and disable Docker Notary if: | contains(matrix.docker_repos, 'bitwarden') - && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc') + && (github.ref == 'refs/heads/master' || + github.ref == 'refs/heads/rc' || + github.ref == 'refs/heads/hotfix-rc') run: | docker logout echo "DOCKER_CONTENT_TRUST=0" >> $GITHUB_ENV @@ -382,13 +387,15 @@ jobs: needs: build-docker steps: - name: Checkout repo - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f + uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 - name: Restore run: dotnet tool restore - name: Make Docker stub - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc' + if: github.ref == 'refs/heads/master' || + github.ref == 'refs/heads/rc' || + github.ref == 'refs/heads/hotfix-rc' run: | if [[ "${{ github.ref }}" == "rc" ]]; then SETUP_IMAGE="bitwarden/setup:rc" @@ -413,7 +420,7 @@ jobs: - name: Upload Docker stub artifact if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc' - uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 + uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 with: name: docker-stub.zip path: docker-stub.zip @@ -421,7 +428,7 @@ jobs: - name: Upload Docker stub checksum artifact if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc' - uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 + uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 with: name: docker-stub-sha256.txt path: docker-stub-sha256.txt @@ -446,7 +453,7 @@ jobs: DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2 - name: Upload Swagger artifact - uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 + uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 with: name: swagger.json path: swagger.json @@ -493,21 +500,21 @@ jobs: fi - name: Login to Azure - Prod Subscription - uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a + uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf if: failure() with: creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} - name: Retrieve secrets id: retrieve-secrets - uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403 + uses: Azure/get-keyvault-secrets@b5c723b9ac7870c022b8c35befe620b7009b336f if: failure() with: keyvault: "bitwarden-prod-kv" secrets: "devops-alerts-slack-webhook-url" - name: Notify Slack on failure - uses: act10ns/slack@e4e71685b9b239384b0f676a63c32367f59c2522 # v1.2.2 + uses: act10ns/slack@da3191ebe2e67f49b46880b4633f5591a96d1d33 # v1.2.2 if: failure() env: SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}