Skip to content

Commit

Permalink
Merge pull request #196 from navikt/refactor-deployments
Browse files Browse the repository at this point in the history
Refactor deployments
  • Loading branch information
Thomas-CT authored Aug 16, 2023
2 parents ffdf0db + 818ab77 commit 3354378
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 56 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/auto-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Autodeployment
run-name: Autodeploy til prod (hver mandag)
on:
schedule:
- cron: '0 08 * * 1' # kl 09 hver mandag

jobs:
build-push-deploy-main:
uses: ./.github/workflows/main.yml
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths-ignore:
- '**.md'
- '**/**.md'
workflow_call:

jobs:
build-and-test:
Expand Down
67 changes: 11 additions & 56 deletions .github/workflows/manual-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,62 +14,17 @@ on:
- prod

jobs:
build-and-test:
name: Test frontend
uses: ./.github/workflows/test.yml

build-and-push:
name: Build and push Docker container for ${{ inputs.environment }}
uses: ./.github/workflows/build-push.yml
with:
environment: ${{ inputs.environment }}
preprod:
if: inputs.environment == 'preprod'
uses: ./.github/workflows/preprod.yml
secrets: inherit

deploy-preprod:
name: Deploy to preprod
needs: [build-and-test, build-and-push]
if: github.event.inputs.environment == 'preprod'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
PRINT_PAYLOAD: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais-preprod.yml
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}

deploy-preprod-alt:
name: Deploy to preprod-alt
needs: [build-and-test, build-and-push]
if: github.event.inputs.environment == 'preprod-alt'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
PRINT_PAYLOAD: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais-preprod-alt.yml
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}

deploy-prod:
name: Deploy to prod
needs: [build-and-test, build-and-push]
if: github.event.inputs.environment == 'prod'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
PRINT_PAYLOAD: true
CLUSTER: prod-gcp
RESOURCE: .nais/nais.yml
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}
preprod-alt:
if: inputs.environment == 'preprod-alt'
uses: ./.github/workflows/preprod-alt.yml
secrets: inherit

prod:
if: inputs.environment == 'prod'
uses: ./.github/workflows/main.yml
secrets: inherit
29 changes: 29 additions & 0 deletions .github/workflows/preprod-alt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build, push, and deploy (preprod)
on: workflow_call

jobs:
build-and-test:
name: Test frontend
uses: ./.github/workflows/test.yml

build-and-push:
name: Build and push Docker container for preprod
uses: ./.github/workflows/build-push.yml
with:
environment: preprod-alt
secrets: inherit

deploy-preprod:
name: Deploy to preprod-alt
needs: [build-and-test, build-and-push]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
DRY_RUN: false
PRINT_PAYLOAD: true
CLUSTER: dev-gcp
RESOURCE: .nais/nais-preprod-alt.yml
VAR: app_version=${{ github.sha }},image=${{ needs.build-and-push.outputs.image }}
1 change: 1 addition & 0 deletions .github/workflows/preprod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths-ignore:
- '**.md'
- '**/**.md'
workflow_call:

jobs:
build-and-test:
Expand Down

0 comments on commit 3354378

Please sign in to comment.