-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Separate reusable workflows for build/test og deploy, som benyttes i alle deploy-workflows (og til PR-tester) - Skriver om deploy til intern versjonert app litt: Vi vil nå deploye _forrige_ versjon ved prodsetting. Lagrer versionId og image tag ved deploy til config-variabler (per miljø), som benyttes for deploy av forrige versjon.
- Loading branch information
1 parent
e84c8b6
commit 08b57b1
Showing
12 changed files
with
236 additions
and
198 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Deploy app to nais | ||
on: | ||
workflow_call: | ||
inputs: | ||
DEPLOY_INSTANCE: | ||
required: true | ||
type: string | ||
CLUSTER: | ||
required: true | ||
type: string | ||
IMAGE: | ||
required: true | ||
type: string | ||
DEPLOY_INTERNAL: | ||
required: false | ||
type: boolean | ||
secrets: | ||
VARS_UPDATE_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
deploy_to_nais: | ||
name: Deploy to nais | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.DEPLOY_INSTANCE }} | ||
env: | ||
PREV_VERSION_ID: ${{ vars.PREV_VERSION_ID }} | ||
PREV_IMAGE: ${{ vars.PREV_IMAGE }} | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
- name: Set version id from short commit hash | ||
run: | | ||
shortSha=$(git rev-parse --short ${{ github.sha }}) | ||
echo "VERSION_ID=$shortSha" >> $GITHUB_ENV | ||
- name: Deploy internal versioned app | ||
uses: nais/deploy/actions/deploy@v2 | ||
if: inputs.DEPLOY_INTERNAL == true && env.PREV_VERSION_ID != '' && env.PREV_IMAGE != '' | ||
env: | ||
CLUSTER: ${{ inputs.CLUSTER }} | ||
RESOURCE: .nais/config-internal.yml | ||
VAR: image=${{ env.PREV_IMAGE }},versionId=${{ env.PREV_VERSION_ID }} | ||
VARS: .nais/vars/${{ inputs.DEPLOY_INSTANCE }}.yml | ||
- name: Deploy external app | ||
uses: nais/deploy/actions/deploy@v2 | ||
env: | ||
CLUSTER: ${{ inputs.CLUSTER }} | ||
RESOURCE: .nais/config.yml | ||
VAR: image=${{ inputs.IMAGE }},versionId=${{ env.VERSION_ID }} | ||
VARS: .nais/vars/${{ inputs.DEPLOY_INSTANCE }}.yml | ||
- name: Update vars | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.VARS_UPDATE_TOKEN }} # This is a PAT with repo or Variables permission | ||
run: | | ||
gh variable set PREV_VERSION_ID --env ${{ inputs.DEPLOY_INSTANCE }} --body "${{ env.VERSION_ID }}" | ||
gh variable set PREV_IMAGE --env ${{ inputs.DEPLOY_INSTANCE }} --body "${{ inputs.IMAGE }}" | ||
gh variable list --env ${{ inputs.DEPLOY_INSTANCE }} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Deploy network policy to nais | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- .nais/network-policy.yml | ||
|
||
jobs: | ||
deploy-network-policy: | ||
name: Deploy network policy | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Deploy to prod | ||
uses: nais/deploy/actions/deploy@v2 | ||
env: | ||
CLUSTER: prod-gcp | ||
RESOURCE: .nais/network-policy.yml | ||
- name: Deploy to dev | ||
uses: nais/deploy/actions/deploy@v2 | ||
env: | ||
CLUSTER: dev-gcp | ||
RESOURCE: .nais/network-policy.yml |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
name: Deploy to Team nav.no beta | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
DEPLOY_INTERNAL: | ||
description: "Deploy previous version to internal" | ||
required: false | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build-and-test.yml | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
IMAGE_SUFFIX: dev-beta-navno | ||
secrets: inherit | ||
deploy: | ||
uses: ./.github/workflows/build-and-deploy.yml | ||
uses: ./.github/workflows/deploy-application.yml | ||
needs: build | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
DEPLOY_INSTANCE: dev-beta-navno | ||
CLUSTER: dev-gcp | ||
secrets: inherit | ||
IMAGE: ${{ needs.build.outputs.IMAGE }} | ||
DEPLOY_INTERNAL: ${{ inputs.DEPLOY_INTERNAL }} | ||
secrets: | ||
VARS_UPDATE_TOKEN: ${{ secrets.VARS_UPDATE_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
name: Deploy to TMS beta | ||
name: Deploy to Team min-side beta | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
DEPLOY_INTERNAL: | ||
description: "Deploy previous version to internal" | ||
required: false | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build-and-test.yml | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
IMAGE_SUFFIX: dev-beta-tms | ||
secrets: inherit | ||
deploy: | ||
uses: ./.github/workflows/build-and-deploy.yml | ||
uses: ./.github/workflows/deploy-application.yml | ||
needs: build | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
DEPLOY_INSTANCE: dev-beta-tms | ||
CLUSTER: dev-gcp | ||
secrets: inherit | ||
IMAGE: ${{ needs.build.outputs.IMAGE }} | ||
DEPLOY_INTERNAL: ${{ inputs.DEPLOY_INTERNAL }} | ||
secrets: | ||
VARS_UPDATE_TOKEN: ${{ secrets.VARS_UPDATE_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
name: Deploy to dev | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
DEPLOY_INTERNAL: | ||
description: "Deploy previous version to internal" | ||
required: false | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build-and-test.yml | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
IMAGE_SUFFIX: dev-stable | ||
secrets: inherit | ||
deploy: | ||
uses: ./.github/workflows/build-and-deploy.yml | ||
uses: ./.github/workflows/deploy-application.yml | ||
needs: build | ||
permissions: | ||
id-token: write | ||
contents: read | ||
with: | ||
DEPLOY_INSTANCE: dev-stable | ||
CLUSTER: dev-gcp | ||
secrets: inherit | ||
IMAGE: ${{ needs.build.outputs.IMAGE }} | ||
DEPLOY_INTERNAL: ${{ inputs.DEPLOY_INTERNAL }} | ||
secrets: | ||
VARS_UPDATE_TOKEN: ${{ secrets.VARS_UPDATE_TOKEN }} |
Oops, something went wrong.