Skip to content

Commit

Permalink
Migrerer til GAR (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
olekvernberg authored Jul 24, 2024
1 parent c9f7674 commit 5c5bb18
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 26 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Deploy DEV
on:
workflow_dispatch:
env:
IMAGE: ghcr.io/navikt/familie-ef-soknad-api:${{ github.sha }}

permissions:
contents: read
id-token: write

jobs:
build:
name: Build, push and deploy to dev-gcp
runs-on: ubuntu-latest
permissions:
packages: "write"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -31,21 +31,23 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml --file pom.xml
- name: Build and publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build --tag ${IMAGE} .
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin
docker push ${IMAGE}
id: docker-push
uses: nais/docker-build-push@v0
with:
team: teamfamilie
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
byosbom: target/classes/META-INF/sbom/application.cdx.json
outputs:
image: ${{ steps.docker-push.outputs.image }}
deploy:
name: Deploy to NAIS
name: Deploy to dev
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .deploy/nais-dev.yaml

IMAGE: ${{ needs.build.outputs.image }}
28 changes: 15 additions & 13 deletions .github/workflows/deploy-prod.yml
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-api:${{ github.sha }}
permissions:
contents: read
id-token: write

jobs:
build:
name: Build, push and deploy to prod-gcp
runs-on: ubuntu-latest
permissions:
packages: "write"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -35,36 +34,39 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml --file pom.xml
- name: Build and publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build --tag ${IMAGE} .
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin
docker push ${IMAGE}
id: docker-push
uses: nais/docker-build-push@v0
with:
team: teamfamilie
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
byosbom: target/classes/META-INF/sbom/application.cdx.json
- name: Post build failures to Slack
if: failure()
run: |
curl -X POST --data "{\"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-push.outputs.image }}
deploy:
name: Deploy to NAIS
name: Deploy to GCP
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy til dev-gcp
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .deploy/nais-dev.yaml
IMAGE: ${{ needs.build.outputs.image }}
- name: Deploy til prod-gcp
uses: nais/deploy/actions/deploy@v2
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: .deploy/nais-prod.yaml
IMAGE: ${{ needs.build.outputs.image }}
- name: Post deploy failures to Slack
if: failure()
run: |
Expand Down
14 changes: 14 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,20 @@
<!-- additional 3rd party ruleset(s) can be specified here -->
</dependencies>
</plugin>
<plugin>
<!-- For å få dependency graph i SLSA som pushes av docker-build-push parameter byosbom -->
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
<version>2.8.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>makeAggregateBom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 5c5bb18

Please sign in to comment.