Skip to content

Commit

Permalink
Bytter fra ghcr til gar
Browse files Browse the repository at this point in the history
  • Loading branch information
stigebil committed Nov 7, 2023
1 parent a313fd4 commit adc4e94
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/build-and-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jobs:
name: Bygg app/image, push til github
runs-on: ubuntu-latest
permissions:
packages: write
contents: "read"
id-token: "write"
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -27,17 +28,18 @@ jobs:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B --no-transfer-progress package verify -Dmaven.test.skip=true --settings .m2/maven-settings.xml -DtrimStackTrace=false --file pom.xml -Dchangelist= -Dsha1=-$TIMESTAMP-$(echo $GITHUB_SHA | cut -c1-7)
- name: Bygg Docker image
run: |
docker build -t $IMAGE .
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
- uses: nais/docker-build-push@v0
id: docker-push
if: github.triggering_actor != 'dependabot[bot]'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
run: docker push $IMAGE
team: teamfamilie
push_image: true
dockerfile: Dockerfile
docker_context: .
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
outputs:
image: ${{ steps.docker-push.outputs.image }}

run-junit:
if: github.event.pull_request.draft == false
Expand Down Expand Up @@ -95,7 +97,7 @@ jobs:
path: tilbake-e2e
- name: Setter riktig familie-tilbake versjon i e2e tester
if: "!contains(github.event.head_commit.message, 'e2e skip')"
run: sed -i 's/familie-tilbake:latest/familie-tilbake:'$GITHUB_SHA'/g' tilbake-e2e/e2e/docker-compose.yml
run: sed -i 's/ghcr.io\/navikt\/familie-tilbake:latest/'${{ needs.build-jar-docker.outputs.image }}'/g' tilbake-e2e/e2e/docker-compose.yml
- name: Set up Java 17
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -157,6 +159,7 @@ jobs:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .deploy/nais/app-dev-gcp.yaml
IMAGE: ${{ needs.build-jar-docker.outputs.image }}
- name: Deploy dvh_sak_topic
uses: nais/deploy/actions/deploy@v1
env:
Expand Down
29 changes: 16 additions & 13 deletions .github/workflows/build-and-deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
name: Bygg app/image, push til github, deploy til prod-gcp og dev-gcp
runs-on: ubuntu-latest
permissions:
packages: write
contents: "read"
id-token: "write"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -28,25 +29,25 @@ jobs:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml -DtrimStackTrace=false --file pom.xml -Dchangelist= -Dsha1=-$TIMESTAMP-$(echo $GITHUB_SHA | cut -c1-7)
- name: Bygg Docker image
run: |
docker build -t ${IMAGE} -t ${IMAGE_LATEST} .
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
- uses: nais/docker-build-push@v0
id: docker-push
if: github.triggering_actor != 'dependabot[bot]'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image med versjonstag
run: docker push ${IMAGE}
- name: Push Docker image med 'latest' tag
run: docker push ${IMAGE_LATEST}
team: teamfamilie
tag: latest
push_image: true
dockerfile: Dockerfile
docker_context: .
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
- 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 GCP
needs: build
Expand All @@ -59,12 +60,14 @@ jobs:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .deploy/nais/app-dev-gcp.yaml
IMAGE: ${{ needs.build.outputs.image }}
- name: Deploy til prod-gcp
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: .deploy/nais/app-prod-gcp.yaml
IMAGE: ${{ needs.build.outputs.image }}
- name: Deploy dvh_sak_topic
uses: nais/deploy/actions/deploy@v1
env:
Expand Down

0 comments on commit adc4e94

Please sign in to comment.