Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Lagt til workflow dispatch, slettet unødvendig deploy-branch.yml
Browse files Browse the repository at this point in the history
Co-authored-by: Vetle Hollund <[email protected]>
Co-authored-by: Richard Borge <[email protected]>
Co-authored-by: Robin Tordly<[email protected]>
  • Loading branch information
3 people committed Nov 15, 2023
1 parent c6ea741 commit c52a91b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 88 deletions.
51 changes: 33 additions & 18 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@ name: Bygg og deploy

on:
workflow_dispatch:

inputs:
cluster:
description: 'Cluster å deploye til'
required: true
default: 'dev-gcp'
type: choice
options:
- 'dev-gcp'
- 'prod-gcp'
push:
branches:
- main
paths-ignore:
- '**.md'
- '.github/workflows/**.yml'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE: europe-north1-docker.pkg.dev/${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}/aap/${{ github.event.repository.name }}
Expand All @@ -31,14 +40,6 @@ jobs:
distribution: temurin
cache: maven

# - name: Installerer cosign
# uses: sigstore/[email protected]
# with:
# cosign-release: 'v1.3.1'

# - name: Verifiserer distroless base-image
# run: cosign verify --key distroless.pub gcr.io/distroless/Java17

- name: Setter tag-navn
run: echo "TAG=$(date +%Y.%m.%d.%H%M%S)-$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV

Expand Down Expand Up @@ -67,22 +68,36 @@ jobs:
sbom: target/bom.json
image_ref: ${{ env.IMAGE }}@${{ env.DIGEST }}

deploy:
strategy:
matrix:
cluster: [ dev-gcp, prod-gcp ]
name: Deploy til ${{matrix.cluster}}
deploy_dev_gcp:
if: github.event.inputs.cluster == 'dev-gcp' || github.event_name == 'push'
needs: bygg
runs-on: ubuntu-latest
timeout-minutes: 30
environment: ${{matrix.cluster}}:aap
environment: dev-gcp:aap
env:
PRINT_PAYLOAD: true
APIKEY: ${{secrets.NAIS_DEPLOY_APIKEY}}
RESOURCE: .nais/naiserator.yaml,.nais/${{matrix.cluster}}-alerts.yaml
CLUSTER: ${{matrix.cluster}}
VARS: .nais/${{matrix.cluster}}.json
RESOURCE: .nais/naiserator.yaml,.nais/dev-gcp-alerts.yaml
CLUSTER: dev-gcp
VARS: .nais/dev-gcp.json
IMAGE: ${{needs.bygg.outputs.image}}
steps:
- uses: actions/[email protected]
- uses: nais/deploy/actions/deploy@master

deploy_prod_gcp:
if: github.event.inputs.cluster == 'prod-gcp' || github.event_name == 'push'
needs: bygg
runs-on: ubuntu-latest
timeout-minutes: 30
environment: prod-gcp:aap
env:
PRINT_PAYLOAD: true
APIKEY: ${{secrets.NAIS_DEPLOY_APIKEY}}
RESOURCE: .nais/naiserator.yaml,.nais/prod-gcp-alerts.yaml
CLUSTER: prod-gcp
VARS: .nais/prod-gcp.json
IMAGE: ${{needs.bygg.outputs.image}}
steps:
- uses: actions/[email protected]
- uses: nais/deploy/actions/deploy@master
70 changes: 0 additions & 70 deletions .github/workflows/deploy-branch.yml

This file was deleted.

0 comments on commit c52a91b

Please sign in to comment.