Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 9 additions & 45 deletions .github/workflows/deploy_to_development.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,28 @@
name: Deploy to Development

# Only one workflow in a concurrency group may run at a time
concurrency:
group: development-concurrency
cancel-in-progress: true

permissions:
contents: read
packages: write

on:
push:
branches:
- "main"
branches: [main]
paths-ignore:
- "train/**"

jobs:
trigger-github-deployment:
name: Trigger GitHub Deployment
environment: Development
runs-on: ubuntu-latest
steps:
- name: Empty Step
run: echo "Hello World"

get-short-sha:
needs: trigger-github-deployment
outputs:
tag: ${{ steps.get-tag.outputs.tag }}
runs-on: ubuntu-latest
steps:
- id: get-tag
run: |
SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-8)
echo "tag=$SHA_SHORT" >> "$GITHUB_OUTPUT"

build-and-push-components-to-ghcr:
name: Build and push containers to github container registry for Development
needs: [trigger-github-deployment, get-short-sha]
uses: ./.github/workflows/publish_component.yml
with:
Registry: roboticsdevacr.azurecr.io
ImageName: robotics/sara-thermal-reading
Tag: "dev.${{ needs.get-short-sha.outputs.tag }}"
secrets:
RegistryUsername: ${{ secrets.ROBOTICS_ROBOTICSDEVACR_USERNAME }}
RegistryPassword: ${{ secrets.ROBOTICS_ROBOTICSDEVACR_PASSWORD }}
permissions:
contents: read
packages: write

jobs:
deploy:
name: Update deployment in Development
needs: [build-and-push-components-to-ghcr, get-short-sha, trigger-github-deployment]
uses: equinor/armada/.github/workflows/update_kubernetes_deployment.yml@main
uses: equinor/armada/.github/workflows/deploy_to_development.yml@main
with:
environment: development
registry: roboticsdevacr.azurecr.io
image_name: robotics/sara-thermal-reading
tag: "dev.${{ needs.get-short-sha.outputs.tag }}"
author_email: ${{ github.event.head_commit.author.email }}
author_name: ${{ github.event.head_commit.author.name }}
infrastructure_repository: equinor/analytics-infrastructure
environment_name: Development
secrets:
registry_username: ${{ secrets.ROBOTICS_ROBOTICSDEVACR_USERNAME }}
registry_password: ${{ secrets.ROBOTICS_ROBOTICSDEVACR_PASSWORD }}
deploy_key: ${{ secrets.ANALYTICS_INFRASTRUCTURE_DEPLOY_KEY }}
29 changes: 8 additions & 21 deletions .github/workflows/deploy_to_staging.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,27 @@
name: Deploy to Staging

# Only one workflow in a concurrency group may run at a time
concurrency:
group: staging-concurrency
cancel-in-progress: true

permissions:
contents: read
packages: write

on:
release:
types: [published]

jobs:
build-and-push-release-to-robotics-staging-registry:
name: Build and push containers to roboticsstagingacr for Staging
uses: ./.github/workflows/publish_component.yml
with:
Registry: roboticsstagingacr.azurecr.io
ImageName: robotics/sara-thermal-reading
Tag: ${{ github.event.release.tag_name }}
secrets:
RegistryUsername: ${{ secrets.ROBOTICS_ROBOTICSSTAGINGACR_USERNAME }}
RegistryPassword: ${{ secrets.ROBOTICS_ROBOTICSSTAGINGACR_PASSWORD }}
permissions:
contents: read
packages: write

jobs:
deploy:
name: Update deployment in Staging
needs: [build-and-push-release-to-robotics-staging-registry]
uses: equinor/armada/.github/workflows/update_kubernetes_deployment.yml@main
uses: equinor/armada/.github/workflows/deploy_to_staging.yml@main
with:
environment: staging
registry: roboticsstagingacr.azurecr.io
image_name: robotics/sara-thermal-reading
tag: ${{ github.event.release.tag_name }}
author_name: ${{ github.event.release.author.login }}
infrastructure_repository: equinor/analytics-infrastructure
author_name: ${{ github.event.release.author.login }}
secrets:
registry_username: ${{ secrets.ROBOTICS_ROBOTICSSTAGINGACR_USERNAME }}
registry_password: ${{ secrets.ROBOTICS_ROBOTICSSTAGINGACR_PASSWORD }}
deploy_key: ${{ secrets.ANALYTICS_INFRASTRUCTURE_DEPLOY_KEY }}
68 changes: 13 additions & 55 deletions .github/workflows/promote_to_production.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,28 @@
name: Promote to Production

# 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 Thermal Reading version in staging
id: get_version_tag
run: |
TAG_LINE_NUMBER=$(($(grep -n "roboticsstagingacr.azurecr.io/robotics/sara-thermal-reading" 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"

copy-image-to-robotics-prod-registry:
name: Copy staging image to robotics prod registry
needs: get_staging_version
runs-on: ubuntu-latest
steps:
- name: Log in to robotics staging registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 #v4
with:
registry: roboticsstagingacr.azurecr.io
username: ${{ secrets.ROBOTICS_ROBOTICSSTAGINGACR_USERNAME }}
password: ${{ secrets.ROBOTICS_ROBOTICSSTAGINGACR_PASSWORD }}

- name: Log in to robotics prod registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 #v4
with:
registry: roboticsprodacr.azurecr.io
username: ${{ secrets.ROBOTICS_ROBOTICSPRODACR_USERNAME }}
password: ${{ secrets.ROBOTICS_ROBOTICSPRODACR_PASSWORD }}
permissions:
contents: read
packages: write

- name: Copy image from staging to prod registry
run: |
docker buildx imagetools create \
--tag roboticsprodacr.azurecr.io/robotics/sara-thermal-reading:${{ needs.get_staging_version.outputs.versionTag }} \
--tag roboticsprodacr.azurecr.io/robotics/sara-thermal-reading:latest \
roboticsstagingacr.azurecr.io/robotics/sara-thermal-reading:${{ needs.get_staging_version.outputs.versionTag }}

deploy:
name: Update deployment in Production
needs: [get_staging_version, copy-image-to-robotics-prod-registry]
uses: equinor/armada/.github/workflows/update_kubernetes_deployment.yml@main
jobs:
promote:
uses: equinor/armada/.github/workflows/promote_to_production.yml@main
with:
environment: production
tag: ${{ needs.get_staging_version.outputs.versionTag }}
registry: roboticsprodacr.azurecr.io
image_name: robotics/sara-thermal-reading
author_name: ${{ github.actor }}
staging_registry: roboticsstagingacr.azurecr.io
production_registry: roboticsprodacr.azurecr.io
infrastructure_repository: equinor/analytics-infrastructure
author_name: ${{ github.actor }}
secrets:
staging_registry_username: ${{ secrets.ROBOTICS_ROBOTICSSTAGINGACR_USERNAME }}
staging_registry_password: ${{ secrets.ROBOTICS_ROBOTICSSTAGINGACR_PASSWORD }}
production_registry_username: ${{ secrets.ROBOTICS_ROBOTICSPRODACR_USERNAME }}
production_registry_password: ${{ secrets.ROBOTICS_ROBOTICSPRODACR_PASSWORD }}
deploy_key: ${{ secrets.ANALYTICS_INFRASTRUCTURE_DEPLOY_KEY }}
53 changes: 0 additions & 53 deletions .github/workflows/publish_component.yml

This file was deleted.

Loading