Deploy road-registry-synchost to stg: 3.67.14 #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 4. Deploy Single Service | |
run-name: 'Deploy ${{ github.event.inputs.service }} to ${{ github.event.inputs.environment }}: ${{ github.event.inputs.version }}' | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: Select the environment | |
options: | |
- tst | |
- stg | |
- prd | |
required: true | |
version: | |
description: Version | |
required: true | |
service: | |
type: choice | |
description: Select the service | |
options: | |
- road-registry-adminhost | |
- road-registry-backoffice-api | |
- road-registry-backoffice-commandhost | |
- road-registry-backoffice-eventhost | |
- road-registry-backoffice-extracthost | |
- road-registry-backoffice-ui | |
- road-registry-editor-projectionhost | |
- road-registry-producer-snapshot-projectionhost | |
- road-registry-product-projectionhost | |
- road-registry-projector | |
- road-registry-synchost | |
- road-registry-syndication-projectionhost | |
- road-registry-wfs-projectionhost | |
- road-registry-wms-projectionhost | |
required: true | |
jobs: | |
deploy_start_slack: | |
if: github.repository_owner == 'Informatievlaanderen' | |
name: Deploy started | |
runs-on: ubuntu-latest | |
steps: | |
- name: Parse repository name | |
run: echo REPOSITORY_NAME=$(echo ""$GITHUB_REPOSITORY"" | awk -F / '{print $2}' | sed -e ""s/:refs//"") >> $GITHUB_ENV | |
shell: bash | |
- name: Uppercase environment | |
run: | | |
environment=${{ github.event.inputs.environment }} | |
echo "ENVIRONMENT_UPPER=${environment,,}" >>${GITHUB_ENV} | |
- name: Notify deployment started | |
uses: slackapi/slack-github-action@v1.23.0 | |
with: | |
channel-id: '#team-wegenregister-dev' | |
slack-message: Deployment of ${{ github.event.inputs.service }} ${{ github.event.inputs.version }} to ${{ github.event.inputs.environment }} has started. View run at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.VBR_SLACK_BOT_TOKEN }} | |
SLACK_CHANNEL: ${{ secrets.VBR_NOTIFIER_CHANNEL_NAME }} | |
REPOSITORY_NAME: ${{ env.REPOSITORY_NAME }} | |
deploy_services: | |
if: github.repository_owner == 'Informatievlaanderen' | |
needs: [deploy_start_slack] | |
name: Deploy services | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
services: [ | |
'${{github.event.inputs.service}}', | |
] | |
steps: | |
- name: CD services | |
env: | |
BUILD_URL: ${{ secrets.VBR_AWS_BUILD_API }}/${{matrix.services}} | |
STATUS_URL: ${{ secrets.VBR_AWS_BUILD_STATUS_API }}/${{matrix.services}} | |
uses: informatievlaanderen/awscurl-polling-action/polling-action@v1.0.10 | |
with: | |
environment: ${{ github.event.inputs.environment == 'tst' && 'test' || github.event.inputs.environment == 'prd' && 'acc' || github.event.inputs.environment }} | |
version: ${{ github.event.inputs.version }} | |
status-url: $STATUS_URL | |
deploy-url: $BUILD_URL | |
access-key: ${{ secrets.VBR_AWS_BUILD_USER_ACCESS_KEY_ID }} | |
secret-key: ${{ secrets.VBR_AWS_BUILD_USER_SECRET_ACCESS_KEY }} | |
region: eu-west-1 | |
interval: 2 | |
- name: Output CD services | |
shell: bash | |
run: | | |
echo build-uuid: ${{ steps.awscurl-polling-action.outputs.build-uuid }} | |
echo Status: ${{ steps.awscurl-polling-action.outputs.status }} | |
echo ${{ steps.awscurl-polling-action.outputs.final-message }} | |
# deploy_lambda: | |
# if: github.repository_owner == 'Informatievlaanderen' | |
# needs: [deploy_services] | |
# name: Deploy lambda(s) | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: CD Lambda(s) Configure credentials | |
# uses: aws-actions/configure-aws-credentials@v1.7.0 | |
# with: | |
# aws-access-key-id: ${{ github.event.inputs.environment == 'tst' && secrets.VBR_AWS_ACCESS_KEY_ID_TST || github.event.inputs.environment == 'stg' && secrets.VBR_AWS_ACCESS_KEY_ID || github.event.inputs.environment == 'prd' && secrets.VBR_AWS_ACCESS_KEY_ID_NEWPRD || ''}} | |
# aws-secret-access-key: ${{ github.event.inputs.environment == 'tst' && secrets.VBR_AWS_SECRET_ACCESS_KEY_TST || github.event.inputs.environment == 'stg' && secrets.VBR_AWS_SECRET_ACCESS_KEY || github.event.inputs.environment == 'prd' && secrets.VBR_AWS_SECRET_ACCESS_KEY_NEWPRD || ''}} | |
# aws-region: ${{ secrets.VBR_AWS_REGION_PRD }} | |
# - name: Promote Lambda(s) | |
# shell: bash | |
# run: | | |
# docker pull ghcr.io/okigan/awscurl:latest | |
# docker run --rm okigan/awscurl --access_key $ACCESS_KEY_ID --secret_key $SECRET_ACCESS_KEY_ID --region $REGION -X POST -d '{ "functionName": "$FUNCTION_BACKOFFICE", "project": "basisregisters", "domain": "basisregisters" }' $PROMOTEURL/$ENVIRONMENT | |
# docker run --rm okigan/awscurl --access_key $ACCESS_KEY_ID --secret_key $SECRET_ACCESS_KEY_ID --region $REGION -X POST -d '{ "functionName": "$FUNCTION_SNAPSHOT", "project": "basisregisters", "domain": "basisregisters" }' $PROMOTEURL/$ENVIRONMENT | |
# env: | |
# ACCESS_KEY_ID: ${{ github.event.inputs.environment == 'tst' && secrets.VBR_AWS_ACCESS_KEY_ID_TST || github.event.inputs.environment == 'stg' && secrets.VBR_AWS_ACCESS_KEY_ID || github.event.inputs.environment == 'prd' && secrets.VBR_AWS_ACCESS_KEY_ID_NEWPRD || ''}} | |
# SECRET_ACCESS_KEY_ID: ${{ github.event.inputs.environment == 'tst' && secrets.VBR_AWS_SECRET_ACCESS_KEY_TST || github.event.inputs.environment == 'stg' && secrets.VBR_AWS_SECRET_ACCESS_KEY || github.event.inputs.environment == 'prd' && secrets.VBR_AWS_SECRET_ACCESS_KEY_NEWPRD || ''}} | |
# ENVIRONMENT: ${{ github.event.inputs.environment == 'tst' && 'test' || github.event.inputs.environment == 'prd' && 'acc' || github.event.inputs.environment }} | |
# REGION: ${{ secrets.VBR_AWS_REGION_PRD }} | |
# PROMOTEURL: ${{ secrets.VBR_AWS_PROMOTE_LAMBDA_BASEURL }} | |
# FUNCTION_BACKOFFICE: ${{ (github.event.inputs.environment == 'tst' || github.event.inputs.environment == 'prd') && 'rr-sqsbackofficefunction' || 'wr-sqsbackofficehandlerfunction' }} | |
# FUNCTION_SNAPSHOT: ${{ (github.event.inputs.environment == 'tst' || github.event.inputs.environment == 'prd') && 'rr-sqssnapshotfunction' || 'wr-sqssnapshothandlerfunction' }} | |
deploy_finish_slack: | |
if: github.repository_owner == 'Informatievlaanderen' | |
needs: [deploy_services] | |
name: Deploy finished | |
runs-on: ubuntu-latest | |
steps: | |
- name: Parse repository name | |
run: echo REPOSITORY_NAME=$(echo ""$GITHUB_REPOSITORY"" | awk -F / '{print $2}' | sed -e ""s/:refs//"") >> $GITHUB_ENV | |
shell: bash | |
- name: Notify deployment finished | |
uses: slackapi/slack-github-action@v1.23.0 | |
with: | |
channel-id: '#team-wegenregister-dev' | |
slack-message: ":white_check_mark: Deployment of ${{ github.event.inputs.service }} ${{ github.event.inputs.version }} to ${{ github.event.inputs.environment }} has finished." | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.VBR_SLACK_BOT_TOKEN }} | |
SLACK_CHANNEL: ${{ secrets.VBR_NOTIFIER_CHANNEL_NAME }} | |
REPOSITORY_NAME: ${{ env.REPOSITORY_NAME }} | |
deployment_notify_failure: | |
if: ${{ github.repository_owner == 'Informatievlaanderen' && failure() }} | |
name: Notify deployment failed | |
runs-on: ubuntu-latest | |
needs: [ deploy_services ] | |
steps: | |
- name: Notify deployment failed | |
id: slack | |
uses: slackapi/slack-github-action@v1.23.0 | |
with: | |
channel-id: '#team-wegenregister-dev' | |
slack-message: ":x: Deployment of road-registry ${{ github.event.inputs.version }} to ${{ github.event.inputs.environment }} has failed. View run at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.VBR_SLACK_BOT_TOKEN }} | |
SLACK_CHANNEL: ${{ secrets.VBR_NOTIFIER_CHANNEL_NAME }} |