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

Lagt til byosbom for dependency graph i salsa og nais console #947

Merged
merged 6 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
29 changes: 11 additions & 18 deletions .github/workflows/deploy-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ name: Build-Deploy dev
on:
workflow_dispatch:

env:
IMAGE: ghcr.io/navikt/familie-ef-iverksett:${{ github.sha }}

permissions:
contents: "read"
id-token: "write"
packages: "write"

jobs:
build:
Expand All @@ -17,31 +13,27 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read/save maven cache
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-cache-ef-iverksett-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-cache-ef-iverksett-
${{ runner.os }}-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Bygg med Maven
env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml --file pom.xml
- name: Build and publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin
docker build --tag ${IMAGE} .
docker push ${IMAGE}
id: docker-push
uses: nais/docker-build-push@v0
with:
team: teamfamilie
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
byosbom: target/classes/META-INF/sbom/application.cdx.json
outputs:
image: ${{ steps.docker-push.outputs.image }}
deploy:
name: Deploy to GCP
needs: build
Expand All @@ -52,3 +44,4 @@ jobs:
env:
CLUSTER: dev-gcp
RESOURCE: .deploy/nais-preprod.yaml
IMAGE: ${{ needs.build.outputs.image }}
29 changes: 13 additions & 16 deletions .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,41 @@ env:
permissions:
contents: "read"
id-token: "write"
packages: "write"

jobs:
build:
name: Build, push and deploy to prod-gcp
name: Build, push and deploy to dev-gcp
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read/save maven cache
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-cache-ef-iverksett-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-cache-ef-iverksett-
${{ runner.os }}-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: Bygg med Maven
env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B --no-transfer-progress package --settings .m2/maven-settings.xml --file pom.xml
- name: Build and publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin
docker build --tag ${IMAGE} .
docker push ${IMAGE}
id: docker-push
uses: nais/docker-build-push@v0
with:
team: teamfamilie
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
byosbom: target/classes/META-INF/sbom/application.cdx.json
- name: Post deploy 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 @@ -60,11 +55,13 @@ jobs:
env:
CLUSTER: dev-gcp
RESOURCE: .deploy/nais-preprod.yaml
IMAGE: ${{ needs.build.outputs.image }}
- name: Deploy til prod-gcp
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: .deploy/nais-prod.yaml
IMAGE: ${{ needs.build.outputs.image }}
- name: Post deploy failures to Slack
if: failure()
run: |
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/removeOldImages.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,20 @@
<!-- additional 3rd party ruleset(s) can be specified here -->
</dependencies>
</plugin>
<plugin>
<!-- For å få dependency graph i SLSA som pushes av docker-build-push parameter byosbom -->
<groupId>org.cyclonedx</groupId>
<artifactId>cyclonedx-maven-plugin</artifactId>
<version>2.8.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>makeAggregateBom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>