Skip to content

Deploy branch to dev-fss [manual deploy] #4

Deploy branch to dev-fss [manual deploy]

Deploy branch to dev-fss [manual deploy] #4

name: Deploy branch to dev-fss [manual deploy]
# If you want to deploy a branch (feature branch or even redeploy master/main) to dev-fss (preprod) we use Github actions workflow_dispatch
# Goto https://github.com/navikt/su-se-bakover/actions/workflows/su-se-bakover-branch-deploy.yml choose a branch and deploy it
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
on: workflow_dispatch
permissions: {}
jobs:
verify-master-is-ancestor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: | # git merge-base returns 0 when master is ancestor, 1 if it is not (other positive numbers on error)
set +e
origin_master="$(git rev-parse origin/master)"
head="$(git rev-parse HEAD)"
echo "Hash for origin master: ${origin_master}. Hash for HEAD: ${head}."
merge_base="$(git merge-base $origin_master HEAD)"
echo "Merge-base: ${merge_base}"
git merge-base --is-ancestor $origin_master HEAD
return_code=$?
echo "Return code of 'git merge-base': ${return_code}"
if [[ return_code -gt 0 ]]; then
echo "You have to merge origin/master before you can deploy a branch."
exit 1
fi
build-test-push-image:
name: Build, test and push image
needs: verify-master-is-ancestor
runs-on: ubuntu-latest-8-cores
permissions:
contents: read
id-token: write # needed for push-image
steps:
- uses: actions/checkout@v4
- name: Build and test
uses: ./.github/actions/build-and-test
- name: Push image
uses: ./.github/actions/push-image
with:
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
tag: ${{ github.sha }}
image_suffix: 'app'
deploy-to-preprod:
needs: build-test-push-image
name: Deploy to preprod
permissions:
contents: read
id-token: write
uses: navikt/su-se-bakover/.github/workflows/reusable-deploy.yml@master
with:
cluster: dev-fss
vars: nais-dev.json
var: image=europe-north1-docker.pkg.dev/nais-management-233d/supstonad/su-se-bakover-app:${{ github.sha }}