Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bygger o pusher image til GAR #1017

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions .github/workflows/build-master-deploy-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
Build:
runs-on: ubuntu-latest
permissions:
packages: write # docker
contents: write # dep submissions
id-token: write # nais docker-build-push
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
Expand All @@ -36,32 +36,28 @@ jobs:
env:
GITHUB_PASSWORD: ${{ secrets.READER_TOKEN }}

- name: Sett tag for docker
run: echo "TAG=$(date "+%Y.%m.%d")-$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- uses: docker/login-action@v3
- uses: nais/docker-build-push@v0
id: docker-push
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Bygg & last opp Docker image
run: |
docker build --pull --tag ${IMAGE_BASE}:${TAG} --tag ${IMAGE_BASE}:latest .
docker push ${IMAGE_BASE} --all-tags

- name: Sett image for nais deploy
run: echo "IMAGE=${IMAGE_BASE}:${TAG}" >> $GITHUB_ENV
team: k9saksbehandling
push_image: true
tag: latest
pull: true
dockerfile: Dockerfile
docker_context: .
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}

- name: Deploy til preprod
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-fss
RESOURCE: nais/dev-fss.yml
IMAGE: ${{ steps.docker-push.outputs.image }}

- name: Maven Dependency Tree Dependency Submission
uses: advanced-security/maven-dependency-submission-action@v3.0.2
uses: advanced-security/maven-dependency-submission-action@v3
with:
settings-file: ./.m2/settings.xml
ignore-maven-wrapper: true
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ jobs:
run: mvn clean package --settings ./.m2/settings.xml
env:
GITHUB_PASSWORD: ${{ secrets.READER_TOKEN }}

- name: Bygg Docker image
run: docker build --pull .

- name: Dependency Review
uses: actions/dependency-review-action@v3
with:
Expand Down
30 changes: 12 additions & 18 deletions .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ name: Deploy til prod

on: [workflow_dispatch]

env:
IMAGE_BASE: ghcr.io/${{ github.repository }}

jobs:
Build:
runs-on: ubuntu-latest
permissions:
id-token: write # nais docker-build-push
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
Expand All @@ -21,26 +20,21 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.READER_TOKEN }}

- name: Sett tags for docker
run: echo "TAG=$(date "+%Y.%m.%d")-$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- uses: docker/login-action@v3
- uses: nais/docker-build-push@v0
id: docker-push
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Bygg & last opp Docker image
run: |
docker build --pull --tag ${IMAGE_BASE}:${TAG} .
docker push ${IMAGE_BASE} --all-tags

- name: Sett image for nais deploy
run: echo "IMAGE=${IMAGE_BASE}:${TAG}" >> $GITHUB_ENV
team: k9saksbehandling
push_image: true
pull: true
dockerfile: Dockerfile
docker_context: .
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}

- name: Deploy til prod
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-fss
RESOURCE: nais/prod-fss.yml
IMAGE: ${{ steps.docker-push.outputs.image }}