Skip to content

Commit

Permalink
Migrerer til GAR - andre forsøk (#1722)
Browse files Browse the repository at this point in the history
  • Loading branch information
olekvernberg authored Jul 30, 2024
1 parent 90d3bc6 commit 048df1f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 31 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/build_n_deploy_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ name: Build, push, and deploy app to dev
on:
workflow_dispatch:

env:
IMAGE: ghcr.io/navikt/familie-ef-soknad:${{ github.sha }}
permissions:
id-token: write
contents: read

jobs:
build:
name: Build and push Docker container
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -37,25 +36,24 @@ jobs:
run: |
npm ci
npm run build
- name: Build and publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.READER_TOKEN }}
run: |
docker build . -t ${IMAGE}
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin
docker push ${IMAGE}
- name: Push docker image to GAR and sign image
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: teamfamilie
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
deploy:
name: Deploy to NAIS
name: Deploy to dev
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: deploy to gcp-dev
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: nais-dev.yaml
IMAGE: ${{ needs.build.outputs.image }}
29 changes: 14 additions & 15 deletions .github/workflows/build_n_deploy_prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ on:
branches:
- 'main'

env:
IMAGE: ghcr.io/navikt/familie-ef-soknad:${{ github.sha }}
permissions:
id-token: write
contents: read

jobs:
build:
name: Build and push Docker container
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -39,39 +38,39 @@ jobs:
run: |
npm ci
npm run build
- name: Build and publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.READER_TOKEN }}
run: |
docker build . -t ${IMAGE}
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin
docker push ${IMAGE}
- name: Push docker image to GAR and sign image
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: teamfamilie
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
- name: Post build failures to Slack
if: failure()
run: |
curl -X POST --data "{m\"text\": \"Build av $GITHUB_REPOSITORY feilet - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}" $WEBHOOK_URL
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
deploy:
name: Deploy to NAIS
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Deploy til dev-gcp
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: dev-gcp
RESOURCE: nais-dev.yaml
IMAGE: ${{ needs.build.outputs.image }}
- name: Deploy til prod-gcp
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: nais-prod.yaml
IMAGE: ${{ needs.build.outputs.image }}
- name: Post deploy failures to Slack
if: failure()
run: |
Expand Down

0 comments on commit 048df1f

Please sign in to comment.