-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Over på nais-actionen docker-build-push (#136)
* Forbetre dockerfile * Rein kopi av arbeidsflyt-standardane frå Gjennykoden * Treng ikkje så heftige nodar her * Opnar for at vi har forskjellige clustre her * Samkøyrer byggejobbane for kotlin-appane med dei vi har i Gjenny * Samkøyrer også slackbot og pdfgen. Fint å komme oss heilt over på nais-actionen * Ruddar opp
- Loading branch information
1 parent
36fc8b5
commit dff9b01
Showing
10 changed files
with
238 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: .build-frontend.yaml | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
image: | ||
description: "Docker image url" | ||
value: ${{ jobs.build-and-publish.outputs.image }} | ||
|
||
jobs: | ||
build-and-publish: | ||
name: Build & publish | ||
runs-on: ubuntu-latest-8-cores | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
outputs: | ||
image: ${{ steps.docker-build-push.outputs.image }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
|
||
- name: Build and publish docker image | ||
uses: nais/docker-build-push@v0 | ||
id: docker-build-push | ||
with: | ||
team: etterlatte | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
dockerfile: docker/Dockerfile | ||
docker_context: apps/${{ github.workflow }}/ | ||
image_suffix: ${{ github.workflow }} | ||
tag: ${{ env.GITHUB_REF_SLUG }} | ||
- name: Print docker tag | ||
run: echo 'Docker-tag er ${{ steps.docker-build-push.outputs.image }} ' >> $GITHUB_STEP_SUMMARY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: .build.yaml | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
image: | ||
description: "Docker image url" | ||
value: ${{ jobs.build-and-publish.outputs.image }} | ||
|
||
jobs: | ||
build-and-publish: | ||
name: Build & publish | ||
runs-on: ubuntu-latest-8-cores | ||
timeout-minutes: 10 | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
outputs: | ||
image: ${{ steps.docker-build-push.outputs.image }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Java v17.x | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17.x | ||
cache: gradle | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@v4 | ||
- name: Gradle test and build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: ./gradlew :apps:${{ github.workflow }}:build | ||
|
||
- name: Build and publish docker image | ||
uses: nais/docker-build-push@v0 | ||
id: docker-build-push | ||
with: | ||
team: etterlatte | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
dockerfile: docker/Dockerfile | ||
docker_context: apps/${{ github.workflow }}/ | ||
image_suffix: ${{ github.workflow }} | ||
tag: ${{ env.GITHUB_REF_SLUG }} | ||
- name: Print docker tag | ||
run: echo 'Docker-tag er ${{ steps.docker-build-push.outputs.image }} ' >> $GITHUB_STEP_SUMMARY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: .deploy.yaml | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image: | ||
description: 'Lenke til docker image' | ||
required: true | ||
type: string | ||
cluster: | ||
description: 'Cluster. gcp eller fss' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
deploy-to-dev-cluster: | ||
name: dev-cluster | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: nais/deploy/actions/deploy@v1 | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: dev-$${{ inputs.cluster }} | ||
RESOURCE: apps/${{ github.workflow }}/.nais/dev.yaml | ||
VAR: image=${{ inputs.image }} | ||
|
||
deploy-to-prod-cluster: | ||
name: prod-cluster | ||
if: ${{ github.ref == 'refs/heads/main' || github.event.inputs.deploy-prod == 'true' }} | ||
needs: deploy-to-dev-cluster | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: andstor/file-existence-action@v2 | ||
id: check_files | ||
with: | ||
files: "apps/${{ github.workflow }}/.nais/prod.yaml" | ||
- uses: nais/deploy/actions/deploy@v1 | ||
if: steps.check_files.outputs.files_exists == 'true' | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: prod-${{ inputs.cluster }} | ||
RESOURCE: apps/${{ github.workflow }}/.nais/prod.yaml | ||
VAR: image=${{ inputs.image }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: .build-backend.yaml | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
test: | ||
name: Verify pull request | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Java v17.x | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 17.x | ||
cache: gradle | ||
- name: Gradle test and build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: ./gradlew :apps:${{ github.workflow }}:test --stacktrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.