Skip to content

DBMigration to new volume, final notes. #24

DBMigration to new volume, final notes.

DBMigration to new volume, final notes. #24

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Commit Stage - Java CI with Maven
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.actor }}/catalog-service
VERSION: latest
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
security-events: write
steps:
- name: Step 1 - checkout sources
uses: actions/checkout@v3
- name: Step 2 - Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Step 3 - Code vulnerability scanning
uses: anchore/scan-action@v3
id: scan
with:
path: "${{ github.workspace }}/catalog-service"
fail-build: false
severity-cutoff: high
acs-report-enable: true
- name: Step 4 - Upload vulnerability
uses: github/codeql-action/upload-sarif@v2
if: success() || failure()
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
- name: Step 5 - Build with Maven
run: |
ls -la
cd catalog-service
ls -la
mvn -B package --file pom.xml
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
# Under Settings > Security > Code security and analysis both Dependency graph & Dependabot have to enabled
# Under Settings > Actions > General > Workflow permissions "Read and write permissions" has to be selected.
# See https://seekdavidlee.medium.com/how-to-fix-post-repos-check-runs-403-error-on-github-action-workflow-f2c5a9bb67d
- name: Step 6 - Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
with:
directory: "${{ github.workspace }}/catalog-service"
package:
name: Package and Publish
if: ${{ github.ref == 'refs/heads/main' }}
needs: [ build ]
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
security-events: write
steps:
- name: Step 1 - Checkout source code
uses: actions/checkout@v3
- name: Step 2 - Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21
cache: maven
# With the -DimageName we override the default setting in the rg.springframework.boot:spring-boot-maven-plugin
# config of the pom.xml
- name: Step 3 - Build container image with maven
run: |
run: |
ls -la
cd catalog-service
ls -la
mvn -B spring-boot:build-image \
-Dmodule.image.name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} \
--file pom.xml
- name: Step 4 - OCI image vulnerability scanning
uses: anchore/scan-action@v3
id: scan
with:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
fail-build: false
severity-cutoff: high
- name: Step 5 - Upload vulnerability report
uses: github/codeql-action/upload-sarif@v2
if: success() || failure()
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
- name: Step 6 - Log into container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Step 7 - Publish container image
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}