Skip to content

Promote to Production #44

Promote to Production

Promote to Production #44

name: Promote to Production
permissions:
contents: read
pull-requests: read
packages: write
# Only one workflow in a concurrency group may run at a time
concurrency:
group: production-concurrency
cancel-in-progress: true
on:
workflow_dispatch:
jobs:
get_staging_version:
name: Get version from staging
outputs:
versionTag: ${{ steps.get_version_tag.outputs.tag }}
runs-on: ubuntu-latest
steps:
- name: Checkout infrastructure
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6
with:
ref: main
repository: equinor/analytics-infrastructure
ssh-key: ${{ secrets.ANALYTICS_INFRASTRUCTURE_DEPLOY_KEY }}
- name: Get SARA version in staging
id: get_version_tag
# Search for the exact line referring to the sara image to avoid getting the other
# lines containing sara (e.g. sara-anonymizer)
run: |
TAG_LINE_NUMBER=$(($(grep -n -x " newName: auroraprodacr.azurecr.io/robotics/sara" k8s_kustomize/overlays/staging/kustomization.yaml | cut --delimiter=":" --fields=1)+1))
VERSION_TAG=$(sed -n "${TAG_LINE_NUMBER}p" k8s_kustomize/overlays/staging/kustomization.yaml | cut --delimiter=":" --fields=2)
echo "tag=$VERSION_TAG" >> "$GITHUB_OUTPUT"
run_migrations:
name: Update database in Production
needs: get_staging_version
permissions:
contents: read
pull-requests: read
id-token: write
uses: equinor/armada/.github/workflows/run_dotnet_migrations.yml@main
with:
environment: Production
checkout_ref: ${{ needs.get_staging_version.outputs.versionTag }}
working_directory: api
azure_subscription_id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
deploy:
name: Update deployment in Production
needs: get_staging_version
uses: equinor/armada/.github/workflows/update_kubernetes_deployment.yml@main
strategy:
max-parallel: 1
matrix:
include:
- image_name: robotics/sara
- image_name: robotics/workflow-notifier
with:
environment: production
tag: ${{ needs.get_staging_version.outputs.versionTag }}
registry: auroraprodacr.azurecr.io
image_name: ${{ matrix.image_name }}
author_name: ${{ github.actor }}
infrastructure_repository: equinor/analytics-infrastructure
secrets:
deploy_key: ${{ secrets.ANALYTICS_INFRASTRUCTURE_DEPLOY_KEY }}