-
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.
Tweaks etter flytting av kafka-key-generator
- Loading branch information
1 parent
f610332
commit 0ed83a6
Showing
7 changed files
with
173 additions
and
119 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 |
---|---|---|
@@ -1,9 +1,20 @@ | ||
name: Build, push, and deploy | ||
name: PAW Kafka Key Generator | ||
|
||
on: [push] | ||
on: | ||
push: | ||
paths: | ||
- 'apps/kafka-key-generator/**' | ||
- 'lib/**' | ||
- 'domain/**' | ||
- '.github/workflows/kafka-key-generator.yaml' | ||
- 'gradle/**' | ||
- 'settings.gradle.kts' | ||
- 'gradle.properties' | ||
- 'gradlew' | ||
- 'gradlew.bat' | ||
|
||
env: | ||
IMAGE: europe-north1-docker.pkg.dev/${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}/paw/${{ github.event.repository.name }} | ||
IMAGE: europe-north1-docker.pkg.dev/${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}/paw/paw-kafka-key-generator | ||
jobs: | ||
build: | ||
name: Build and push Docker container | ||
|
@@ -14,60 +25,73 @@ jobs: | |
outputs: | ||
image: ${{ steps.docker-build-push.outputs.image }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 21 | ||
distribution: temurin | ||
cache: gradle | ||
- name: Set version | ||
- name: Specify module | ||
run: echo "MODULE=:apps:kafka-key-generator" >> $GITHUB_ENV | ||
- name: Specify version | ||
run: echo "VERSION=$(date +'%y.%m.%d').${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV | ||
- name: Login GAR | ||
uses: nais/login@v0 | ||
with: | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
team: paw | ||
- name: Build and push image with Gradle | ||
- name: Build and push image | ||
id: docker-build-push | ||
working-directory: ./ | ||
run: | | ||
echo "image=${{ env.IMAGE }}:${{ env.VERSION }}" >> $GITHUB_OUTPUT | ||
./gradlew -Pversion=${{ env.VERSION }} -Pimage=${{ env.IMAGE }} build jib | ||
echo -Pversion=${{ env.VERSION }} -Pimage=${{ env.IMAGE }} ${{ env.MODULE }}:build ${{ env.MODULE }}:test ${{ env.MODULE }}:jib | ||
./gradlew -Pversion=${{ env.VERSION }} -Pimage=${{ env.IMAGE }} ${{ env.MODULE }}:build ${{ env.MODULE }}:test ${{ env.MODULE }}:jib | ||
echo "DIGEST=$(cat app/build/jib-image.digest)" >> $GITHUB_ENV | ||
env: | ||
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Attest and sign | ||
- name: Attest and sign image | ||
uses: nais/[email protected] | ||
with: | ||
image_ref: ${{ env.IMAGE }}@${{ env.DIGEST }} | ||
|
||
deploy-dev: | ||
name: Deploy to NAIS dev | ||
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/dev') | ||
name: Deploy to dev-gcp | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: nais/deploy/actions/deploy@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Deploy to GCP | ||
uses: nais/deploy/actions/deploy@v2 | ||
env: | ||
CLUSTER: dev-gcp | ||
RESOURCE: nais/nais-dev.yaml | ||
VAR: image=${{ needs.build.outputs.image }} | ||
|
||
deploy-prod: | ||
if: github.ref == 'refs/heads/main' | ||
name: Deploy to NAIS prod | ||
name: Deploy to prod-gcp | ||
needs: | ||
- build | ||
- deploy-dev | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
id-token: write | ||
needs: [deploy-dev,build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: nais/deploy/actions/deploy@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Deploy to GCP | ||
uses: nais/deploy/actions/deploy@v2 | ||
env: | ||
CLUSTER: prod-gcp | ||
RESOURCE: nais/nais-prod.yaml | ||
|
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
10 changes: 6 additions & 4 deletions
10
.../kafka-key-generator/src/main/kotlin/no/nav/paw/kafkakeygenerator/ktor/helse_endepunkt.kt
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
6 changes: 3 additions & 3 deletions
6
apps/kafka-key-generator/src/main/kotlin/no/nav/paw/kafkakeygenerator/ktor/init_ktor.kt
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.