-
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.
gradlew 8.2.1, dep. sbom, bump deps, dev+prodrelease workflows
- Loading branch information
Showing
11 changed files
with
212 additions
and
223 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
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,112 @@ | ||
name: deploy-dev | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- deps-0408 | ||
|
||
jobs: | ||
build: | ||
name: Build app, docker image and push docker image | ||
permissions: | ||
contents: write | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
cache: gradle | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
|
||
- uses: gradle/[email protected] | ||
env: # Eksluder test dependencies | ||
DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS: compileClasspath|runtimeClasspath | ||
TESTCONTAINERS_RYUK_DISABLED: true | ||
with: | ||
dependency-graph: generate-and-submit | ||
arguments: build | ||
|
||
- name: Pre-deploy | ||
uses: navikt/digihot-deploy/actions/pre-deploy@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push docker image | ||
uses: nais/docker-build-push@v0 | ||
id: docker-build-push | ||
with: | ||
byosbom: dependency-graph-reports/deploy-dev-build.json | ||
team: teamdigihot | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
tag: ${{ env.VERSION_TAG }} | ||
|
||
- name: Deploy to dev-gcp | ||
uses: nais/deploy/actions/deploy@v1 | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: dev-gcp | ||
RESOURCE: nais/nais-dev.yaml,nais/alerts.yaml | ||
IMAGE: ${{steps.docker-build-push.outputs.image}} | ||
|
||
- name: post-deploy | ||
if: github.ref == 'refs/heads/main' | ||
uses: navikt/digihot-deploy/actions/post-deploy@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: draft release | ||
if: github.ref == 'refs/heads/main' | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.VERSION_TAG }} | ||
release_name: ${{ env.APPLICATION }} ${{ env.VERSION_TAG }} | ||
body: ${{ env.CHANGE_LOG }} | ||
draft: true | ||
prerelease: false | ||
|
||
outputs: | ||
image: ${{ steps.docker-build-push.outputs.image }} | ||
|
||
trivy-imagescan: | ||
name: Scan dockerimage with Trivy | ||
needs: build | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
security-events: write | ||
actions: read | ||
id-token: write | ||
steps: | ||
- uses: nais/login@v0 | ||
with: | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
team: teamdigihot | ||
|
||
- name: Run Trivy vulnerability scanner on docker image | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: ${{ needs.build.outputs.image }} | ||
ignore-unfixed: true | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
severity: 'CRITICAL,HIGH' | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: 'trivy-results.sarif' |
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,43 @@ | ||
name: deploy-prod | ||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
deploy-prod: | ||
permissions: | ||
contents: "write" | ||
id-token: "write" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: nais/login@v0 | ||
name: get image registry | ||
id: nais-login | ||
with: | ||
team: teamdigihot | ||
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }} | ||
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }} | ||
|
||
- name: get image | ||
env: | ||
VERSION_TAG: ${{ github.event.release.tag_name }} | ||
REGISTRY: ${{ steps.nais-login.outputs.registry }} | ||
APP: ${{ github.event.repository.name }} | ||
run: | | ||
IMAGE=$REGISTRY/$APP:$VERSION_TAG | ||
echo "IMAGE=${IMAGE}" >> $GITHUB_ENV | ||
echo $IMAGE | ||
- uses: nais/deploy/actions/deploy@v1 | ||
name: deploy to prod-gcp | ||
env: | ||
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }} | ||
CLUSTER: prod-gcp | ||
RESOURCE: nais/nais-prod.yaml,nais/alerts-prod.yaml | ||
|
||
- name: post-production | ||
uses: navikt/digihot-deploy/actions/post-production@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.