Skip to content

Commit

Permalink
Merge pull request #260 from navikt/dev
Browse files Browse the repository at this point in the history
Synce main med dev
  • Loading branch information
slovrid authored Jan 22, 2024
2 parents 5d2d500 + 3981737 commit 9bdbde6
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/build-deploy-feature-branch-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,41 @@ jobs:
build-and-push:
name: Build and push
runs-on: ubuntu-latest
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Build maven artifacts
run: mvn -B package -D skipTests
- name: Login to Docker
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
uses: nais/docker-build-push@v0
id: docker-build-push
with:
context: .
push: true
tags: ${{ env.IMAGE }}:${{ env.IMAGE_TAG }}
team: pto
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}

deploy-dev:
name: Deploy application to dev
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Deploy application
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-fss
RESOURCE: .nais/application/application-config-dev.yaml
VAR: version=${{ env.IMAGE_TAG }}
VAR: image=${{ needs.build-and-push.outputs.image }}
35 changes: 22 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Build, push and deploy
on: push
env:
IMAGE_TAG: ${{ github.sha }}
IMAGE: ghcr.io/${{ github.repository }}/veilarbfilter
PRINT_PAYLOAD: true
permissions:
packages: write
Expand All @@ -15,43 +14,49 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'

- name: Run maven tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B verify

build-and-push:
name: Build and push
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main'
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'

- name: Build maven artifacts
run: mvn -B package -D skipTests
- name: Login to Docker
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
uses: nais/docker-build-push@v0
id: docker-build-push
with:
context: .
push: true
tags: ${{ env.IMAGE }}:${{ env.IMAGE_TAG }}
team: pto
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}

deploy-dev:
name: Deploy application to dev
if: github.ref == 'refs/heads/dev'
Expand All @@ -60,13 +65,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Deploy application
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-fss
RESOURCE: .nais/application/application-config-dev.yaml
VAR: version=${{ env.IMAGE_TAG }}
VAR: image=${{ needs.build-and-push.outputs.image }}

deploy-prod:
name: Deploy application to prod
if: github.ref == 'refs/heads/main'
Expand All @@ -75,13 +82,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Deploy application
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-fss
RESOURCE: .nais/application/application-config-prod.yaml
VAR: version=${{ env.IMAGE_TAG }}
VAR: image=${{ needs.build-and-push.outputs.image }}

release-prod:
name: Create prod release
needs: deploy-prod
Expand Down
2 changes: 1 addition & 1 deletion .nais/application/application-config-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
team: pto
spec:
image: ghcr.io/navikt/veilarbfilter/veilarbfilter:{{version}}
image: {{image}}
replicas:
min: 1
max: 1
Expand Down
2 changes: 1 addition & 1 deletion .nais/application/application-config-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
team: pto
spec:
image: ghcr.io/navikt/veilarbfilter/veilarbfilter:{{version}}
image: {{image}}
port: 8080
vault:
enabled: true
Expand Down

0 comments on commit 9bdbde6

Please sign in to comment.