Skip to content

Commit

Permalink
Merge pull request #50 from navikt/gar
Browse files Browse the repository at this point in the history
Gar
  • Loading branch information
Kyrremann committed Oct 2, 2023
2 parents 88d4306 + ecd0e9c commit 27f4dd4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 38 deletions.
57 changes: 26 additions & 31 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
name: Build and deploy
name: Build, push, and deploy
on:
push:
branches:
- main

permissions:
packages: write

jobs:
build-push:
name: Build and push image
build:
name: Build and push Docker container
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
steps:
- uses: actions/checkout@v4
- run: echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY}:$(git log -1 --pretty=%ad --date=format:%Y-%m-%d)-$(git log --pretty=format:'%h' -n 1)" >> $GITHUB_ENV
- run: docker build -t $IMAGE .
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.IMAGE }}
context: .
- uses: actions/checkout@v4
- name: Push docker image to GAR
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: the-g-team
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} # Provided as Organization Secret
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} # Provided as Organization Variable

nais-yaml:
name: Release to nais-yaml
deploy:
name: Deploy to NAIS
needs: build
runs-on: ubuntu-latest
needs: build-push
steps:
- uses: actions/checkout@v4
- run: echo "TAG=$(git log -1 --pretty=%ad --date=format:%Y-%m-%d)-$(git log --pretty=format:'%h' -n 1)" >> $GITHUB_ENV
- name: deploy to prod
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: nais/nais.yaml,nais/alert.yaml
VAR: TAG=${{ env.TAG }}
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: nais/nais.yaml,nais/alert.yaml
VAR: image=${{ needs.build.outputs.image }}
4 changes: 2 additions & 2 deletions nais/alert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: g
namespace: aura
namespace: the-g-team
labels:
team: aura
team: the-g-team
spec:
groups:
- name: G
Expand Down
9 changes: 4 additions & 5 deletions nais/nais.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: "nais.io/v1alpha1"
kind: "Application"
metadata:
name: g
namespace: aura
namespace: the-g-team
labels:
team: aura
team: the-g-team
spec:
image: ghcr.io/navikt/g:{{ TAG }}
image: {{ image }}
port: 9292
ingresses:
- https://g.nav.no
Expand All @@ -17,8 +17,7 @@ spec:
value: production
resources:
limits:
cpu: 300m
memory: 400Mi
requests:
cpu: 50m
memory: 200Mi
memory: 150Mi

0 comments on commit 27f4dd4

Please sign in to comment.