Skip to content

Manual preprod-q2 deploy of branch feature/soknad-avroskjema-fra-ghb #265

Manual preprod-q2 deploy of branch feature/soknad-avroskjema-fra-ghb

Manual preprod-q2 deploy of branch feature/soknad-avroskjema-fra-ghb #265

Workflow file for this run

name: Manually triggered deployment
run-name: Manual ${{ github.event.inputs.environment }} deploy of branch ${{ github.head_ref || github.ref_name }}
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy'
required: true
default: 'preprod-q2'
type: choice
options:
- none
- preprod-q1
- preprod-q2
- loadtests
- prod
permissions:
contents: "read"
id-token: "write"
jobs:
build-and-push:
name: Build and push Docker container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'maven'
- name: set timezone
uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Oslo"
- name: Build with maven
run: mvn install --file pom.xml
- name: Build and push Docker image
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: team-soknad
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
image_suffix: ${{ github.event.inputs.environment }}
byosbom: target/classes/META-INF/sbom/application.cdx.json
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
deploy-preprod-q1:
name: Deploy to preprod-q1
needs: build-and-push
if: github.event.inputs.environment == 'preprod-q1'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yml
VARS: .nais/config-preprod.json
VAR: image=${{ needs.build-and-push.outputs.image }}
deploy-preprod-q2:
name: Deploy to preprod-q2
needs: build-and-push
if: github.event.inputs.environment == 'preprod-q2'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yml
VARS: .nais/config-preprod-q2.json
VAR: image=${{ needs.build-and-push.outputs.image }}
deploy-loadtests:
name: Deploy to preprod loadtests
needs: build-and-push
if: github.event.inputs.environment == 'loadtests'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yml
VARS: .nais/config-loadtests.json
VAR: image=${{ needs.build-and-push.outputs.image }}
deploy-prod:
name: Deploy to prod
needs: build-and-push
if: github.event.inputs.environment == 'prod'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yml
VARS: .nais/config-prod.json
VAR: image=${{ needs.build-and-push.outputs.image }}
deploy-alerts-preprod:
needs: [ deploy-preprod-q1, deploy-preprod-q2 ]
if: always() && (needs.deploy-preprod-q1.result == 'success' || needs.deploy-preprod-q2.result == 'success')
name: Deploy alerts to dev
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to dev
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: .nais/alerts.yml
VARS: .nais/preprod-alert.json
deploy-alerts-prod:
if: github.event.inputs.environment == 'prod'
needs: deploy-prod
name: Deploy alerts to prod
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to dev
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: .nais/alerts.yml
VARS: .nais/prod-alert.json