diff --git a/.dockerignore.builder b/.dockerignore.builder index 38cc663ff..0644eac51 100644 --- a/.dockerignore.builder +++ b/.dockerignore.builder @@ -12,3 +12,4 @@ !target/*-runner.jar !target/lib/* !target/quarkus-app/* +!target/quinoa diff --git a/.github/workflows/ci-code-analysis.yml b/.github/workflows/ci-code-analysis.yml index 0adc6f978..d6b8ac38a 100644 --- a/.github/workflows/ci-code-analysis.yml +++ b/.github/workflows/ci-code-analysis.yml @@ -35,7 +35,7 @@ jobs: - uses: skjolber/maven-cache-github-action@v1 with: step: restore - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' diff --git a/.github/workflows/pr-ci.yaml b/.github/workflows/pr-ci.yaml index a1635482b..9eaccef1b 100644 --- a/.github/workflows/pr-ci.yaml +++ b/.github/workflows/pr-ci.yaml @@ -35,11 +35,11 @@ jobs: && (!contains(github.event.issue.labels.*.name, 'safe-to-test') || github.event.issue.user.name != github.event.comment.user.name) run: exit 1 - name: React to comment - uses: actions/github-script@v4 + uses: actions/github-script@v7 with: script: | const {owner, repo} = context.issue - github.reactions.createForIssueComment({ + github.rest.reactions.createForIssueComment({ owner, repo, comment_id: context.payload.comment.id, @@ -57,11 +57,11 @@ jobs: permissions: pull-requests: read steps: - - uses: actions/github-script@v4 + - uses: actions/github-script@v7 id: comment-branch with: script: | - const result = await github.pulls.get ({ + const result = await github.rest.pulls.get ({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.issue.number @@ -75,7 +75,7 @@ jobs: pull-requests: write steps: - name: Leave Actions Run Comment - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`; @@ -92,38 +92,44 @@ jobs: needs: [checkout-branch] # runs-on: ubuntu-latest runs-on: ubuntu-24.04 - strategy: - matrix: - # java: [ '17', '21' ] - java: ['17'] env: - cache-name: cache-yarn - name: Build and test Java ${{ matrix.java }} + deps-cache-name: cache-yarn + build-cache-name: cache-webpack + name: Build and test permissions: packages: write contents: read pull-requests: write statuses: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ needs.checkout-branch.outputs.PR_repo }} ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} submodules: true fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: - java-version: ${{ matrix.java }} + java-version: '17' distribution: 'temurin' cache: 'maven' - run: git submodule init && git submodule update - name: Cache yarn packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: "./src/main/webui/.yarn/cache" - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-build-${{ env.deps-cache-name }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.deps-cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Cache frontend build + uses: actions/cache@v4 + with: + path: "./src/main/webui/.build_cache" + key: ${{ runner.os }}-build-${{ env.build-cache-name }}-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build-${{ env.build-cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - name: Initialize web assets @@ -144,18 +150,16 @@ jobs: run: echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV" - name: Build application run: ./mvnw -B -U clean verify - continue-on-error: ${{ matrix.java != '17' }} - name: Add workflow result as comment on PR - uses: actions/github-script@v6 + uses: actions/github-script@v7 if: always() with: script: | const name = '${{github.workflow}}'; const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; const success = '${{ job.status }}' === 'success'; - const javaVersion = '${{matrix.java}}'; - const body = `${name}: ${success ? 'All tests pass ✅' : 'At least one test failed ❌'} (JDK${javaVersion})\n${url}`; + const body = `${name}: ${success ? 'All tests pass ✅' : 'At least one test failed ❌'}\n${url}`; github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, @@ -180,32 +184,18 @@ jobs: GRAPHQL_STATUS: ${{ steps.schema-update.outputs.graphql_status }} GRAPHQL_DIFF_FILE: ${{ steps.schema-update.outputs.graphql_diff_file }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: ${{ needs.checkout-branch.outputs.PR_repo }} ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} submodules: true fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' cache: 'maven' - run: git submodule init && git submodule update - - name: Cache yarn packages - uses: actions/cache@v3 - with: - path: "./src/main/webui/.yarn/cache" - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - name: Initialize web assets - run: | - cd src/main/webui - yarn install && yarn yarn:frzinstall - cd - - name: Update schemas id: schema-update run: | @@ -222,11 +212,11 @@ jobs: git diff -U10 --exit-code /home/runner/work/cryostat/cryostat/schema/schema.graphql > /home/runner/work/graphql.diff echo "graphql_status=$?" >> "$GITHUB_OUTPUT" echo "graphql_diff_file=graphql.diff" >> "$GITHUB_OUTPUT" - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: openapi-diff path: /home/runner/work/openapi.diff - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: graphql-diff path: /home/runner/work/graphql.diff @@ -237,11 +227,11 @@ jobs: permissions: pull-requests: write steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: openapi-diff - name: Comment schema check result - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const diffFmt = s => { @@ -263,11 +253,11 @@ jobs: permissions: pull-requests: write steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: graphql-diff - name: Comment schema check result - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const diffFmt = s => { @@ -289,7 +279,7 @@ jobs: if: needs.update-schemas.outputs.OPENAPI_STATUS != '0' || needs.update-schemas.outputs.GRAPHQL_STATUS != '0' steps: - name: Check out PR branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ needs.checkout-branch.outputs.PR_repo }} ref: ${{ needs.checkout-branch.outputs.PR_head_ref }} @@ -303,12 +293,12 @@ jobs: git_user_signingkey: true git_commit_gpgsign: true - name: Download OpenAPI diff - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: openapi-diff path: diffs - name: Download GraphQL diff - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: graphql-diff path: diffs @@ -332,7 +322,7 @@ jobs: git commit -S -m "chore(schema): automatic update" git push origin ${{ needs.checkout-branch.outputs.PR_head_ref }} - name: Comment on schema update - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | const prNumber = ${{ needs.checkout-branch.outputs.PR_num }}; diff --git a/.github/workflows/push-ci.yaml b/.github/workflows/push-ci.yaml index f3890c2b1..dd869cb81 100644 --- a/.github/workflows/push-ci.yaml +++ b/.github/workflows/push-ci.yaml @@ -24,7 +24,7 @@ jobs: get-pom-properties: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true fetch-depth: 0 @@ -41,14 +41,11 @@ jobs: # runs-on: ubuntu-latest runs-on: ubuntu-24.04 needs: [get-pom-properties] - strategy: - matrix: - # java: [ '17', '21' ] - java: ['17'] env: IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }} - cache-name: cache-yarn - name: Build and test Java ${{ matrix.java }} + deps-cache-name: cache-yarn + build-cache-name: cache-webpack + name: Build and test permissions: packages: write contents: read @@ -58,23 +55,32 @@ jobs: run: | sudo apt-get update sudo apt-get install -y qemu-user-static - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true fetch-depth: 0 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: - java-version: ${{ matrix.java }} + java-version: '17' distribution: 'temurin' cache: 'maven' - run: git submodule init && git submodule update - name: Cache yarn packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: "./src/main/webui/.yarn/cache" - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-build-${{ env.deps-cache-name }}-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build-${{ env.deps-cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Cache frontend build + uses: actions/cache@v4 + with: + path: "./src/main/webui/.build_cache" + key: ${{ runner.os }}-build-${{ env.build-cache-name }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.build-cache-name }}- ${{ runner.os }}-build- ${{ runner.os }}- - name: Initialize web assets @@ -95,17 +101,16 @@ jobs: run: echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV" - name: Build application run: ./mvnw -B -U -Dquarkus.container-image.additional-tags= clean verify - continue-on-error: ${{ matrix.java != '17' }} - name: Delete local integration test image run: podman rmi ${{ env.CI_IMG }}:${{ env.IMAGE_VERSION }} continue-on-error: true - name: Build container images and manifest - if: ${{ matrix.java == '17' && github.repository_owner == 'cryostatio' }} id: buildah-build uses: redhat-actions/buildah-build@v2 with: image: ${{ env.CI_IMG }} oci: true + layers: true archs: amd64, arm64 tags: ${{ env.IMAGE_VERSION }} ${{ github.ref == 'refs/heads/main' && 'latest' || '' }} extra-args: | @@ -123,7 +128,5 @@ jobs: registry: ${{ env.CI_REGISTRY }} username: ${{ env.CI_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} - if: ${{ matrix.java == '17' && github.repository_owner == 'cryostatio' }} - name: Print image URL run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" - if: ${{ matrix.java == '17' && github.repository_owner == 'cryostatio' }} diff --git a/pom.xml b/pom.xml index 52791e91d..5553084fe 100644 --- a/pom.xml +++ b/pom.xml @@ -18,12 +18,6 @@ always - - jmc-libs - Adoptium JDK Mission Control Core Libraries - https://adoptium.jfrog.io/artifactory/jmc-libs - default - diff --git a/schema/update.bash b/schema/update.bash index 6ace30cca..967bafc73 100755 --- a/schema/update.bash +++ b/schema/update.bash @@ -3,7 +3,7 @@ DIR="$(dirname "$(readlink -f "$0")")" "${DIR}"/../mvnw -f "${DIR}/../pom.xml" -B -U clean compile test-compile -"${DIR}"/../mvnw -f "${DIR}/../pom.xml" -B -U -DskipTests -Dspotless.check.skip -Dquarkus.smallrye-openapi.info-title="Cryostat API" clean quarkus:dev & +"${DIR}"/../mvnw -f "${DIR}/../pom.xml" -B -U -Dmaven.test.skip -Dquarkus.quinoa=false -Dspotless.check.skip -Dquarkus.smallrye-openapi.info-title="Cryostat API" clean quarkus:dev & pid="$!" function cleanup() { kill $pid diff --git a/src/main/docker/Dockerfile.builder b/src/main/docker/Dockerfile.builder index 6e7bf5921..e5c4654f1 100644 --- a/src/main/docker/Dockerfile.builder +++ b/src/main/docker/Dockerfile.builder @@ -4,11 +4,13 @@ USER root WORKDIR /tmp/build COPY .mvn/ .mvn COPY pom.xml mvnw . +RUN --mount=type=cache,target=/root/.m2 ./mvnw -B -U dependency:go-offline COPY src/main/java src/main/java COPY src/main/resources src/main/resources COPY src/main/webui src/main/webui COPY src/main/docker/include src/main/docker/include -RUN ./mvnw -Dmaven.repo.local=/tmp/build/m2/repository -B -U -Dmaven.test.skip=true -Dlicense.skip=true -Dspotless.check.skip=true -Dquarkus.container-image.build=false -Dbuild.arch=$TARGETARCH package +COPY target target +RUN --mount=type=cache,target=/root/.m2 ./mvnw -B -Dmaven.test.skip=true -Dlicense.skip=true -Dspotless.check.skip=true -Dquarkus.container-image.build=false -Dbuild.arch=$TARGETARCH package FROM registry.access.redhat.com/ubi8/openjdk-17-runtime:1.20-3.1721231685