From f5b77494ea124ebf2791ccd4fef57214819c5c5b Mon Sep 17 00:00:00 2001 From: Jonathan M Smolenski Date: Fri, 2 Feb 2024 10:32:24 -0800 Subject: [PATCH] applying cicd updates to be triggered from swodlr repo --- .github/workflows/build.yml | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ad22e8..89d3fd9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,9 @@ on: options: - SIT - UAT + commit: + type: string + description: Custom commit hash jobs: build: @@ -38,10 +41,14 @@ jobs: - uses: hashicorp/setup-terraform@v3 with: terraform_version: 1.3.7 - - uses: actions/checkout@v4 + - name: Initial checkout ${{ github.ref }} + if: github.event.inputs.commit == '' + uses: actions/checkout@v4 + - name: Adjust to proper commit hash ${{ github.event.inputs.commit }} + if: github.event.inputs.commit != '' + uses: actions/checkout@v4 with: - repository: ${{ github.repository }} - token: ${{ steps.podaac-cicd.outputs.token }} + ref: ${{ github.event.inputs.commit }} - uses: actions/setup-python@v4 with: python-version: '3.9' @@ -134,7 +141,6 @@ jobs: mask-aws-account-id: true - uses: actions/checkout@v4 with: - repository: ${{ github.repository }} ref: ${{ needs.build.outputs.github_sha }} - uses: hashicorp/setup-terraform@v3 with: @@ -163,3 +169,16 @@ jobs: echo "${{ secrets.JPLICA_CERT }}" >> ${{ runner.temp }}/JPLICA.pem source bin/config.sh ${{ vars.TF_VENUE }} terraform apply -auto-approve + - name: Retrieve version number for notifications + run: | + VERSION=$(cat bumpver.toml|grep current_version |grep -v {version} |sed -E "s/current_version = //"|sed -E "s/\"//g") + echo "SUBMODULE_VERSION=$VERSION">>$GITHUB_ENV + - name: Send notifications to slack + uses: slackapi/slack-github-action@v1.25.0 + env: + SLACK_WEBHOOK_URL: ${{ secrets.NOTIFICATION_WEBHOOK_SWODLR }} + with: + payload: | + { + "message": "${{ github.repository }} [version ${{ env.SUBMODULE_VERSION }}] has been deployed to the ${{ needs.build.outputs.deploy_env }} environment" + }