diff --git a/.github/actions/common/action.yml b/.github/actions/common/action.yml index 0f406515b..1ee8abeb0 100644 --- a/.github/actions/common/action.yml +++ b/.github/actions/common/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Oracle and/or its affiliates. +# Copyright (c) 2023, 2024 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,15 +18,15 @@ name: 'Common Job Steps' description: A composite action that abstracts the common steps needed to implement a job inputs: native-image: - description: Wether to setup GraalVM native-image + description: Whether to setup GraalVM native-image required: false default: 'false' maven-cache: - description: Wether to cache the Maven local repository (read-only or read-write) + description: Whether to cache the Maven local repository (read-only or read-write) required: false default: 'read-only' build-cache: - description: Wether to cache the Maven build (read-only or read-write) + description: Whether to cache the Maven build (read-only or read-write) required: false default: '' build-cache-id: @@ -56,49 +56,23 @@ inputs: description: Path of the files to include in the artifact required: false default: '' - archive-test-results: - description: Wether to archive test results (excluded on windows) - required: false - default: 'false' - test-matrix: - description: | - A JSON matrix with a "group" dimension, and a "groups" object to resolve Maven modules - from glob expressions. - - The resolved modules are added in the include objects with a param "module". - A 'misc' group is always added to represent everything else by negating all the resolved modules (E.g. '!dir1,!dir2'). - - E.g. - { - "os": [ "ubuntu-20.04", "windows-2022" ], - "group": [ "group1", "group2", "misc" ], - "include": [ - { "os": "ubuntu-20.04", "platform": "linux" }, - { "os": "windows-2022", "platform": "windows" } - ] - "groups": { - "group1": [ "dir1/**", "dir2/**" ], - "group2": [ "dir3/**" ] - } - } + test-artifact-name: + description: Name of the test artifact to create (excluded on windows), if non empty tests are archived required: false default: '' -outputs: - test-matrix: - value: ${{ steps.test-matrix.outputs.matrix }} - description: | - E.g. - groups: [ group1, group2 ] - includes: - - group: group1 - modules: dir1,dir2,dir2a - - group: group2 - modules: dir3,dir3a - - group: misc - modules: !dir1,!dir2,!dir2a,!dir3,!dir3a + free-space: + description: Whether to aggressively free disk space on the runner + default: 'false' runs: using: "composite" steps: + - if: ${{ inputs.free-space == 'true' }} + # See https://github.com/actions/runner-images/issues/2840 + name: Free disk space + shell: bash + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/share/powershell - if: ${{ runner.os == 'Windows' }} name: Use GNU tar shell: cmd @@ -109,7 +83,7 @@ runs: git config --global core.eol lf - name: Set up GraalVM if: ${{ inputs.native-image == 'true' }} - uses: graalvm/setup-graalvm@v1.1.2.1 + uses: graalvm/setup-graalvm@v1.2.1 with: java-version: ${{ env.JAVA_VERSION }} version: ${{ env.GRAALVM_VERSION }} @@ -117,35 +91,38 @@ runs: check-for-updates: 'false' set-java-home: 'false' - name: Set up JDK - uses: actions/setup-java@v3.11.0 + uses: actions/setup-java@v4.1.0 with: distribution: ${{ env.JAVA_DISTRO }} java-version: ${{ env.JAVA_VERSION }} - name: Cache local Maven repository (read-write) if: ${{ inputs.maven-cache == 'read-write' }} - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.2 with: + # See https://github.com/actions/toolkit/issues/713 + # Include must not match top level directories path: | - .m2/repository/** - !.m2/repository/io/helidon/build-tools + .m2/repository/**/*.* + !.m2/repository/io/helidon/build-tools/** enableCrossOsArchive: true - key: local-maven-${{ hashFiles('**/pom.xml') }} + # only hash top-level poms to keep it fast + key: local-maven-${{ hashFiles('*/pom.xml', 'pom.xml') }} restore-keys: | local-maven- - name: Cache local Maven repository (read-only) if: ${{ inputs.maven-cache == 'read-only' }} - uses: actions/cache/restore@v3.3.1 + uses: actions/cache/restore@v4.0.2 with: path: | - .m2/repository/** - !.m2/repository/io/helidon/build-tools + .m2/repository/**/*.* + !.m2/repository/io/helidon/build-tools/** enableCrossOsArchive: true - key: local-maven-${{ hashFiles('**/pom.xml') }} + key: local-maven-${{ hashFiles('*/pom.xml', 'pom.xml') }} restore-keys: | local-maven- - name: Build cache (read-write) if: ${{ inputs.build-cache == 'read-write' }} - uses: actions/cache@v3.3.1 + uses: actions/cache@v4.0.2 with: path: | ./**/target/** @@ -157,7 +134,7 @@ runs: build-cache-${{ github.run_id }}- - name: Build cache (read-only) if: ${{ inputs.build-cache == 'read-only' }} - uses: actions/cache/restore@v3.3.1 + uses: actions/cache/restore@v4.0.2 with: path: | ./**/target/** @@ -168,13 +145,6 @@ runs: restore-keys: | build-cache-${{ github.run_id }}-${{ github.run_attempt }}- build-cache-${{ github.run_id }}- - - name: Populate Maven cache - if: ${{ inputs.maven-cache == 'read-write' }} - run: | - mvn ${MAVEN_ARGS} -T 8 \ - -Dmaven.repo.local=${{ github.workspace }}/.m2/repository \ - dependency:go-offline - shell: bash - name: Exec env: GPG_PASSPHRASE: ${{ inputs.GPG_PASSPHRASE }} @@ -183,26 +153,23 @@ runs: MAVEN_ARGS: | ${{ env.MAVEN_ARGS }} -Dmaven.repo.local=${{ github.workspace }}/.m2/repository + -Dcache.record=${{ inputs.build-cache == 'read-write' }} run: ${{ inputs.run }} shell: bash - - id: test-matrix - if: ${{ inputs.test-matrix != '' }} - run: ./.github/actions/common/matrix.sh '${{ inputs.test-matrix }}' >> "${GITHUB_OUTPUT}" - shell: bash - name: Archive test results # https://github.com/actions/upload-artifact/issues/240 - if: ${{ inputs.archive-test-results == 'true' && runner.os != 'Windows' && always() }} - uses: actions/upload-artifact@v3.1.2 + if: ${{ inputs.test-artifact-name != '' && runner.os != 'Windows' && always() }} + uses: actions/upload-artifact@v4 with: if-no-files-found: 'ignore' - name: test-results + name: ${{ inputs.test-artifact-name }} path: | **/target/surefire-reports/*.txt **/target/failsafe-reports/*.txt **/target/it/**/*.log - name: Archive artifacts if: ${{ inputs.artifact-name != '' && inputs.artifact-path != '' && always() }} - uses: actions/upload-artifact@v3.1.2 + uses: actions/upload-artifact@v4 with: if-no-files-found: 'ignore' name: ${{ inputs.artifact-name }} diff --git a/.github/actions/common/matrix.sh b/.github/actions/common/matrix.sh deleted file mode 100755 index 7d06efabe..000000000 --- a/.github/actions/common/matrix.sh +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2023 Oracle and/or its affiliates. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o pipefail || true # trace ERR through pipes -set -o errtrace || true # trace ERR through commands and functions -set -o errexit || true # exit the script if any statement returns a non-true return value - -on_error(){ - CODE="${?}" && \ - set +x && \ - printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \ - "${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}" -} -trap on_error ERR - -shopt -s globstar -shopt -s extglob - -ERROR_FILE=$(mktemp -t XXXmatrix) -readonly ERROR_FILE - -# -# Merge two JSON arrays. -# -# arg1: first array -# arg2: second array -# -json_merge_arrays() { - jq '.[]' <<< "$(printf "%s\n%s" "${1}" "${2}")" | jq -s -} - -# -# Merge two JSON objects. -# -# arg1: first object -# arg2: second object -# -json_merge_objects() { - jq -s '.[0] * .[1]' <<< "$(printf "%s\n%s" "${1}" "${2}")" -} - -# -# Get the value for a key in a JSON object. -# -# arg1: key -# arg2: JSON object -# -json_map_get() { - jq -r --arg a "${1}" 'to_entries[] | select (.key == $a).value[]' <<< "${2}" -} - -# -# Get the keys in a JSON object. -# -# arg1: JSON object -# -json_keys() { - jq -r 'keys | .[]' <<< "${1}" -} - -# -# Expand the given glob expressions to match directories with pom.xml files. -# Exclude directories that are nested under 'src' -# -# args: prefix expr... -# -list_modules() { - local prefix files - prefix="${1}" - shift - files=() - printf "## Resolving module expressions: %s\n" "${*}" >&2 - for exp in "${@}" ; do - printf "## Resolving module expression: %s\n" "${exp}" >&2 - for i in ${exp}/pom.xml ; do - if [ -f "${i}" ] && [[ ! "${i}" =~ "src/" ]] ; then - files+=("${prefix}${i%%/pom.xml}") - fi - done - done - if [ ${#files[*]} -eq 0 ] ; then - printf "## ERROR: Unresolved expressions: %s\n" "${*}" >&2 - echo "${@}" >> "${ERROR_FILE}" - return 1 - fi - IFS="," - printf "## Resolved expressions: %s, modules: %s\n" "${*}" "${files[*]}" >&2 - echo "${files[*]}" -} - -# -# Print a JSON object for a group -# -# args: group prefix expr... -# -resolve_group() { - local group - group="${1}" - shift - echo -ne ' - { - "group": "'"${group}"'", - "modules": "'"$(list_modules "${@}")"'" - }' -} - -# -# Print JSON objects for the groups. -# Always add a 'misc' at the end that matches everything else -# -# arg1: JSON object E.g. '{ "group1": [ "dir1/**", "dir2/**" ], "group2": [ "dir3/**" ] }' -# -resolve_groups() { - local groups modules all_modules - all_modules=() - groups="$(jq '.groups // []' <<< "${1}")" - for group in $(json_keys "${groups}") ; do - readarray -t modules <<< "$(json_map_get "${group}" "${groups}")" - printf "## Resolving group: %s, expressions: %s\n" "${group}" "${modules[*]}" >&2 - resolve_group "${group}" "" "${modules[@]}" - all_modules+=("${modules[@]}") - done - if [ ${#all_modules[@]} -gt 0 ] ; then - printf "## Resolving group: misc, expressions: %s\n" "${all_modules[2]}" >&2 - resolve_group "misc" "!" "${all_modules[@]}" - fi -} - -# -# Generate the 'matrix' output -# -# arg1: JSON object E.g. '{ "group1": [ "dir1/**", "dir2/**" ], "group2": [ "dir3/**" ] }' -# -main() { - local groups resolved_include extra_include merged_include resolved_matrix matrix errors - - printf "## Processing JSON: \n%s\n" "$(jq <<< "${1}")" >&2 - resolved_include="$(resolve_groups "${1}" | jq -s)" - - readarray -t errors < "${ERROR_FILE}" - if [ ${#errors[*]} -ne 0 ] ; then - printf "## ERROR: Unresolved expressions: %s\n" "${errors[*]}" >&2 - exit 1 - fi - - printf "## Resolved include JSON: \n%s\n" "$(jq <<< "${resolved_include}")" >&2 - - extra_include="$(jq '.include // []' <<< "${1}")" - extra_matrix="$(jq 'del(.groups, .group, .include)' <<< "${1}")" - printf "## Additional include JSON: \n%s\n" "${extra_include}" >&2 - printf "## Additional matrix JSON: \n%s\n" "${extra_matrix}" >&2 - - groups="$(jq '.group // []' <<< "${1}")" - if [ "${groups}" != "[]" ] ; then - merged_groups="$(json_merge_arrays "${groups}" '[ "misc" ]')" - else - merged_groups="[]" - fi - - merged_include="$(json_merge_arrays "${resolved_include}" "${extra_include}")" - resolved_matrix="$(jq <<< '{ - "group": '"${merged_groups}"', - "include": '"${merged_include}"' - }')" - matrix="$(json_merge_objects "${resolved_matrix}" "${extra_matrix}")" - printf "## Final matrix JSON: \n%s\n" "${matrix}" >&2 - - echo "matrix=$(jq -c <<< "${matrix}")" -} - -if [ ${#@} -lt 0 ] ; then - error "Usage $(basename "${0}") JSON" >&2 - exit 1 -fi - -main "${1}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f04b3fbdb..f99ca7466 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Oracle and/or its affiliates. +# Copyright (c) 2023, 2024 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,11 +40,11 @@ jobs: outputs: tag: ${{ steps.create-tag.outputs.tag }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.SERVICE_ACCOUNT_TOKEN }} - name: Set up JDK - uses: actions/setup-java@v3.11.0 + uses: actions/setup-java@v4.1.0 with: distribution: ${{ env.JAVA_DISTRO }} java-version: ${{ env.JAVA_VERSION }} @@ -61,7 +61,7 @@ jobs: timeout-minutes: 30 environment: release steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ needs.create-tag.outputs.tag }} - uses: ./.github/actions/common @@ -70,4 +70,6 @@ jobs: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} MAVEN_SETTINGS: ${{ secrets.MAVEN_SETTINGS }} build-cache: read-only + artifact-name: io-helidon-build-tools-artifacts-${{ github.ref_name }} + artifact-path: target/nexus-staging/ run: etc/scripts/release.sh release_build diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index e4732911a..18c92c48c 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2023 Oracle and/or its affiliates. +# Copyright (c) 2023, 2024 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,9 +35,10 @@ env: -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -Dmaven.wagon.http.retryHandler.count=3 -Djdk.toolchain.version=${JAVA_VERSION} + -Dcache.enabled=true concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: "${{ github.workflow }}-${{ github.ref }}" cancel-in-progress: true jobs: @@ -45,7 +46,7 @@ jobs: timeout-minutes: 5 runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} fetch-depth: 0 @@ -56,7 +57,7 @@ jobs: timeout-minutes: 5 runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - uses: ./.github/actions/common @@ -66,19 +67,18 @@ jobs: timeout-minutes: 5 runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - uses: ./.github/actions/common with: + maven-cache: none run: etc/scripts/shellcheck.sh build: timeout-minutes: 15 runs-on: ubuntu-20.04 - outputs: - test-matrix: ${{ steps.build.outputs.test-matrix }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - id: build @@ -86,47 +86,40 @@ jobs: with: build-cache: read-write maven-cache: read-write - artifact-name: helidon-cli + artifact-name: helidon-cli-dist artifact-path: cli/impl/target/helidon-cli.zip run: | - mvn ${MAVEN_ARGS} -T 8 \ + mvn --version + mvn ${MAVEN_ARGS} build-cache:go-offline + mvn ${MAVEN_ARGS} -T8 \ + -Dorg.slf4j.simpleLogger.showThreadName=true \ -DskipTests \ - -Pbuild-cache \ + -P tests \ install - test-matrix: | - { - "os": [ "ubuntu-20.04", "windows-2022" ], - "group": [ "cli", "cli-functional", "archetype", "linker" ], - "include": [ - { "os": "ubuntu-20.04", "platform": "linux" }, - { "os": "windows-2022", "platform": "windows" } - ], - "groups": { - "cli": [ "cli/**!(test)", "maven-plugins/*cli*" ], - "cli-functional": [ "cli/tests/**" ], - "archetype": [ "archetype/**", "maven-plugins/*archetype*" ], - "linker": [ "linker/**" ] - } - } tests: needs: build timeout-minutes: 15 strategy: - matrix: ${{ fromJSON(needs.build.outputs.test-matrix) }} + matrix: + os: [ ubuntu-20.04, windows-2022 ] + moduleSet: [ cli, cli-functional, archetype, linker, others ] + include: + - { os: ubuntu-20.04, platform: linux } + - { os: windows-2022, platform: windows } runs-on: ${{ matrix.os }} - name: tests/${{ matrix.group }}-${{ matrix.platform }} + name: tests/${{ matrix.moduleSet }}-${{ matrix.platform }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - uses: ./.github/actions/common with: build-cache: read-only - archive-test-results: true + test-artifact-name: tests-${{ matrix.moduleSet }} run: | mvn ${MAVEN_ARGS} \ - -pl ${{ matrix.modules }} \ - -Pbuild-cache \ + -DreactorRule=tests \ + -DmoduleSet=${{ matrix.moduleSet }} \ -Dsurefire.reportNameSuffix=${{ matrix.platform }} \ verify spotbugs: @@ -134,7 +127,7 @@ jobs: timeout-minutes: 15 runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - uses: ./.github/actions/common @@ -150,7 +143,7 @@ jobs: timeout-minutes: 15 runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - uses: ./.github/actions/common @@ -161,12 +154,12 @@ jobs: -DskipTests \ -Pjavadoc,build-cache \ package - vscode-extension: + vscode-ext: needs: build timeout-minutes: 15 runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - uses: ./.github/actions/common @@ -176,7 +169,7 @@ jobs: mvn ${MAVEN_ARGS} \ -pl ide-support/vscode-extension \ -DskipTests \ - -Pvscode \ + -P vscode \ install cli: needs: build @@ -185,25 +178,21 @@ jobs: matrix: os: [ ubuntu-20.04, windows-2022, macos-12 ] include: - - os: ubuntu-20.04 - platform: linux-amd64 - - os: windows-2022 - platform: windows-amd64 - file-ext: .exe - - os: macos-12 - platform: darwin-amd64 + - { os: ubuntu-20.04, platform: linux-amd64 } + - { os: windows-2022, platform: windows-amd64, file-ext: .exe } + - { os: macos-12, platform: darwin-amd64 } runs-on: ${{ matrix.os }} name: cli/${{ matrix.platform }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - uses: ./.github/actions/common with: build-cache: read-only native-image: true - archive-test-results: true - artifact-name: helidon-cli + test-artifact-name: helidon-cli-smoketest-${{ matrix.platform }} + artifact-name: helidon-cli-bin-${{ matrix.platform }} artifact-path: cli/impl/target/helidon-cli-${{ matrix.platform }}${{ matrix.file-ext }} run: | # build the executable @@ -221,4 +210,30 @@ jobs: -Dnative.image.name=helidon-cli-${{ matrix.platform }} \ -Dsurefire.reportNameSuffix=native-image-${{ matrix.platform }} \ -Dtest=CliFunctionalV2Test#*Native* \ + -P tests \ test + cli-binaries: + runs-on: ubuntu-20.04 + needs: [ build, cli ] + name: cli/binaries + steps: + - uses: actions/upload-artifact/merge@v4 + with: + name: helidon-cli + pattern: "helidon-cli-{bin-*,dist}" + test-results: + runs-on: ubuntu-20.04 + needs: [ tests, cli ] + name: tests/results + steps: + - uses: actions/upload-artifact/merge@v4 + with: + name: test-results + pattern: "*test*" + gate: + runs-on: ubuntu-20.04 + needs: [ copyright, checkstyle, shellcheck, spotbugs, javadoc, vscode-ext, cli-binaries, test-results ] + steps: + - shell: bash + run: | + echo OK diff --git a/.mvn/cache-config.xml b/.mvn/cache-config.xml new file mode 100644 index 000000000..16f399115 --- /dev/null +++ b/.mvn/cache-config.xml @@ -0,0 +1,69 @@ + + + + false + + + + .*/** + etc/** + **/vscode-extension/** + + + + + + + tests + + + + + cli/** + maven-plugins/*cli* + + + **/tests/** + + + + + cli/tests/** + + + + + archetype/** + maven-plugins/*archetype* + + + + + linker/** + + + + + **/* + + + + + + diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 000000000..42289a5a3 --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,27 @@ + + + + + io.helidon.build-tools + helidon-build-cache-maven-extension + 4.0.7 + + diff --git a/cli/codegen/pom.xml b/cli/codegen/pom.xml index 0444f45d1..ec1503db6 100644 --- a/cli/codegen/pom.xml +++ b/cli/codegen/pom.xml @@ -1,7 +1,7 @@ 4.0.0 - io.helidon.build-tools.cli helidon-cli-project 3.0.0-SNAPSHOT - io.helidon.build-tools.cli.tests helidon-cli-tests pom Helidon Command Line Interface Tests - - - run-test - - - !skipTests - - - - functional - - - - + + functional + diff --git a/common/common/pom.xml b/common/common/pom.xml index 2be09ff0f..2745480d4 100644 --- a/common/common/pom.xml +++ b/common/common/pom.xml @@ -1,7 +1,7 @@ + + + + + ^pkg:maven/org\.codehaus\.plexus/plexus\-(cipher|classworlds|component-annotations|interpolation|container-default|sec-dispatcher)@.*$ + CVE-2022-4244 + CVE-2022-4245 + + + + ^pkg:maven/org\.codehaus\.plexus/plexus\-java@.*$ + CVE-2022-4244 + + + + ^pkg:maven/org\.codehaus\.plexus/plexus\-java@.*$ + CVE-2022-4245 + + + + ^pkg:maven/org\.codehaus\.plexus/plexus\-velocity@.*$ + CVE-2022-4244 + + + + ^pkg:maven/org\.codehaus\.plexus/plexus\-velocity@.*$ + CVE-2022-4245 + + + diff --git a/etc/scripts/checkstyle.sh b/etc/scripts/checkstyle.sh index 913576456..96ede1599 100755 --- a/etc/scripts/checkstyle.sh +++ b/etc/scripts/checkstyle.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2018, 2023 Oracle and/or its affiliates. +# Copyright (c) 2018, 2024 Oracle and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -49,6 +49,9 @@ readonly RESULT_FILE die(){ echo "${1}" ; exit 1 ;} +# Remove cache +rm -f "${WS_DIR}"/target/checkstyle-* + # shellcheck disable=SC2086 mvn ${MAVEN_ARGS} checkstyle:checkstyle-aggregate \ -f "${WS_DIR}"/pom.xml \ diff --git a/etc/scripts/owasp-dependency-check.sh b/etc/scripts/owasp-dependency-check.sh new file mode 100755 index 000000000..34e00014f --- /dev/null +++ b/etc/scripts/owasp-dependency-check.sh @@ -0,0 +1,64 @@ +#!/bin/bash -e +# +# Copyright (c) 2020, 2024 Oracle and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -o pipefail || true # trace ERR through pipes +set -o errtrace || true # trace ERR through commands and functions +set -o errexit || true # exit the script if any statement returns a non-true return value + +# Path to this script +if [ -h "${0}" ] ; then + SCRIPT_PATH="$(readlink "${0}")" +else + # shellcheck disable=SC155 + SCRIPT_PATH="${0}" +fi +readonly SCRIPT_PATH + +# Path to the root of the workspace +# shellcheck disable=SC2046 +WS_DIR=$(cd $(dirname -- "${SCRIPT_PATH}") ; cd ../.. ; pwd -P) + +on_error(){ + CODE="${?}" && \ + set +x && \ + printf "[ERROR] Error(code=%s) occurred at %s:%s command: %s\n" \ + "${CODE}" "${BASH_SOURCE[0]}" "${LINENO}" "${BASH_COMMAND}" +} +trap on_error ERR + +RESULT_FILE=$(mktemp -t XXXdependency-check-result) +readonly RESULT_FILE + +die() { cat "${RESULT_FILE}" ; echo "Dependency report in ${WS_DIR}/target" ; echo "${1}" ; exit 1 ;} + +if [ "${PIPELINE}" = "true" ] ; then + # If in pipeline do a priming build before scan + # shellcheck disable=SC2086 + mvn ${MAVEN_ARGS} -f "${WS_DIR}"/pom.xml clean install -DskipTests +fi + +# Setting NVD_API_KEY is not required but improves behavior of NVD API throttling + +# shellcheck disable=SC2086 +mvn ${MAVEN_ARGS} -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN org.owasp:dependency-check-maven:aggregate \ + -f "${WS_DIR}"/pom.xml \ + -Dtop.parent.basedir="${WS_DIR}" \ + -Dnvd-api-key="${NVD_API_KEY}" \ + > "${RESULT_FILE}" || die "Error running the Maven command" + +grep -i "One or more dependencies were identified with known vulnerabilities" "${RESULT_FILE}" \ + && die "CVE SCAN ERROR" || echo "CVE SCAN OK" diff --git a/ide-support/lsp/helidon-lsp-maven-plugin/pom.xml b/ide-support/lsp/helidon-lsp-maven-plugin/pom.xml index e161eb300..a00a72116 100644 --- a/ide-support/lsp/helidon-lsp-maven-plugin/pom.xml +++ b/ide-support/lsp/helidon-lsp-maven-plugin/pom.xml @@ -1,7 +1,7 @@ - helidon-archetype - - - - io.helidon.build-tools - helidon-archetype-maven-plugin - true - - - + + helidon-archetype + + + + io.helidon.build-tools + helidon-archetype-maven-plugin + true + + + ``` @@ -51,7 +51,8 @@ Maven goal to test Helidon archetypes. |--------------------------|---------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| | invokerEnvVars | Map | `{}` | Invoker environment variables | | permutation | String | `null` | Indices (comma separated) of the permutations to process | -| permutationStartIndex | Integer | `1` | Permutation start index (resume-from) | +| permutationStartIndex | Integer | `1` | Permutation start index | +| permutationEndIndex | Integer | `-1` | Permutation end index | | permutationsOnly | boolean | `false` | Whether to only generate input permutations | | generatePermutations | boolean | `true` | Whether to auto-compute input permutations | | permutationFilters | List | `[]` | Permutation filters to filter the computed permutations. | @@ -61,6 +62,7 @@ Maven goal to test Helidon archetypes. | externalDefaults | boolean | `false` | External defaults to use when generating archetypes | | externalValues | boolean | `false` | External values to use when generating archetypes | | testGoal | String | `package` | The goal to use when building archetypes. | +| testProfiles | List | `[]` | The profiles to use when building archetypes. | | mavenArchetypeCompatible | boolean | `60` | Indicate if the project should be generated with the maven-archetype-plugin or with the Helidon archetype engine directly. | | debug | boolean | `false` | Whether to show debug statements in the build output | | showVersion | boolean | `false` | flag to show the maven version used. | @@ -69,4 +71,4 @@ Maven goal to test Helidon archetypes. | testProjectsDirectory | File | `${project.build.testOutputDirectory}/projects` | Directory of test projects | | skip | boolean | `false` | Skip the integration test | -The above parameters are mapped to user properties of the form `archetype.test.PROPERTY`, e.g. `-Darchetype.test.skip=true`. \ No newline at end of file +The above parameters are mapped to user properties of the form `archetype.test.PROPERTY`, e.g. `-Darchetype.test.skip=true`. diff --git a/maven-plugins/helidon-archetype-maven-plugin/pom.xml b/maven-plugins/helidon-archetype-maven-plugin/pom.xml index 0a7ac8a90..3acc4d8e5 100644 --- a/maven-plugins/helidon-archetype-maven-plugin/pom.xml +++ b/maven-plugins/helidon-archetype-maven-plugin/pom.xml @@ -1,7 +1,7 @@ - + diff --git a/maven-plugins/sitegen-maven-plugin/README.md b/maven-plugins/sitegen-maven-plugin/README.md index f678f7e25..63bb2c60e 100644 --- a/maven-plugins/sitegen-maven-plugin/README.md +++ b/maven-plugins/sitegen-maven-plugin/README.md @@ -47,37 +47,17 @@ Creates the site archive. The parameter `siteArchiveSkip` is mapped to a user property: `sitegen.siteArchiveSkip`. -## Goal: `preprocess-adoc` +## Goal: `serve` -Pre-includes included text specified by AsciiDoc `include::` directives into - an `.adoc` file, adding AsciiDoc comments to track where each snippet of - included content is in the updated file and where it came from. +Serve the site. ### Optional Parameters -| Property | Type | Default
Value | Description | -|-----------------|---------|----------------------|----------------------------------------------------------------| -| inputDirectory | File | `${project.basedir}` | Directory containing the files to be processed | -| outputDirectory | File | `${project.basedir}` | Directory where the reformatted `.adoc` file should be written | -| checkPreprocess | Boolean | `false` | Check that the input and output files are the same | -| includes | List | [] | List of files to include | -| exclude | List | [] | List of files to exclude | - -All parameters are mapped to user properties of the form `sitegen.PROPERTY`. - -## Goal: `naturalize-adoc` - -Converts a preprocessed `.adoc` file back into natural form with conventional - `include::` directives. - -### Optional Parameters - -| Property | Type | Default
Value | Description | -|-----------------|------|----------------------|----------------------------------------------------------------| -| inputDirectory | File | `${project.basedir}` | Directory containing the files to be processed | -| outputDirectory | File | `${project.basedir}` | Directory where the reformatted `.adoc` file should be written | -| includes | List | [] | List of files to include | -| exclude | List | [] | List of files to exclude | +| Property | Type | Default
Value | Description | +|---------------------|---------|-----------------------------------|----------------------------------------------------------| +| siteOutputDirectory | File | `${project.build.directory}/site` | Directory containing the generate site files to archive. | +| sitePort | int | 8080 | TCP port to use. | +| siteServeSkip | Boolean | `false` | Skip this goal execution | All parameters are mapped to user properties of the form `sitegen.PROPERTY`. diff --git a/maven-plugins/sitegen-maven-plugin/pom.xml b/maven-plugins/sitegen-maven-plugin/pom.xml index 63f93f416..d8d90b023 100644 --- a/maven-plugins/sitegen-maven-plugin/pom.xml +++ b/maven-plugins/sitegen-maven-plugin/pom.xml @@ -1,7 +1,7 @@ - + diff --git a/pom.xml b/pom.xml index 6a204b242..355093e31 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 3.10 - 3.2.0 - 2.5.2 - 7.2 - 9.1 + 3.3.0 + 2.5.11 + 9.5 + 10.12.6 2.2 1.11.1 2.3.23 - 2.4.16 2.8.9 + 32.0.1-jre 1.3 - 3.0.1 + 3.3.0 2.11.0 2.1.1.Final 1.18 @@ -140,21 +140,21 @@ 2.3.0.1 2.3.3 1.1.4 - 5.8.0-M1 + 5.9.3 1.8.0-M1 4.13.1 0.16.0 0.2.0 - 3.6.2 + 3.8.8 3.5 - 3.5.0 + 3.6.1 0.13.1 3.6.2 3.4.0 - 3.1.1 + 3.3.1 3.3.0 - 1.4.1 - 3.6.2 + 1.6.3 + 3.8.8 5.10.0 0.9.6 3.10.0 @@ -166,9 +166,9 @@ 1.7.14 3.8.2 1.7.25 - 1.32 + 2.0 3.1.12 - 3.3.4 + 3.5.3 1.10.0 + + org.testng:testng + + + HTML + + + + ${maven.multiModuleProjectDirectory}/etc/dependency-check-suppression.xml + + + + + io.helidon.build-tools + helidon-build-cache-maven-plugin + 4.0.7 + @@ -554,14 +564,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - - /etc/checkstyle.xml - /etc/checkstyle-suppressions.xml - - @@ -617,6 +619,21 @@ maven-artifact ${version.lib.maven} + + org.apache.maven + maven-settings + ${version.lib.maven} + + + org.apache.maven + maven-settings-builder + ${version.lib.maven} + + + org.apache.maven + maven-builder-support + ${version.lib.maven} + org.apache.maven.enforcer enforcer-api @@ -756,6 +773,12 @@ com.github.wumpz diffutils ${version.lib.diffutils} + + + org.eclipse.jgit + org.eclipse.jgit + + com.github.spullara.mustache.java @@ -858,6 +881,12 @@ gson ${version.lib.gson} + + + com.google.guava + guava + ${version.lib.guava} + org.apache.maven.shared maven-artifact-transfer @@ -867,6 +896,13 @@ org.apache.maven.archetype archetype-common ${version.lib.archetype-common} + + + + org.apache.ivy + ivy + + org.apache.maven.wagon @@ -888,6 +924,11 @@ maven-resolver-connector-basic ${version.lib.maven-resolver} + + org.apache.maven.resolver + maven-resolver-util + ${version.lib.maven-resolver} + org.apache.maven maven-embedder @@ -930,8 +971,10 @@ - check + spotbugs + verify + verify @@ -952,14 +995,6 @@ check validate - - - ${maven.multiModuleProjectDirectory}/etc/checkstyle.xml - - - ${maven.multiModuleProjectDirectory}/etc/checkstyle-suppressions.xml - - @@ -1091,26 +1126,6 @@ - - build-cache - - - - io.helidon.build-tools - helidon-build-cache-maven-plugin - 3.0.5 - true - - - .*/** - etc/** - **/vscode-extension/** - - - - - - toolchain