From 4967f2c989089f323aa1a1d3fadc505608abaa52 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Fri, 4 Aug 2023 13:47:49 +0100 Subject: [PATCH 001/132] Extend GHA to push images that pass tests For push actions only (e.g., post-PR merge), after successfully completing the behave-test step, Log into GitHub container registry (ghcr.io) and push the image. Add the necessary permissions to write to the GHCR repository. Adjust the build and test steps to use a predictable, version-independent image name ("localimage") which we can reference in the new steps. Signed-off-by: Jonathan Dowland --- .github/workflows/image-workflow-template.yml | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/image-workflow-template.yml b/.github/workflows/image-workflow-template.yml index 61414f5f..5f8b2325 100644 --- a/.github/workflows/image-workflow-template.yml +++ b/.github/workflows/image-workflow-template.yml @@ -7,8 +7,11 @@ on: type: string env: LANG: en_US.UTF-8 + IMAGE_URI: ghcr.io/jboss-container-images/${{ inputs.image }}:${{ github.ref_name }} jobs: openjdkci: + permissions: + packages: write name: OpenJDK S2I Build and Test runs-on: ubuntu-20.04 strategy: @@ -23,7 +26,7 @@ jobs: - name: Build run: | - cekit -v --descriptor ${{ inputs.image }}.yaml build docker --no-squash + cekit -v --descriptor ${{ inputs.image }}.yaml build docker --no-squash --tag localimage - name: Install and cache S2I CLI tool from GitHub uses: redhat-actions/openshift-tools-installer@v1 @@ -35,4 +38,18 @@ jobs: - name: Behave Tests run: | echo /home/runner/work/_temp/openshift-bin >> $GITHUB_PATH - cekit -v --descriptor ${{ inputs.image }}.yaml test behave + cekit -v --descriptor ${{ inputs.image }}.yaml test --image localimage behave + + - if: github.event_name == 'push' + name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - if: github.event_name == 'push' + name: Tag and push container image + run: | + docker tag localimage ${{ env.IMAGE_URI }} + docker push ${{ env.IMAGE_URI }} From 0489ff7007d7c14276f047ce25228b409bb21fb3 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Mon, 7 Aug 2023 10:50:57 +0100 Subject: [PATCH 002/132] label images with opencontainers 'source' label This allows GitHub to provide links back from the Container Images to the source repository that built them. See Signed-off-by: Jonathan Dowland --- ubi9-openjdk-11-runtime.yaml | 2 ++ ubi9-openjdk-11.yaml | 2 ++ ubi9-openjdk-17-runtime.yaml | 2 ++ ubi9-openjdk-17.yaml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/ubi9-openjdk-11-runtime.yaml b/ubi9-openjdk-11-runtime.yaml index bdc9a558..eecac910 100644 --- a/ubi9-openjdk-11-runtime.yaml +++ b/ubi9-openjdk-11-runtime.yaml @@ -20,6 +20,8 @@ labels: value: "openjdk-11-runtime-ubi9-container" - name: "com.redhat.license_terms" value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" +- name: "org.opencontainers.image.source" + value: "https://github.com/jboss-container-images/openjdk" envs: - name: "JBOSS_IMAGE_NAME" diff --git a/ubi9-openjdk-11.yaml b/ubi9-openjdk-11.yaml index 0d71dc70..d0cbca94 100644 --- a/ubi9-openjdk-11.yaml +++ b/ubi9-openjdk-11.yaml @@ -22,6 +22,8 @@ labels: value: "https://access.redhat.com/documentation/en-us/openjdk/11/html/using_openjdk_11_source-to-image_for_openshift/index" - name: "com.redhat.license_terms" value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" +- name: "org.opencontainers.image.source" + value: "https://github.com/jboss-container-images/openjdk" envs: - name: PATH diff --git a/ubi9-openjdk-17-runtime.yaml b/ubi9-openjdk-17-runtime.yaml index 7fd95d3d..a703efdb 100644 --- a/ubi9-openjdk-17-runtime.yaml +++ b/ubi9-openjdk-17-runtime.yaml @@ -22,6 +22,8 @@ labels: value: "https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/" - name: "com.redhat.license_terms" value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" +- name: "org.opencontainers.image.source" + value: "https://github.com/jboss-container-images/openjdk" envs: - name: "JBOSS_IMAGE_NAME" diff --git a/ubi9-openjdk-17.yaml b/ubi9-openjdk-17.yaml index 4c1bf564..62be9bfd 100644 --- a/ubi9-openjdk-17.yaml +++ b/ubi9-openjdk-17.yaml @@ -22,6 +22,8 @@ labels: value: "https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/" - name: "com.redhat.license_terms" value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" +- name: "org.opencontainers.image.source" + value: "https://github.com/jboss-container-images/openjdk" envs: - name: PATH From 072aea8526c455c71bf7ffc9cf4c785f3c54b6c6 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Tue, 12 Sep 2023 00:02:01 +0530 Subject: [PATCH 003/132] Add dockerfile to do a multi-stage build for jlink JRE light weight container application --- templates/jlink/Dockerfile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 templates/jlink/Dockerfile diff --git a/templates/jlink/Dockerfile b/templates/jlink/Dockerfile new file mode 100644 index 00000000..cb678e56 --- /dev/null +++ b/templates/jlink/Dockerfile @@ -0,0 +1,36 @@ +#multi-stage build for jlinked application JAR and JRE + +#Stage-1:build application JAR and libraries +#steps to build the application JAR and jlinked JRE +#for time being using the image built by Jon +FROM quay.io/jdowland/jlink:quarkus-getting-started AS ubi9-jlinked-image +USER 0 +RUN mkdir -p /mnt/jrootfs +RUN microdnf install dnf -y +RUN dnf install --installroot /mnt/jrootfs grep gawk --releasever 9 --setopt install_weak_deps=false --nodocs -y;dnf clean all +RUN rm -rf /mnt/jrootfs/var/cache/* +RUN rm -rf /mnt/jrootfs/var/lib/rpm +USER 185 + +#Stage-2:copy application JAR and jlinked JRE to runtime image +FROM registry.access.redhat.com/ubi9/ubi-micro AS lean-runtime + +COPY --from=ubi9-jlinked-image /mnt/jrootfs/ / +COPY --from=ubi9-jlinked-image /deployments /deployments +COPY --from=ubi9-jlinked-image /tmp/jre /usr/lib/jvm/java +COPY --from=ubi9-jlinked-image /opt/jboss/container/java/run/run-java.sh /opt/jboss/container/java/run/run-java.sh +COPY --from=ubi9-jlinked-image /opt/jboss/container/util/logging/logging.sh /opt/jboss/container/util/logging/logging.sh +COPY --from=ubi9-jlinked-image /opt/jboss/container/java/run/run-env.sh /opt/jboss/container/java/run/run-env.sh +RUN ls -LR /opt/jboss/container/ + +ENV JAVA_HOME="/usr/lib/jvm/java" +RUN echo $JAVA_HOME + +ENV PATH="$JAVA_HOME/bin/:$PATH" +RUN echo $PATH + +ENV JBOSS_CONTAINER_UTIL_LOGGING_MODULE=/opt/jboss/container/util/logging +ENV JBOSS_CONTAINER_JAVA_RUN_MODULE=/opt/jboss/container/java/run + +CMD /opt/jboss/container/java/run/run-java.sh + From c7c1e23a3224ac9f1732de84ed0d9ed8769af812 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 14 Sep 2023 06:31:08 +0530 Subject: [PATCH 004/132] Tweak run-java.sh script for some env varibales and fold run-env.sh into run-java.sh - This tweak is to avoid defining JBOSS_CONTAINER_UTIL_LOGGING_MODULE as ENV in templates/jlink/Dokcerfile - Deleted run-env.sh and folded its content to run-java.sh as its not doing anything much other than setting value of JAVA_APP_DIR Signed-off-by: Jayashree Huttanagoudar --- .../opt/jboss/container/java/run/run-env.sh | 6 ------ .../opt/jboss/container/java/run/run-java.sh | 14 ++++++++------ 2 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 modules/run/artifacts/opt/jboss/container/java/run/run-env.sh diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-env.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-env.sh deleted file mode 100644 index 42cb7307..00000000 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-env.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Default the application dir to the S2I deployment dir -if [ -z "$JAVA_APP_DIR" ] -then JAVA_APP_DIR=/deployments -fi diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh index a2160d24..33998a3e 100644 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh +++ b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh @@ -3,6 +3,13 @@ # Fail on a single failed command set -eo pipefail +#These are defined explicitly here to avoid defining them in templates/jlink/Dockerfile +export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="/opt/jboss/container/util/logging" +export JBOSS_CONTAINER_JAVA_RUN_MODULE="/opt/jboss/container/java/run" + +#This is moved here after deleting run-env.sh +export JAVA_APP_DIR=/deployments + source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh" # ========================================================== @@ -96,13 +103,8 @@ load_env() { if [ -z "${JAVA_APP_DIR}" ]; then # XXX: is this correct? This is defaulted above to /deployments. Should we # define a default to the old /opt/java-run? - JAVA_APP_DIR="${JBOSS_CONTAINER_JAVA_RUN_MODULE}" - else - if [ -f "${JAVA_APP_DIR}/${run_env_sh}" ]; then - source "${JAVA_APP_DIR}/${run_env_sh}" - fi + export JAVA_APP_DIR="${JBOSS_CONTAINER_JAVA_RUN_MODULE}" fi - export JAVA_APP_DIR # JAVA_LIB_DIR defaults to JAVA_APP_DIR export JAVA_LIB_DIR="${JAVA_LIB_DIR:-${JAVA_APP_DIR}}" From 988aa56a9801a4e60e746ceed4c3e8f40a729449 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 14 Sep 2023 20:43:34 +0530 Subject: [PATCH 005/132] Address review comments Signed-off-by: Jayashree Huttanagoudar --- .../opt/jboss/container/java/run/run-java.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh index 33998a3e..03833c04 100644 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh +++ b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh @@ -8,7 +8,10 @@ export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="/opt/jboss/container/util/logging" export JBOSS_CONTAINER_JAVA_RUN_MODULE="/opt/jboss/container/java/run" #This is moved here after deleting run-env.sh -export JAVA_APP_DIR=/deployments +# Default the application dir to the S2I deployment dir +if [ -z "$JAVA_APP_DIR" ] +then JAVA_APP_DIR=/deployments +fi source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh" @@ -100,12 +103,12 @@ load_env() { # Check also $JAVA_APP_DIR. Overrides other defaults # It's valid to set the app dir in the default script - if [ -z "${JAVA_APP_DIR}" ]; then - # XXX: is this correct? This is defaulted above to /deployments. Should we - # define a default to the old /opt/java-run? - export JAVA_APP_DIR="${JBOSS_CONTAINER_JAVA_RUN_MODULE}" + if [ -f "${JAVA_APP_DIR}/${run_env_sh}" ]; then + source "${JAVA_APP_DIR}/${run_env_sh}" fi + export JAVA_APP_DIR + # JAVA_LIB_DIR defaults to JAVA_APP_DIR export JAVA_LIB_DIR="${JAVA_LIB_DIR:-${JAVA_APP_DIR}}" if [ -z "${JAVA_MAIN_CLASS}" ] && [ -z "${JAVA_APP_JAR}" ]; then From 5bd8fee07b34f34ca1ef6f9436edc0bb4b5a484f Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 14 Sep 2023 20:57:53 +0530 Subject: [PATCH 006/132] Use substring expansion to set the value for JBOSS_CONTAINER_UTIL_LOGGING_MODULE and JBOSS_CONTAINER_JAVA_RUN_MODULE Signed-off-by: Jayashree Huttanagoudar --- .../run/artifacts/opt/jboss/container/java/run/run-java.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh index 03833c04..472697fd 100644 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh +++ b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh @@ -4,8 +4,8 @@ set -eo pipefail #These are defined explicitly here to avoid defining them in templates/jlink/Dockerfile -export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="/opt/jboss/container/util/logging" -export JBOSS_CONTAINER_JAVA_RUN_MODULE="/opt/jboss/container/java/run" +export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="${JBOSS_CONTAINER_UTIL_LOGGING_MODULE-/opt/jboss/container/util/logging}" +export JBOSS_CONTAINER_JAVA_RUN_MODULE="${JBOSS_CONTAINER_JAVA_RUN_MODULE-/opt/jboss/container/java/run}" #This is moved here after deleting run-env.sh # Default the application dir to the S2I deployment dir From 54a86a37a1b7520ea3d969f6cef8697f5c617e10 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Fri, 15 Sep 2023 09:30:25 +0100 Subject: [PATCH 007/132] Change GHA runners to ubuntu-latest This is a hail-mary change: we are experiencing problems with GHA runs timing out (behave tests taking up to five hours to run). We were running on a not-current GHA runner version, and I think the old runners get fewer resources than the newer ones. Signed-off-by: Jonathan Dowland --- .github/workflows/gendocs.yml | 2 +- .github/workflows/image-workflow-template.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gendocs.yml b/.github/workflows/gendocs.yml index 1a895be6..0047d0bb 100644 --- a/.github/workflows/gendocs.yml +++ b/.github/workflows/gendocs.yml @@ -20,7 +20,7 @@ concurrency: jobs: gendocs: name: Generate documentation - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false steps: diff --git a/.github/workflows/image-workflow-template.yml b/.github/workflows/image-workflow-template.yml index 5f8b2325..3edfd605 100644 --- a/.github/workflows/image-workflow-template.yml +++ b/.github/workflows/image-workflow-template.yml @@ -13,7 +13,7 @@ jobs: permissions: packages: write name: OpenJDK S2I Build and Test - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: false steps: From d6765e351d3f53cb7a335177e0461ab73452e406 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Wed, 20 Sep 2023 13:06:50 +0530 Subject: [PATCH 008/132] Address review comments for indentation and removing unwanted comment lines --- .../run/artifacts/opt/jboss/container/java/run/run-java.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh index 472697fd..e64055b5 100644 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh +++ b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh @@ -3,14 +3,12 @@ # Fail on a single failed command set -eo pipefail -#These are defined explicitly here to avoid defining them in templates/jlink/Dockerfile export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="${JBOSS_CONTAINER_UTIL_LOGGING_MODULE-/opt/jboss/container/util/logging}" export JBOSS_CONTAINER_JAVA_RUN_MODULE="${JBOSS_CONTAINER_JAVA_RUN_MODULE-/opt/jboss/container/java/run}" -#This is moved here after deleting run-env.sh # Default the application dir to the S2I deployment dir if [ -z "$JAVA_APP_DIR" ] -then JAVA_APP_DIR=/deployments + then JAVA_APP_DIR=/deployments fi source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh" From df3c53568f53b4f7f8a95530a3a3700dd0bbca45 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Fri, 22 Sep 2023 00:03:21 +0530 Subject: [PATCH 009/132] Modify Dockerfile to consolidate destination path for image scripts and also remove ENV setting as they are taken care in run-java.sh Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/Dockerfile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/templates/jlink/Dockerfile b/templates/jlink/Dockerfile index cb678e56..b30ada5b 100644 --- a/templates/jlink/Dockerfile +++ b/templates/jlink/Dockerfile @@ -18,10 +18,8 @@ FROM registry.access.redhat.com/ubi9/ubi-micro AS lean-runtime COPY --from=ubi9-jlinked-image /mnt/jrootfs/ / COPY --from=ubi9-jlinked-image /deployments /deployments COPY --from=ubi9-jlinked-image /tmp/jre /usr/lib/jvm/java -COPY --from=ubi9-jlinked-image /opt/jboss/container/java/run/run-java.sh /opt/jboss/container/java/run/run-java.sh -COPY --from=ubi9-jlinked-image /opt/jboss/container/util/logging/logging.sh /opt/jboss/container/util/logging/logging.sh -COPY --from=ubi9-jlinked-image /opt/jboss/container/java/run/run-env.sh /opt/jboss/container/java/run/run-env.sh -RUN ls -LR /opt/jboss/container/ +COPY --from=ubi9-jlinked-image /opt/jboss/container/ /opt/jboss/container/ +RUN ls -la /opt/jboss/container/* ENV JAVA_HOME="/usr/lib/jvm/java" RUN echo $JAVA_HOME @@ -29,8 +27,5 @@ RUN echo $JAVA_HOME ENV PATH="$JAVA_HOME/bin/:$PATH" RUN echo $PATH -ENV JBOSS_CONTAINER_UTIL_LOGGING_MODULE=/opt/jboss/container/util/logging -ENV JBOSS_CONTAINER_JAVA_RUN_MODULE=/opt/jboss/container/java/run - CMD /opt/jboss/container/java/run/run-java.sh From 4ff685748c3cf1b2136f85a77ccff08ef86cb887 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Wed, 11 Oct 2023 22:53:51 +0530 Subject: [PATCH 010/132] Update tests to refer new application source repository Signed-off-by: Jayashree Huttanagoudar --- tests/features/java/java_s2i_inc.feature | 4 ++-- tests/features/java/openjdk_s2i.feature | 2 +- tests/features/java/ports.feature | 2 +- tests/features/java/runtime.feature | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/features/java/java_s2i_inc.feature b/tests/features/java/java_s2i_inc.feature index e7e7cccd..c494c5f6 100644 --- a/tests/features/java/java_s2i_inc.feature +++ b/tests/features/java/java_s2i_inc.feature @@ -4,12 +4,12 @@ Feature: Openshift OpenJDK S2I tests # test incremental builds Scenario: Check incremental builds cache .m2 - Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet | variable | value | | JAVA_ARGS | Hello from CTF test | Then container log should contain /deployments/undertow-servlet.jar Hello from CTF test And s2i build log should contain Downloading from central: - Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet with env and incremental + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet with env and incremental | variable | value | | JAVA_ARGS | Hello from CTF test | Then container log should contain /deployments/undertow-servlet.jar Hello from CTF test diff --git a/tests/features/java/openjdk_s2i.feature b/tests/features/java/openjdk_s2i.feature index 3514a038..34f3d767 100644 --- a/tests/features/java/openjdk_s2i.feature +++ b/tests/features/java/openjdk_s2i.feature @@ -3,7 +3,7 @@ @ubi9/openjdk-17 Feature: Openshift OpenJDK-only S2I tests Scenario: Check java perf dir owned by default (CLOUD-2070, OPENJDK-91) - Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet Then run jstat -gc 1 1000 1 in container and check its output for S0C And run stat --printf="%U %G" /tmp/hsperfdata_default/ in container and check its output for default root diff --git a/tests/features/java/ports.feature b/tests/features/java/ports.feature index 66eaabce..0d031588 100644 --- a/tests/features/java/ports.feature +++ b/tests/features/java/ports.feature @@ -3,7 +3,7 @@ Feature: Openshift OpenJDK port tests Scenario: Check ports are available - Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet Then check that port 8080 is open Then check that port 8443 is open Then inspect container diff --git a/tests/features/java/runtime.feature b/tests/features/java/runtime.feature index 583d74e4..b7e76494 100644 --- a/tests/features/java/runtime.feature +++ b/tests/features/java/runtime.feature @@ -3,7 +3,7 @@ Feature: Openshift OpenJDK Runtime tests Scenario: Ensure JAVA_ARGS is passed through, diagnostic options work correctly, JVM_ARGS not present in run script, OPENJDK-474 JAVA_ARGS not repeated - Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet | variable | value | | JAVA_ARGS | unique | | JAVA_DIAGNOSTICS | true | @@ -70,7 +70,7 @@ Feature: Openshift OpenJDK Runtime tests # Builder images only Scenario: Ensure JAVA_APP_DIR and S2I work together (OPENJDK-2034) - Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet | variable | value | | JAVA_APP_DIR | /home/default | | S2I_TARGET_DEPLOYMENTS_DIR | /home/default | From e5d53616d976ada1dc4ebb5b925ca9edcb1243a8 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 12 Oct 2023 01:07:31 +0530 Subject: [PATCH 011/132] Update URI to refer new repo for application sources from: https://github.com/jboss-openshift/openshift-examples/ https://github.com/jboss-container-images/openjdk : tests/OPENJDK-1549 https://github.com/jerboaa/quarkus-quickstarts (branch quickstart-2.16-s2i-cds) https://github.com/jmtd/openshift-quickstarts (branch OPENJDK-631-quarkus-fast-jar) Signed-off-by: Jayashree Huttanagoudar --- tests/features/java.security.feature | 2 +- tests/features/java/java_s2i.feature | 28 ++++++++++++------------- tests/features/java/memory.feature | 2 +- tests/features/java/openjdk_s2i.feature | 6 +++--- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/features/java.security.feature b/tests/features/java.security.feature index 72a0ffc9..d18abefe 100644 --- a/tests/features/java.security.feature +++ b/tests/features/java.security.feature @@ -2,5 +2,5 @@ @ubi9/openjdk-17 Feature: Openshift S2I tests Scenario: Check networkaddress.cache.negative.ttl has been set correctly - Given s2i build https://github.com/jboss-openshift/openshift-examples/ from binary-cli-security-property + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from binary-cli-security-property Then s2i build log should contain networkaddress.cache.negative.ttl=0 diff --git a/tests/features/java/java_s2i.feature b/tests/features/java/java_s2i.feature index 6c6bea9a..4b889bfd 100644 --- a/tests/features/java/java_s2i.feature +++ b/tests/features/java/java_s2i.feature @@ -7,7 +7,7 @@ Feature: Openshift OpenJDK S2I tests # handles mirror/repository configuration; proxy configuration Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -20,7 +20,7 @@ Feature: Openshift OpenJDK S2I tests # proxy auth configuration (success case) + nonProxyHosts Scenario: run the s2i and check the maven mirror, proxy (including username and password) and non proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | http_proxy | myuser:mypass@127.0.0.1:8080 | @@ -32,7 +32,7 @@ Feature: Openshift OpenJDK S2I tests # proxy auth configuration (fail case: no password supplied) Scenario: run the s2i and check the maven mirror, proxy (including username) and non proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | http_proxy | myuser@127.0.0.1:8080 | @@ -43,7 +43,7 @@ Feature: Openshift OpenJDK S2I tests # handles mirror/repository configuration; proxy configuration Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -56,7 +56,7 @@ Feature: Openshift OpenJDK S2I tests # HTTP_PROXY (all caps) ignored Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy and HTTP_PROXY - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | http_proxy | 127.0.0.2:9090 | @@ -69,7 +69,7 @@ Feature: Openshift OpenJDK S2I tests # handles mirror/repository configuration; https proxy configuration Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses https_proxy - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -82,7 +82,7 @@ Feature: Openshift OpenJDK S2I tests # https proxy auth configuration (success case) + nonProxyHosts Scenario: run the s2i and check the maven mirror, proxy (including username and password) and non proxy have been initialised in the default settings.xml, uses https_proxy - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | https_proxy | myuser:mypass@127.0.0.1:8080 | @@ -94,7 +94,7 @@ Feature: Openshift OpenJDK S2I tests # https proxy auth configuration (fail case: no password supplied) Scenario: run the s2i and check the maven mirror, proxy (including username) and non proxy have been initialised in the default settings.xml, uses https_proxy - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | https_proxy | myuser@127.0.0.1:8080 | @@ -104,7 +104,7 @@ Feature: Openshift OpenJDK S2I tests Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='https'][ns:host='127.0.0.1'][ns:port='8080'] Scenario: run s2i assemble and check no_proxy is honoured with multiple entries - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -127,20 +127,20 @@ Feature: Openshift OpenJDK S2I tests # CLOUD-579 Scenario: Test that maven is executed in batch mode - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple Then s2i build log should contain --batch-mode And s2i build log should not contain \r # CLOUD-3095 - context dir should be recursively copied into the image # "/target" suffix is important here; it triggers a different code-path (no source build) Scenario: Ensure binary-only mode copies binaries into the target image - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple/target + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple/target Then s2i build log should not contain skipping directory . And run find /deployments in container and check its output for spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar # OPENJDK-1954 - MAVEN_REPOS Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple/target + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple/target | variable | value | | MAVEN_REPOS | TESTREPO,ANOTHER | | TESTREPO_MAVEN_REPO_URL | http://repo.example.com:8080/maven2/ | @@ -157,7 +157,7 @@ Feature: Openshift OpenJDK S2I tests # OPENJDK-1961: MAVEN_REPO_URL and MAVEN_REPO_ID Scenario: Check MAVEN_REPO_URL generates Maven settings and profile configuration - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple/target + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple/target | variable | value | | MAVEN_REPO_URL | http://repo.example.com:8080/maven2/ | | MAVEN_REPO_ID | myrepo | @@ -168,6 +168,6 @@ Feature: Openshift OpenJDK S2I tests Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:profile[ns:id='myrepo-profile']/ns:repositories/ns:repository[ns:url='http://repo.example.com:8080/maven2/'] Scenario: Ensure the environment is cleaned when executing mvn (OPENJDK-1549) - Given s2i build https://github.com/jboss-container-images/openjdk from tests/OPENJDK-1549 with env using ubi9 + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from tests/OPENJDK-1549 with env | variable | value | | MAVEN_ARGS | validate | diff --git a/tests/features/java/memory.feature b/tests/features/java/memory.feature index 47e4e942..a61e1d13 100644 --- a/tests/features/java/memory.feature +++ b/tests/features/java/memory.feature @@ -36,5 +36,5 @@ Feature: OPENJDK-559 JVM Memory tests @ubi9/openjdk-11 @ubi9/openjdk-17 Scenario: Ensure Maven doesn't use MaxRAMPercentage=80 - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple Then s2i build log should match regex INFO Using MAVEN_OPTS.*-XX:MaxRAMPercentage=25.0$ diff --git a/tests/features/java/openjdk_s2i.feature b/tests/features/java/openjdk_s2i.feature index 34f3d767..d673f0be 100644 --- a/tests/features/java/openjdk_s2i.feature +++ b/tests/features/java/openjdk_s2i.feature @@ -8,11 +8,11 @@ Feature: Openshift OpenJDK-only S2I tests And run stat --printf="%U %G" /tmp/hsperfdata_default/ in container and check its output for default root Scenario: Ensure Quarkus CDS doesn't fail due to timestamp mismatch (OPENDJK-1673) - Given s2i build https://github.com/jerboaa/quarkus-quickstarts from getting-started using quickstart-2.16-s2i-cds + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from getting-started Then container log should not contain A jar file is not the one used while building the shared archive file Scenario: quarkus fast-jar layout works out-of-the-box (OPENJDK-631) - Given s2i build https://github.com/jmtd/openshift-quickstarts from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i using OPENJDK-631-quarkus-fast-jar + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i Then container log should contain INFO quarkus fast-jar package type detected And container log should contain -jar /deployments/quarkus-app/quarkus-run.jar And container log should contain (main) getting-started 1.0.0-SNAPSHOT on JVM (powered by Quarkus @@ -21,7 +21,7 @@ Feature: Openshift OpenJDK-only S2I tests And container log should not contain no main manifest attribute Scenario: quarkus uber-jar layout works out-of-the-box (OPENJDK-631) - Given s2i build https://github.com/jmtd/openshift-quickstarts from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i with env using OPENJDK-631-quarkus-fast-jar + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i with env | variable | value | | QUARKUS_PACKAGE_TYPE | uber-jar | Then container log should not contain INFO quarkus fast-jar package type detected From 12d0bf73b6755266230c14fe00694f0a12178821 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 12 Oct 2023 01:13:56 +0530 Subject: [PATCH 012/132] Update new applicaiton sources URI in the test case Signed-off-by: Jayashree Huttanagoudar --- tests/features/s2i-core.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/features/s2i-core.feature b/tests/features/s2i-core.feature index e4361704..0361a3a8 100644 --- a/tests/features/s2i-core.feature +++ b/tests/features/s2i-core.feature @@ -3,5 +3,5 @@ Feature: Openshift S2I tests # OPENJDK-84 - /tmp/src should not be present after build Scenario: run an s2i build and check that /tmp/src has been removed afterwards - Given s2i build https://github.com/jboss-openshift/openshift-examples from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple Then run stat /tmp/src in container and immediately check its output does not contain File: From e6f2d81e21dbbd3b98fb25353423ce532cee7c5f Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Wed, 25 Oct 2023 15:01:06 +0530 Subject: [PATCH 013/132] Address review comment to correct URI in the Given section Signed-off-by: Jayashree Huttanagoudar --- tests/features/java.security.feature | 2 +- tests/features/java/java_s2i.feature | 26 ++++++++++++------------ tests/features/java/java_s2i_inc.feature | 4 ++-- tests/features/java/memory.feature | 2 +- tests/features/java/openjdk_s2i.feature | 6 +++--- tests/features/java/ports.feature | 2 +- tests/features/java/runtime.feature | 4 ++-- tests/features/s2i-core.feature | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/features/java.security.feature b/tests/features/java.security.feature index d18abefe..ccdfdf20 100644 --- a/tests/features/java.security.feature +++ b/tests/features/java.security.feature @@ -2,5 +2,5 @@ @ubi9/openjdk-17 Feature: Openshift S2I tests Scenario: Check networkaddress.cache.negative.ttl has been set correctly - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from binary-cli-security-property + Given s2i build https://github.com/jhuttana/openjdk-test-applications from binary-cli-security-property using pick_relevant_sources Then s2i build log should contain networkaddress.cache.negative.ttl=0 diff --git a/tests/features/java/java_s2i.feature b/tests/features/java/java_s2i.feature index 4b889bfd..ee1b85a7 100644 --- a/tests/features/java/java_s2i.feature +++ b/tests/features/java/java_s2i.feature @@ -7,7 +7,7 @@ Feature: Openshift OpenJDK S2I tests # handles mirror/repository configuration; proxy configuration Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -20,7 +20,7 @@ Feature: Openshift OpenJDK S2I tests # proxy auth configuration (success case) + nonProxyHosts Scenario: run the s2i and check the maven mirror, proxy (including username and password) and non proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources | variable | value | | MAVEN_ARGS | -v | | http_proxy | myuser:mypass@127.0.0.1:8080 | @@ -32,7 +32,7 @@ Feature: Openshift OpenJDK S2I tests # proxy auth configuration (fail case: no password supplied) Scenario: run the s2i and check the maven mirror, proxy (including username) and non proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources | variable | value | | MAVEN_ARGS | -v | | http_proxy | myuser@127.0.0.1:8080 | @@ -43,7 +43,7 @@ Feature: Openshift OpenJDK S2I tests # handles mirror/repository configuration; proxy configuration Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -56,7 +56,7 @@ Feature: Openshift OpenJDK S2I tests # HTTP_PROXY (all caps) ignored Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy and HTTP_PROXY - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources | variable | value | | MAVEN_ARGS | -v | | http_proxy | 127.0.0.2:9090 | @@ -69,7 +69,7 @@ Feature: Openshift OpenJDK S2I tests # handles mirror/repository configuration; https proxy configuration Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses https_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -82,7 +82,7 @@ Feature: Openshift OpenJDK S2I tests # https proxy auth configuration (success case) + nonProxyHosts Scenario: run the s2i and check the maven mirror, proxy (including username and password) and non proxy have been initialised in the default settings.xml, uses https_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources | variable | value | | MAVEN_ARGS | -v | | https_proxy | myuser:mypass@127.0.0.1:8080 | @@ -94,7 +94,7 @@ Feature: Openshift OpenJDK S2I tests # https proxy auth configuration (fail case: no password supplied) Scenario: run the s2i and check the maven mirror, proxy (including username) and non proxy have been initialised in the default settings.xml, uses https_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources | variable | value | | MAVEN_ARGS | -v | | https_proxy | myuser@127.0.0.1:8080 | @@ -104,7 +104,7 @@ Feature: Openshift OpenJDK S2I tests Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='https'][ns:host='127.0.0.1'][ns:port='8080'] Scenario: run s2i assemble and check no_proxy is honoured with multiple entries - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -127,7 +127,7 @@ Feature: Openshift OpenJDK S2I tests # CLOUD-579 Scenario: Test that maven is executed in batch mode - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources Then s2i build log should contain --batch-mode And s2i build log should not contain \r @@ -140,7 +140,7 @@ Feature: Openshift OpenJDK S2I tests # OPENJDK-1954 - MAVEN_REPOS Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple/target + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple/target using pick_relevant_sources | variable | value | | MAVEN_REPOS | TESTREPO,ANOTHER | | TESTREPO_MAVEN_REPO_URL | http://repo.example.com:8080/maven2/ | @@ -157,7 +157,7 @@ Feature: Openshift OpenJDK S2I tests # OPENJDK-1961: MAVEN_REPO_URL and MAVEN_REPO_ID Scenario: Check MAVEN_REPO_URL generates Maven settings and profile configuration - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple/target + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple/target using pick_relevant_sources | variable | value | | MAVEN_REPO_URL | http://repo.example.com:8080/maven2/ | | MAVEN_REPO_ID | myrepo | @@ -168,6 +168,6 @@ Feature: Openshift OpenJDK S2I tests Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:profile[ns:id='myrepo-profile']/ns:repositories/ns:repository[ns:url='http://repo.example.com:8080/maven2/'] Scenario: Ensure the environment is cleaned when executing mvn (OPENJDK-1549) - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from tests/OPENJDK-1549 with env + Given s2i build https://github.com/jhuttana/openjdk-test-applications from tests/OPENJDK-1549 with env using pick_relevant_sources | variable | value | | MAVEN_ARGS | validate | diff --git a/tests/features/java/java_s2i_inc.feature b/tests/features/java/java_s2i_inc.feature index c494c5f6..2666c778 100644 --- a/tests/features/java/java_s2i_inc.feature +++ b/tests/features/java/java_s2i_inc.feature @@ -4,12 +4,12 @@ Feature: Openshift OpenJDK S2I tests # test incremental builds Scenario: Check incremental builds cache .m2 - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources | variable | value | | JAVA_ARGS | Hello from CTF test | Then container log should contain /deployments/undertow-servlet.jar Hello from CTF test And s2i build log should contain Downloading from central: - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet with env and incremental + Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet with env and incremental using pick_relevant_sources | variable | value | | JAVA_ARGS | Hello from CTF test | Then container log should contain /deployments/undertow-servlet.jar Hello from CTF test diff --git a/tests/features/java/memory.feature b/tests/features/java/memory.feature index a61e1d13..c792c2bc 100644 --- a/tests/features/java/memory.feature +++ b/tests/features/java/memory.feature @@ -36,5 +36,5 @@ Feature: OPENJDK-559 JVM Memory tests @ubi9/openjdk-11 @ubi9/openjdk-17 Scenario: Ensure Maven doesn't use MaxRAMPercentage=80 - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources Then s2i build log should match regex INFO Using MAVEN_OPTS.*-XX:MaxRAMPercentage=25.0$ diff --git a/tests/features/java/openjdk_s2i.feature b/tests/features/java/openjdk_s2i.feature index d673f0be..3b9508ae 100644 --- a/tests/features/java/openjdk_s2i.feature +++ b/tests/features/java/openjdk_s2i.feature @@ -3,7 +3,7 @@ @ubi9/openjdk-17 Feature: Openshift OpenJDK-only S2I tests Scenario: Check java perf dir owned by default (CLOUD-2070, OPENJDK-91) - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources Then run jstat -gc 1 1000 1 in container and check its output for S0C And run stat --printf="%U %G" /tmp/hsperfdata_default/ in container and check its output for default root @@ -12,7 +12,7 @@ Feature: Openshift OpenJDK-only S2I tests Then container log should not contain A jar file is not the one used while building the shared archive file Scenario: quarkus fast-jar layout works out-of-the-box (OPENJDK-631) - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i + Given s2i build https://github.com/jhuttana/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i using pick_relevant_sources Then container log should contain INFO quarkus fast-jar package type detected And container log should contain -jar /deployments/quarkus-app/quarkus-run.jar And container log should contain (main) getting-started 1.0.0-SNAPSHOT on JVM (powered by Quarkus @@ -21,7 +21,7 @@ Feature: Openshift OpenJDK-only S2I tests And container log should not contain no main manifest attribute Scenario: quarkus uber-jar layout works out-of-the-box (OPENJDK-631) - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i with env + Given s2i build https://github.com/jhuttana/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i with env using pick_relevant_sources | variable | value | | QUARKUS_PACKAGE_TYPE | uber-jar | Then container log should not contain INFO quarkus fast-jar package type detected diff --git a/tests/features/java/ports.feature b/tests/features/java/ports.feature index 0d031588..a36bbe6b 100644 --- a/tests/features/java/ports.feature +++ b/tests/features/java/ports.feature @@ -3,7 +3,7 @@ Feature: Openshift OpenJDK port tests Scenario: Check ports are available - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources Then check that port 8080 is open Then check that port 8443 is open Then inspect container diff --git a/tests/features/java/runtime.feature b/tests/features/java/runtime.feature index b7e76494..96bc00e5 100644 --- a/tests/features/java/runtime.feature +++ b/tests/features/java/runtime.feature @@ -3,7 +3,7 @@ Feature: Openshift OpenJDK Runtime tests Scenario: Ensure JAVA_ARGS is passed through, diagnostic options work correctly, JVM_ARGS not present in run script, OPENJDK-474 JAVA_ARGS not repeated - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources | variable | value | | JAVA_ARGS | unique | | JAVA_DIAGNOSTICS | true | @@ -70,7 +70,7 @@ Feature: Openshift OpenJDK Runtime tests # Builder images only Scenario: Ensure JAVA_APP_DIR and S2I work together (OPENJDK-2034) - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from undertow-servlet + Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources | variable | value | | JAVA_APP_DIR | /home/default | | S2I_TARGET_DEPLOYMENTS_DIR | /home/default | diff --git a/tests/features/s2i-core.feature b/tests/features/s2i-core.feature index 0361a3a8..edb31093 100644 --- a/tests/features/s2i-core.feature +++ b/tests/features/s2i-core.feature @@ -3,5 +3,5 @@ Feature: Openshift S2I tests # OPENJDK-84 - /tmp/src should not be present after build Scenario: run an s2i build and check that /tmp/src has been removed afterwards - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources Then run stat /tmp/src in container and immediately check its output does not contain File: From f1feb34ff31c7933e81de72e1dab1850b9d5f79c Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Mon, 6 Nov 2023 22:14:12 +0530 Subject: [PATCH 014/132] Correct the 'Given' section in tests to match s2i build scenarios Signed-off-by: Jayashree Huttanagoudar --- tests/features/java/java_s2i.feature | 4 ++-- tests/features/java/openjdk_s2i.feature | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/features/java/java_s2i.feature b/tests/features/java/java_s2i.feature index ee1b85a7..97fedb22 100644 --- a/tests/features/java/java_s2i.feature +++ b/tests/features/java/java_s2i.feature @@ -134,7 +134,7 @@ Feature: Openshift OpenJDK S2I tests # CLOUD-3095 - context dir should be recursively copied into the image # "/target" suffix is important here; it triggers a different code-path (no source build) Scenario: Ensure binary-only mode copies binaries into the target image - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from spring-boot-sample-simple/target + Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple/target using pick_relevant_sources Then s2i build log should not contain skipping directory . And run find /deployments in container and check its output for spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar @@ -168,6 +168,6 @@ Feature: Openshift OpenJDK S2I tests Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:profile[ns:id='myrepo-profile']/ns:repositories/ns:repository[ns:url='http://repo.example.com:8080/maven2/'] Scenario: Ensure the environment is cleaned when executing mvn (OPENJDK-1549) - Given s2i build https://github.com/jhuttana/openjdk-test-applications from tests/OPENJDK-1549 with env using pick_relevant_sources + Given s2i build https://github.com/jhuttana/openjdk-test-applications from OPENJDK-1549 with env using pick_relevant_sources | variable | value | | MAVEN_ARGS | validate | diff --git a/tests/features/java/openjdk_s2i.feature b/tests/features/java/openjdk_s2i.feature index 3b9508ae..2e711f32 100644 --- a/tests/features/java/openjdk_s2i.feature +++ b/tests/features/java/openjdk_s2i.feature @@ -8,7 +8,7 @@ Feature: Openshift OpenJDK-only S2I tests And run stat --printf="%U %G" /tmp/hsperfdata_default/ in container and check its output for default root Scenario: Ensure Quarkus CDS doesn't fail due to timestamp mismatch (OPENDJK-1673) - Given s2i build https://github.com/jhuttana/openjdk-test-applications/tree/pick_relevant_sources from getting-started + Given s2i build https://github.com/jhuttana/openjdk-test-applications from getting-started using pick_relevant_sources Then container log should not contain A jar file is not the one used while building the shared archive file Scenario: quarkus fast-jar layout works out-of-the-box (OPENJDK-631) From 490fbd1246326f6f64bf2cd7cc385488fd839755 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Wed, 8 Nov 2023 19:28:04 +0530 Subject: [PATCH 015/132] Update URI to master repo in the Given section Signed-off-by: Jayashree Huttanagoudar --- tests/features/java.security.feature | 2 +- tests/features/java/java_s2i.feature | 28 ++++++++++++------------ tests/features/java/java_s2i_inc.feature | 4 ++-- tests/features/java/memory.feature | 2 +- tests/features/java/openjdk_s2i.feature | 8 +++---- tests/features/java/ports.feature | 2 +- tests/features/java/runtime.feature | 4 ++-- tests/features/s2i-core.feature | 2 +- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/features/java.security.feature b/tests/features/java.security.feature index ccdfdf20..b8b289e0 100644 --- a/tests/features/java.security.feature +++ b/tests/features/java.security.feature @@ -2,5 +2,5 @@ @ubi9/openjdk-17 Feature: Openshift S2I tests Scenario: Check networkaddress.cache.negative.ttl has been set correctly - Given s2i build https://github.com/jhuttana/openjdk-test-applications from binary-cli-security-property using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from binary-cli-security-property Then s2i build log should contain networkaddress.cache.negative.ttl=0 diff --git a/tests/features/java/java_s2i.feature b/tests/features/java/java_s2i.feature index 97fedb22..b37c7eea 100644 --- a/tests/features/java/java_s2i.feature +++ b/tests/features/java/java_s2i.feature @@ -7,7 +7,7 @@ Feature: Openshift OpenJDK S2I tests # handles mirror/repository configuration; proxy configuration Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -20,7 +20,7 @@ Feature: Openshift OpenJDK S2I tests # proxy auth configuration (success case) + nonProxyHosts Scenario: run the s2i and check the maven mirror, proxy (including username and password) and non proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | http_proxy | myuser:mypass@127.0.0.1:8080 | @@ -32,7 +32,7 @@ Feature: Openshift OpenJDK S2I tests # proxy auth configuration (fail case: no password supplied) Scenario: run the s2i and check the maven mirror, proxy (including username) and non proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | http_proxy | myuser@127.0.0.1:8080 | @@ -43,7 +43,7 @@ Feature: Openshift OpenJDK S2I tests # handles mirror/repository configuration; proxy configuration Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -56,7 +56,7 @@ Feature: Openshift OpenJDK S2I tests # HTTP_PROXY (all caps) ignored Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy and HTTP_PROXY - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | http_proxy | 127.0.0.2:9090 | @@ -69,7 +69,7 @@ Feature: Openshift OpenJDK S2I tests # handles mirror/repository configuration; https proxy configuration Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses https_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -82,7 +82,7 @@ Feature: Openshift OpenJDK S2I tests # https proxy auth configuration (success case) + nonProxyHosts Scenario: run the s2i and check the maven mirror, proxy (including username and password) and non proxy have been initialised in the default settings.xml, uses https_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | https_proxy | myuser:mypass@127.0.0.1:8080 | @@ -94,7 +94,7 @@ Feature: Openshift OpenJDK S2I tests # https proxy auth configuration (fail case: no password supplied) Scenario: run the s2i and check the maven mirror, proxy (including username) and non proxy have been initialised in the default settings.xml, uses https_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | https_proxy | myuser@127.0.0.1:8080 | @@ -104,7 +104,7 @@ Feature: Openshift OpenJDK S2I tests Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:proxy[ns:id='genproxy'][ns:active='true'][ns:protocol='https'][ns:host='127.0.0.1'][ns:port='8080'] Scenario: run s2i assemble and check no_proxy is honoured with multiple entries - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple | variable | value | | MAVEN_ARGS | -v | | MAVEN_MIRROR_URL | http://127.0.0.1:8080/repository/internal/ | @@ -127,20 +127,20 @@ Feature: Openshift OpenJDK S2I tests # CLOUD-579 Scenario: Test that maven is executed in batch mode - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple Then s2i build log should contain --batch-mode And s2i build log should not contain \r # CLOUD-3095 - context dir should be recursively copied into the image # "/target" suffix is important here; it triggers a different code-path (no source build) Scenario: Ensure binary-only mode copies binaries into the target image - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple/target using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target Then s2i build log should not contain skipping directory . And run find /deployments in container and check its output for spring-boot-sample-simple-1.5.0.BUILD-SNAPSHOT.jar # OPENJDK-1954 - MAVEN_REPOS Scenario: run the s2i and check the maven mirror and proxy have been initialised in the default settings.xml, uses http_proxy - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple/target using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target | variable | value | | MAVEN_REPOS | TESTREPO,ANOTHER | | TESTREPO_MAVEN_REPO_URL | http://repo.example.com:8080/maven2/ | @@ -157,7 +157,7 @@ Feature: Openshift OpenJDK S2I tests # OPENJDK-1961: MAVEN_REPO_URL and MAVEN_REPO_ID Scenario: Check MAVEN_REPO_URL generates Maven settings and profile configuration - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple/target using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target | variable | value | | MAVEN_REPO_URL | http://repo.example.com:8080/maven2/ | | MAVEN_REPO_ID | myrepo | @@ -168,6 +168,6 @@ Feature: Openshift OpenJDK S2I tests Then XML file /tmp/artifacts/configuration/settings.xml should have 1 elements on XPath //ns:profile[ns:id='myrepo-profile']/ns:repositories/ns:repository[ns:url='http://repo.example.com:8080/maven2/'] Scenario: Ensure the environment is cleaned when executing mvn (OPENJDK-1549) - Given s2i build https://github.com/jhuttana/openjdk-test-applications from OPENJDK-1549 with env using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from OPENJDK-1549 with env | variable | value | | MAVEN_ARGS | validate | diff --git a/tests/features/java/java_s2i_inc.feature b/tests/features/java/java_s2i_inc.feature index 2666c778..b96fc7a8 100644 --- a/tests/features/java/java_s2i_inc.feature +++ b/tests/features/java/java_s2i_inc.feature @@ -4,12 +4,12 @@ Feature: Openshift OpenJDK S2I tests # test incremental builds Scenario: Check incremental builds cache .m2 - Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from undertow-servlet | variable | value | | JAVA_ARGS | Hello from CTF test | Then container log should contain /deployments/undertow-servlet.jar Hello from CTF test And s2i build log should contain Downloading from central: - Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet with env and incremental using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from undertow-servlet with env and incremental | variable | value | | JAVA_ARGS | Hello from CTF test | Then container log should contain /deployments/undertow-servlet.jar Hello from CTF test diff --git a/tests/features/java/memory.feature b/tests/features/java/memory.feature index c792c2bc..83bd66cf 100644 --- a/tests/features/java/memory.feature +++ b/tests/features/java/memory.feature @@ -36,5 +36,5 @@ Feature: OPENJDK-559 JVM Memory tests @ubi9/openjdk-11 @ubi9/openjdk-17 Scenario: Ensure Maven doesn't use MaxRAMPercentage=80 - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple Then s2i build log should match regex INFO Using MAVEN_OPTS.*-XX:MaxRAMPercentage=25.0$ diff --git a/tests/features/java/openjdk_s2i.feature b/tests/features/java/openjdk_s2i.feature index 2e711f32..5c211902 100644 --- a/tests/features/java/openjdk_s2i.feature +++ b/tests/features/java/openjdk_s2i.feature @@ -3,16 +3,16 @@ @ubi9/openjdk-17 Feature: Openshift OpenJDK-only S2I tests Scenario: Check java perf dir owned by default (CLOUD-2070, OPENJDK-91) - Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from undertow-servlet Then run jstat -gc 1 1000 1 in container and check its output for S0C And run stat --printf="%U %G" /tmp/hsperfdata_default/ in container and check its output for default root Scenario: Ensure Quarkus CDS doesn't fail due to timestamp mismatch (OPENDJK-1673) - Given s2i build https://github.com/jhuttana/openjdk-test-applications from getting-started using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from getting-started Then container log should not contain A jar file is not the one used while building the shared archive file Scenario: quarkus fast-jar layout works out-of-the-box (OPENJDK-631) - Given s2i build https://github.com/jhuttana/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i Then container log should contain INFO quarkus fast-jar package type detected And container log should contain -jar /deployments/quarkus-app/quarkus-run.jar And container log should contain (main) getting-started 1.0.0-SNAPSHOT on JVM (powered by Quarkus @@ -21,7 +21,7 @@ Feature: Openshift OpenJDK-only S2I tests And container log should not contain no main manifest attribute Scenario: quarkus uber-jar layout works out-of-the-box (OPENJDK-631) - Given s2i build https://github.com/jhuttana/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i with env using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i with env | variable | value | | QUARKUS_PACKAGE_TYPE | uber-jar | Then container log should not contain INFO quarkus fast-jar package type detected diff --git a/tests/features/java/ports.feature b/tests/features/java/ports.feature index a36bbe6b..884b9a26 100644 --- a/tests/features/java/ports.feature +++ b/tests/features/java/ports.feature @@ -3,7 +3,7 @@ Feature: Openshift OpenJDK port tests Scenario: Check ports are available - Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from undertow-servlet Then check that port 8080 is open Then check that port 8443 is open Then inspect container diff --git a/tests/features/java/runtime.feature b/tests/features/java/runtime.feature index 96bc00e5..cff751f3 100644 --- a/tests/features/java/runtime.feature +++ b/tests/features/java/runtime.feature @@ -3,7 +3,7 @@ Feature: Openshift OpenJDK Runtime tests Scenario: Ensure JAVA_ARGS is passed through, diagnostic options work correctly, JVM_ARGS not present in run script, OPENJDK-474 JAVA_ARGS not repeated - Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from undertow-servlet | variable | value | | JAVA_ARGS | unique | | JAVA_DIAGNOSTICS | true | @@ -70,7 +70,7 @@ Feature: Openshift OpenJDK Runtime tests # Builder images only Scenario: Ensure JAVA_APP_DIR and S2I work together (OPENJDK-2034) - Given s2i build https://github.com/jhuttana/openjdk-test-applications from undertow-servlet using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from undertow-servlet | variable | value | | JAVA_APP_DIR | /home/default | | S2I_TARGET_DEPLOYMENTS_DIR | /home/default | diff --git a/tests/features/s2i-core.feature b/tests/features/s2i-core.feature index edb31093..6f706c60 100644 --- a/tests/features/s2i-core.feature +++ b/tests/features/s2i-core.feature @@ -3,5 +3,5 @@ Feature: Openshift S2I tests # OPENJDK-84 - /tmp/src should not be present after build Scenario: run an s2i build and check that /tmp/src has been removed afterwards - Given s2i build https://github.com/jhuttana/openjdk-test-applications from spring-boot-sample-simple using pick_relevant_sources + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple Then run stat /tmp/src in container and immediately check its output does not contain File: From 06867b47626adf09de1b7c42841e890084a18a3e Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 13 Dec 2023 15:52:01 +0000 Subject: [PATCH 016/132] Tidy up integration of run-java/pathfinder modules Changes were made to run-java.sh in one branch of a merge that needed to be promoted up to the new pathfinder mdouel from the other branch of a merge. Signed-off-by: Jonathan Dowland --- .../opt/jboss/container/java/run/run-java.sh | 29 +++++-------------- .../container/util/pathfinder/pathfinder.sh | 26 ++++++----------- 2 files changed, 16 insertions(+), 39 deletions(-) diff --git a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh index 454e8982..8f939bbc 100644 --- a/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh +++ b/modules/run/artifacts/opt/jboss/container/java/run/run-java.sh @@ -3,15 +3,15 @@ # Fail on a single failed command set -eo pipefail +# define default values for the location of sub-scripts. This is +# necessary when the run script is used from an environment which +# lacks the definitions, such as a ubi-micro-based image. export JBOSS_CONTAINER_UTIL_LOGGING_MODULE="${JBOSS_CONTAINER_UTIL_LOGGING_MODULE-/opt/jboss/container/util/logging}" export JBOSS_CONTAINER_JAVA_RUN_MODULE="${JBOSS_CONTAINER_JAVA_RUN_MODULE-/opt/jboss/container/java/run}" - -# Default the application dir to the S2I deployment dir -if [ -z "$JAVA_APP_DIR" ] - then JAVA_APP_DIR=/deployments -fi +export JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE="${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE-/opt/jboss/container/util/pathfinder}" source "$JBOSS_CONTAINER_UTIL_LOGGING_MODULE/logging.sh" +source "$JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE/pathfinder.sh" # ========================================================== # Generic run script for running arbitrary Java applications @@ -30,22 +30,6 @@ check_error() { fi } -load_env() { - # Configuration stuff is read from this file - local run_env_sh="run-env.sh" - - # Load default default config - if [ -f "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}" ]; then - source "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}" - fi - - # Load JAVA_APP_JAR and JAVA_LIB_DIR - if [ -f "${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE}/pathfinder.sh" ]; then - source "$JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE/pathfinder.sh" - setup_java_app_and_lib - fi -} - # Combine all java options get_java_options() { local jvm_opts @@ -128,7 +112,8 @@ get_classpath() { # Start JVM startup() { # Initialize environment - load_env + # populates JAVA_APP_JAR and JAVA_LIB_DIR and possibly JAVA_MAIN_CLASS + setup_java_app_and_lib local args cd ${JAVA_APP_DIR} diff --git a/modules/util/pathfinder/artifacts/opt/jboss/container/util/pathfinder/pathfinder.sh b/modules/util/pathfinder/artifacts/opt/jboss/container/util/pathfinder/pathfinder.sh index 2224eba0..3f4e0f4b 100644 --- a/modules/util/pathfinder/artifacts/opt/jboss/container/util/pathfinder/pathfinder.sh +++ b/modules/util/pathfinder/artifacts/opt/jboss/container/util/pathfinder/pathfinder.sh @@ -66,25 +66,17 @@ get_jar_file() { } setup_java_app_and_lib() { - # Configuration stuff is read from this file - local run_env_sh="run-env.sh" - - # Load default default config - if [ -f "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}" ]; then - source "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}" + # Default the application dir to the S2I deployment dir + if [ -z "$JAVA_APP_DIR" ] + then JAVA_APP_DIR=/deployments fi - # Check also $JAVA_APP_DIR. Overrides other defaults - # It's valid to set the app dir in the default script - if [ -z "${JAVA_APP_DIR}" ]; then - # XXX: is this correct? This is defaulted above to /deployments. Should we - # define a default to the old /opt/java-run? - JAVA_APP_DIR="${JBOSS_CONTAINER_JAVA_RUN_MODULE}" - else - if [ -f "${JAVA_APP_DIR}/${run_env_sh}" ]; then - source "${JAVA_APP_DIR}/${run_env_sh}" - fi + # application-source provided shell script that may set environment + # variables + if [ -f "${JAVA_APP_DIR}/run-env.sh" ]; then + source "${JAVA_APP_DIR}/run-env.sh" fi + export JAVA_APP_DIR # JAVA_LIB_DIR defaults to JAVA_APP_DIR @@ -101,4 +93,4 @@ setup_java_app_and_lib() { else export JAVA_MAIN_CLASS fi -} \ No newline at end of file +} From 53c03470ba57ee6571dc6c42c3b24c051bec7136 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Fri, 15 Dec 2023 13:56:14 +0000 Subject: [PATCH 017/132] README for jlink template directory Signed-off-by: Jonathan Dowland --- templates/jlink/Dockerfile | 2 +- templates/jlink/README.md | 56 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 templates/jlink/README.md diff --git a/templates/jlink/Dockerfile b/templates/jlink/Dockerfile index b30ada5b..efd34fbe 100644 --- a/templates/jlink/Dockerfile +++ b/templates/jlink/Dockerfile @@ -3,7 +3,7 @@ #Stage-1:build application JAR and libraries #steps to build the application JAR and jlinked JRE #for time being using the image built by Jon -FROM quay.io/jdowland/jlink:quarkus-getting-started AS ubi9-jlinked-image +FROM ubi9-jlinked-image AS ubi9-jlinked-image USER 0 RUN mkdir -p /mnt/jrootfs RUN microdnf install dnf -y diff --git a/templates/jlink/README.md b/templates/jlink/README.md new file mode 100644 index 00000000..f453d0f7 --- /dev/null +++ b/templates/jlink/README.md @@ -0,0 +1,56 @@ +# OpenShift-JLink PoC + +Try it out: + +## Stage 1: build and analyse application with OpenShift source-to-image (S2I) + +You need: + +1. Access to an OpenShift instance, or, use [the s2i standalone program](https://github.com/openshift/source-to-image) + * _([you might need to use an old version](https://github.com/openshift/source-to-image/issues/1135))_ +2. The OpenJDK builder image (with the customisations from the `jlink-dev` branch). + There's one at `quay.io/jdowland/jlink:latest` +3. A quickstart ([there's a specially-prepared Quarkus quickstart](https://github.com/jmtd/quarkus-quickstarts/tree/OPENJDK-631-fastjar-layout); + in the future [the mainline Quarkus quickstarts will be suitable](https://github.com/quarkusio/quarkus-quickstarts/pull/1359)) + +Here's a recipe using local `s2i` + +``` +BASEIMG=quay.io/jdowland/jlink:latest +APPSRC=https://github.com/jmtd/quarkus-quickstarts.git +CONTEXTDIR=getting-started +REV=OPENJDK-631-fastjar-layout +OUTIMG=ubi9-jlinked-image + +s2i build --pull-policy never --context-dir=${CONTEXTDIR} -r=${REV} \ + -e QUARKUS_PACKAGE_TYPE=uber-jar \ + -e S2I_ENABLE_JLINK=true \ + ${APPSRC} \ + ${BASEIMG} \ + ${OUTIMG} +``` + +## Stage 2: multi-stage build to assemble micro runtime + +You need: + +1. The output image from the first stage + * _here's one we made earlier: `quay.io/jdowland/jlink:quarkus-getting-started`_ +2. OpenShift, or a container runtime (e.g. Docker) +3. [this Dockerfile](Dockerfile) (In future this is an OpenShift template) + +With docker, from a clone of this repository, in this directory: + +``` +docker build -t myapp -f . +``` + +## Stage 3: try it out! + +Does it work? + + docker run --rm -ti -p 8080 myapp + +How big is it? + + docker inspect -f '{{.Size}}' myapp From a31fbafcd2c3c0d3655c4fc841370dfba104e07d Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 17 Jan 2024 16:34:46 +0000 Subject: [PATCH 018/132] measure.sh: script to measure image sizes Signed-off-by: Jonathan Dowland --- measure.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 measure.sh diff --git a/measure.sh b/measure.sh new file mode 100644 index 00000000..1e60e168 --- /dev/null +++ b/measure.sh @@ -0,0 +1,49 @@ +# script to measure the sizes (and size savings) + +S2I=${S2I-s2i} +ENGINE=${ENGINE-docker} # or e.g. podman +BASEIMG=registry.access.redhat.com/ubi9/openjdk-17:latest +APPSRC=https://github.com/quarkusio/quarkus-quickstarts +CONTEXTDIR=getting-started +rev=3.6.6 +OUTIMG=out-s2i-image + +# first build the image using shipped builder images +$S2I build --pull-policy never \ + -e MAVEN_S2I_ARTIFACT_DIRS=target \ + -e S2I_SOURCE_DEPLOYMENTS_FILTER="*.jar quarkus-app" \ + -e QUARKUS_PACKAGE_TYPE=uber-jar \ + -e JAVA_APP_JAR=getting-started-1.0.0-SNAPSHOT-runner.jar \ + --context-dir=$CONTEXTDIR -r=${rev} \ + $APPSRC \ + $BASEIMG \ + $OUTIMG + +echo "baseline (simple S2I output):" +${ENGINE} inspect -f '{{.Size}}' $OUTIMG + +# second, do a build with the image from jlink-dev branch +# make sure it's been built! +# NOTE: we override most variables from .s2i/environment in the quickstart +# sources below, in order to an uber-jar. +BASEIMG=ubi9/openjdk-17:latest +OUTIMG=out-s2i-image2 + +$S2I build --pull-policy never \ + -e MAVEN_S2I_ARTIFACT_DIRS=target \ + -e S2I_SOURCE_DEPLOYMENTS_FILTER="*.jar quarkus-app" \ + -e QUARKUS_PACKAGE_TYPE=uber-jar \ + -e JAVA_APP_JAR=getting-started-1.0.0-SNAPSHOT-runner.jar \ + --context-dir=$CONTEXTDIR -r=${rev} \ + $APPSRC \ + $BASEIMG \ + $OUTIMG + +echo "intermediate jlink image size:" +docker inspect -f '{{.Size}}' $OUTIMG + +# third, run the above thru the second-stage process +OUTIMG=jlink-final +${ENGINE} build -t "$OUTIMG" templates/jlink +echo "final jlinked image size:" +docker inspect -f '{{.Size}}' "$OUTIMG" From bee0739d91c7829e6af3bdbdfd06f9af7a514aef Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 18 Jan 2024 15:29:11 +0000 Subject: [PATCH 019/132] measure: Ensure S2I_ENABLE_JLINK is enabled for phase 2 Signed-off-by: Jonathan Dowland --- measure.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/measure.sh b/measure.sh index 1e60e168..f3458cf6 100644 --- a/measure.sh +++ b/measure.sh @@ -30,6 +30,7 @@ BASEIMG=ubi9/openjdk-17:latest OUTIMG=out-s2i-image2 $S2I build --pull-policy never \ + -e S2I_ENABLE_JLINK=true \ -e MAVEN_S2I_ARTIFACT_DIRS=target \ -e S2I_SOURCE_DEPLOYMENTS_FILTER="*.jar quarkus-app" \ -e QUARKUS_PACKAGE_TYPE=uber-jar \ From 17af50a96411be7d89e85547e3e8f928e2537bdd Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 18 Jan 2024 16:29:57 +0000 Subject: [PATCH 020/132] measure.sh: match intermediate output name to Dockerfile Signed-off-by: Jonathan Dowland --- measure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/measure.sh b/measure.sh index f3458cf6..3299d79e 100644 --- a/measure.sh +++ b/measure.sh @@ -27,7 +27,7 @@ ${ENGINE} inspect -f '{{.Size}}' $OUTIMG # NOTE: we override most variables from .s2i/environment in the quickstart # sources below, in order to an uber-jar. BASEIMG=ubi9/openjdk-17:latest -OUTIMG=out-s2i-image2 +OUTIMG=ubi9-jlinked-image # matches input in templates/jlink/Dockerfile $S2I build --pull-policy never \ -e S2I_ENABLE_JLINK=true \ From 42a504cb42758b273cfa7aa63867508f7e653d2e Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 24 Jan 2024 14:28:30 +0000 Subject: [PATCH 021/132] Add JDK21 jmods RPM to builder image Signed-off-by: Jonathan Dowland --- modules/jdk/21/module.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/jdk/21/module.yaml b/modules/jdk/21/module.yaml index 764a16cd..585d4599 100644 --- a/modules/jdk/21/module.yaml +++ b/modules/jdk/21/module.yaml @@ -25,6 +25,7 @@ envs: packages: install: - java-21-openjdk-devel + - java-21-openjdk-jmods modules: install: From a11fcef7424a41dc74ec4f48aa37bd18fcb4f003 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 30 Jan 2024 11:23:43 +0000 Subject: [PATCH 022/132] Clean up templates/jlink/Dockerfile For clarity. Signed-off-by: Jonathan Dowland --- templates/jlink/Dockerfile | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/templates/jlink/Dockerfile b/templates/jlink/Dockerfile index efd34fbe..b90dec14 100644 --- a/templates/jlink/Dockerfile +++ b/templates/jlink/Dockerfile @@ -1,31 +1,24 @@ #multi-stage build for jlinked application JAR and JRE -#Stage-1:build application JAR and libraries -#steps to build the application JAR and jlinked JRE -#for time being using the image built by Jon +#Stage-1: ubi9-jlinked-image is builder image + application + jlinked JVM +# install additional system dependencies (for ubi-micro) to /mnt/jrootfs FROM ubi9-jlinked-image AS ubi9-jlinked-image USER 0 RUN mkdir -p /mnt/jrootfs -RUN microdnf install dnf -y -RUN dnf install --installroot /mnt/jrootfs grep gawk --releasever 9 --setopt install_weak_deps=false --nodocs -y;dnf clean all -RUN rm -rf /mnt/jrootfs/var/cache/* -RUN rm -rf /mnt/jrootfs/var/lib/rpm -USER 185 +RUN microdnf install dnf -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs +RUN dnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=false --nodocs -y \ + grep gawk \ + && dnf clean all +RUN rm -rf /mnt/jrootfs/var/cache/* /mnt/jrootfs/var/lib/rpm #Stage-2:copy application JAR and jlinked JRE to runtime image FROM registry.access.redhat.com/ubi9/ubi-micro AS lean-runtime +ARG JAVA_HOME=/usr/lib/jvm/java COPY --from=ubi9-jlinked-image /mnt/jrootfs/ / COPY --from=ubi9-jlinked-image /deployments /deployments -COPY --from=ubi9-jlinked-image /tmp/jre /usr/lib/jvm/java +COPY --from=ubi9-jlinked-image /tmp/jre ${JAVA_HOME} COPY --from=ubi9-jlinked-image /opt/jboss/container/ /opt/jboss/container/ -RUN ls -la /opt/jboss/container/* - -ENV JAVA_HOME="/usr/lib/jvm/java" -RUN echo $JAVA_HOME - -ENV PATH="$JAVA_HOME/bin/:$PATH" -RUN echo $PATH +ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH" CMD /opt/jboss/container/java/run/run-java.sh - From cb88c09a8ad875362cd8cfd0cfe8c1eea59b61ff Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 30 Jan 2024 11:38:49 +0000 Subject: [PATCH 023/132] templates/jlink/Dockerfile: only microdnf, non-root user microdnf (since at least 9.1-3.el9) now supports the required flags to install packages in a different root, therefore we do not need to install dnf in the first phase. remove the 'dnf clean all' which was operating in the wrong context. Clear up some cache directories inherited from ubi-micro. Remember to switch the runtime user away from root! Signed-off-by: Jonathan Dowland --- templates/jlink/Dockerfile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/templates/jlink/Dockerfile b/templates/jlink/Dockerfile index b90dec14..e73acebf 100644 --- a/templates/jlink/Dockerfile +++ b/templates/jlink/Dockerfile @@ -5,11 +5,14 @@ FROM ubi9-jlinked-image AS ubi9-jlinked-image USER 0 RUN mkdir -p /mnt/jrootfs -RUN microdnf install dnf -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs -RUN dnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=false --nodocs -y \ - grep gawk \ - && dnf clean all -RUN rm -rf /mnt/jrootfs/var/cache/* /mnt/jrootfs/var/lib/rpm +RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y \ + --config=/etc/dnf/dnf.conf \ + --noplugins \ + --setopt=cachedir=/var/cache \ + --setopt=reposdir=/etc/yum.repos.d \ + --setopt=varsdir=/etc/dnf/vars \ + grep gawk +RUN rm -rf /mnt/jrootfs/var/cache/* /mnt/jrootfs/var/lib/rpm /mnt/jrootfs/var/lib/dnf #Stage-2:copy application JAR and jlinked JRE to runtime image FROM registry.access.redhat.com/ubi9/ubi-micro AS lean-runtime @@ -19,6 +22,9 @@ COPY --from=ubi9-jlinked-image /mnt/jrootfs/ / COPY --from=ubi9-jlinked-image /deployments /deployments COPY --from=ubi9-jlinked-image /tmp/jre ${JAVA_HOME} COPY --from=ubi9-jlinked-image /opt/jboss/container/ /opt/jboss/container/ +# these are in the micro image +RUN rm -rf /var/lib/dnf /var/lib/rpm ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH" +USER 185 CMD /opt/jboss/container/java/run/run-java.sh From 540267d6cb79e7d37900485c392fb65fea4cef82 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 30 Jan 2024 15:51:12 +0000 Subject: [PATCH 024/132] use MAVEN_CLEAR_REPO for baseline S2I build otherwise the size is inflated by maven .m2 directory Signed-off-by: Jonathan Dowland --- measure.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/measure.sh b/measure.sh index 3299d79e..f32f4426 100644 --- a/measure.sh +++ b/measure.sh @@ -13,6 +13,7 @@ $S2I build --pull-policy never \ -e MAVEN_S2I_ARTIFACT_DIRS=target \ -e S2I_SOURCE_DEPLOYMENTS_FILTER="*.jar quarkus-app" \ -e QUARKUS_PACKAGE_TYPE=uber-jar \ + -e MAVEN_CLEAR_REPO=true \ -e JAVA_APP_JAR=getting-started-1.0.0-SNAPSHOT-runner.jar \ --context-dir=$CONTEXTDIR -r=${rev} \ $APPSRC \ From 5f28ed98d3eb4db20837a55a38ff94232ce8ff06 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 22 Feb 2024 10:57:58 +0000 Subject: [PATCH 025/132] Quote 'false' to force string type in YAML. Thanks for catching this Jaya! Signed-off-by: Jonathan Dowland --- modules/s2i/core/module.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/s2i/core/module.yaml b/modules/s2i/core/module.yaml index 2c904293..cc5004ea 100644 --- a/modules/s2i/core/module.yaml +++ b/modules/s2i/core/module.yaml @@ -116,7 +116,7 @@ envs: description: ^ Enables the Jdeps/JLink workflow to minimize JRE size example: "false" - value: false + value: "false" run: cmd: From acf0162f602763fe808ad49deb1370e8ced6d9d2 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 22 Feb 2024 14:48:55 +0000 Subject: [PATCH 026/132] Remove debug echo Signed-off-by: Jonathan Dowland --- modules/s2i/bash/artifacts/usr/local/s2i/assemble | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/s2i/bash/artifacts/usr/local/s2i/assemble b/modules/s2i/bash/artifacts/usr/local/s2i/assemble index 91174a72..bc63b312 100644 --- a/modules/s2i/bash/artifacts/usr/local/s2i/assemble +++ b/modules/s2i/bash/artifacts/usr/local/s2i/assemble @@ -16,7 +16,6 @@ maven_s2i_build # run the pathfinder scripts to define JAVA_APP_JAR and JAVA_LIB_DIR source "${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE}/pathfinder.sh" -echo "Setting up java app and lib variables" setup_java_app_and_lib # include our jlink scripts From 8c50624f8d5bd3f8f4b8afd9708cd4d3945b5b18 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 22 Feb 2024 14:49:25 +0000 Subject: [PATCH 027/132] [OPENJDK-2737] gate jlink calls behind S2I_ENABLE_JLINK Ensure that S2I_ENABLE_JLINK=true before evaluating any of the jlink integration code. https://issues.redhat.com/browse/OPENJDK-2737 Signed-off-by: Jonathan Dowland --- .../s2i/bash/artifacts/usr/local/s2i/assemble | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/s2i/bash/artifacts/usr/local/s2i/assemble b/modules/s2i/bash/artifacts/usr/local/s2i/assemble index bc63b312..c79a7c52 100644 --- a/modules/s2i/bash/artifacts/usr/local/s2i/assemble +++ b/modules/s2i/bash/artifacts/usr/local/s2i/assemble @@ -19,18 +19,22 @@ source "${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE}/pathfinder.sh" setup_java_app_and_lib # include our jlink scripts -source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh" -echo "Invoking mkdeps" -generate_deps +if [ "$S2I_ENABLE_JLINK" = "true" ]; then -source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkstrippeddeps.sh" -echo "Stripping dependencies" -mkstrippeddeps + source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh" + echo "Invoking mkdeps" + generate_deps -source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/generatejdkdeps.sh" -echo "Generating JDK dependencies" -generatejdkdeps + source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkstrippeddeps.sh" + echo "Stripping dependencies" + mkstrippeddeps -source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkjreimage.sh" -echo "Linking jre" -generate_jre_image \ No newline at end of file + source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/generatejdkdeps.sh" + echo "Generating JDK dependencies" + generatejdkdeps + + source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkjreimage.sh" + echo "Linking jre" + generate_jre_image + +fi From d55145b864a2c598598149cf00c2a3ec0b41b277 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 22 Feb 2024 14:58:17 +0000 Subject: [PATCH 028/132] [OPENJDK-2736] jlink pre-flight check for jmods Fail early and clearly if we don't have the jmods available for Jlink integration (or the JDK version isn't right) https://issues.redhat.com/browse/OPENJDK-2736 Signed-off-by: Jonathan Dowland --- .../opt/jboss/container/java/jlink/preflight.sh | 12 ++++++++++++ modules/s2i/bash/artifacts/usr/local/s2i/assemble | 3 +++ 2 files changed, 15 insertions(+) create mode 100644 modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh new file mode 100644 index 00000000..f9e051e9 --- /dev/null +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh @@ -0,0 +1,12 @@ +jlink_preflight_check() +{ + # preflight check: do we have what we need? + if [ "$JAVA_VERSION" -lt 11 ]; then + echo "Jlink integration not available for JDK${JAVA_VERSION}!" + echo "Jlink integration is only supported for JDK versions 11 and newer." + fi + if [ ! -d /usr/lib/jvm/java/jmods ]; then + echo "Jlink integration requires the jmods RPM to be installed in the builder image, e.g." + echo " microdnf install -y java-${JAVA_VERSION}-openjdk-jmods" + fi +} diff --git a/modules/s2i/bash/artifacts/usr/local/s2i/assemble b/modules/s2i/bash/artifacts/usr/local/s2i/assemble index c79a7c52..76999b56 100644 --- a/modules/s2i/bash/artifacts/usr/local/s2i/assemble +++ b/modules/s2i/bash/artifacts/usr/local/s2i/assemble @@ -21,6 +21,9 @@ setup_java_app_and_lib # include our jlink scripts if [ "$S2I_ENABLE_JLINK" = "true" ]; then + source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/preflight.sh" + jlink_preflight_check + source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh" echo "Invoking mkdeps" generate_deps From 66f164aa29ee891156fe1d68722cb07393680301 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 22 Feb 2024 13:03:02 +0530 Subject: [PATCH 029/132] Behave test for jlink integration code Signed-off-by: Jayashree Huttanagoudar --- modules/jlink/tests/features/jlink.feature | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 modules/jlink/tests/features/jlink.feature diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature new file mode 100644 index 00000000..33f96fe2 --- /dev/null +++ b/modules/jlink/tests/features/jlink.feature @@ -0,0 +1,16 @@ +@ubi9/openjdk-11 +@ubi9/openjdk-17 +@ubi9/openjdk-21 +Feature: Openshift OpenJDK S2I tests (jlink specific) +Scenario: Ensure jlinked builder is used to build the containerized application image + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i + | variable | value | + | S2I_ENABLE_JLINK | true | + | QUARKUS_PACKAGE_TYPE| uber-jar | + Then run ls /tmp/jre in container and check its output for bin + +Scenario: Ensure S2I_ENABLE_JLINK=false is the default + Given container is started with env + | variable | value | + | QUARKUS_PACKAGE_TYPE| uber-jar | + Then container log should not contain S2I_ENABLE_JLINK=true From 7112369d7c3156ff3e9aacef087bcb20986846e0 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Tue, 27 Feb 2024 00:09:10 +0530 Subject: [PATCH 030/132] Address review comments Signed-off-by: Jayashree Huttanagoudar --- modules/jlink/tests/features/jlink.feature | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index 33f96fe2..fad10836 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -10,7 +10,5 @@ Scenario: Ensure jlinked builder is used to build the containerized application Then run ls /tmp/jre in container and check its output for bin Scenario: Ensure S2I_ENABLE_JLINK=false is the default - Given container is started with env - | variable | value | - | QUARKUS_PACKAGE_TYPE| uber-jar | + Given container is started with command env Then container log should not contain S2I_ENABLE_JLINK=true From 51923e25a8ea34420631211a004c004b254cb37d Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 27 Feb 2024 15:30:43 +0000 Subject: [PATCH 031/132] [OPENJDK-2806] Remove value for S2I_ENABLE_JLINK S2I_ENABLE_JLINK is a configuration environment variable, not an informational one, and so the default should be unset, rather than "false". https://issues.redhat.com/browse/OPENJDK-2806 Signed-off-by: Jonathan Dowland --- modules/s2i/core/module.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/s2i/core/module.yaml b/modules/s2i/core/module.yaml index cc5004ea..af3123c4 100644 --- a/modules/s2i/core/module.yaml +++ b/modules/s2i/core/module.yaml @@ -116,7 +116,6 @@ envs: description: ^ Enables the Jdeps/JLink workflow to minimize JRE size example: "false" - value: "false" run: cmd: From b806996884cfa5e1610a5c66cef64f323965c086 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 28 Feb 2024 03:42:51 -0500 Subject: [PATCH 032/132] Initial dockerfiles and buildconfigs for JDK11, 17, 21. TODO: Script to run a build on each in an openshift environment --- .../jlink/jlink-builder/Dockerfile-jdk-11 | 9 ++++++++ .../jlink/jlink-builder/Dockerfile-jdk-17 | 9 ++++++++ .../jlink/jlink-builder/Dockerfile-jdk-21 | 9 ++++++++ .../jlink-builder/jdk-11-buildconfig.yaml | 23 +++++++++++++++++++ .../jlink-builder/jdk-17-buildconfig.yaml | 22 ++++++++++++++++++ .../jlink-builder/jdk-21-buildconfig.yaml | 22 ++++++++++++++++++ 6 files changed, 94 insertions(+) create mode 100644 templates/jlink/jlink-builder/Dockerfile-jdk-11 create mode 100644 templates/jlink/jlink-builder/Dockerfile-jdk-17 create mode 100644 templates/jlink/jlink-builder/Dockerfile-jdk-21 create mode 100644 templates/jlink/jlink-builder/jdk-11-buildconfig.yaml create mode 100644 templates/jlink/jlink-builder/jdk-17-buildconfig.yaml create mode 100644 templates/jlink/jlink-builder/jdk-21-buildconfig.yaml diff --git a/templates/jlink/jlink-builder/Dockerfile-jdk-11 b/templates/jlink/jlink-builder/Dockerfile-jdk-11 new file mode 100644 index 00000000..8cab836f --- /dev/null +++ b/templates/jlink/jlink-builder/Dockerfile-jdk-11 @@ -0,0 +1,9 @@ +# Stage 1 of the multi-stage build for the Jlink workflow (OPENJDK-2686) +# Goal: Builder image based off of the OpenJDK builder image with the jmods RPM installed +FROM registry.access.redhat.com/ubi9/openjdk-11 AS ubi9-openjdk11-jmods +USER 0 +RUN microdnf --setopt=install_weak_deps=0 \ + --setopt=tsflags=nodocs \ + install \ + -y \ + java-11-openjdk-jmods \ No newline at end of file diff --git a/templates/jlink/jlink-builder/Dockerfile-jdk-17 b/templates/jlink/jlink-builder/Dockerfile-jdk-17 new file mode 100644 index 00000000..7451f058 --- /dev/null +++ b/templates/jlink/jlink-builder/Dockerfile-jdk-17 @@ -0,0 +1,9 @@ +# Stage 1 of the multi-stage build for the Jlink workflow (OPENJDK-2686) +# Goal: Builder image based off of the OpenJDK builder image with the jmods RPM installed +FROM registry.access.redhat.com/ubi9/openjdk-17 AS ubi9-openjdk17-jmods +USER 0 +RUN microdnf --setopt=install_weak_deps=0 \ + --setopt=tsflags=nodocs \ + install \ + -y \ + java-17-openjdk-jmods \ No newline at end of file diff --git a/templates/jlink/jlink-builder/Dockerfile-jdk-21 b/templates/jlink/jlink-builder/Dockerfile-jdk-21 new file mode 100644 index 00000000..b7ca4ec8 --- /dev/null +++ b/templates/jlink/jlink-builder/Dockerfile-jdk-21 @@ -0,0 +1,9 @@ +# Stage 1 of the multi-stage build for the Jlink workflow (OPENJDK-2686) +# Goal: Builder image based off of the OpenJDK builder image with the jmods RPM installed +FROM registry.access.redhat.com/ubi9/openjdk-21 AS ubi9-openjdk21-jmods +USER 0 +RUN microdnf --setopt=install_weak_deps=0 \ + --setopt=tsflags=nodocs \ + install \ + -y \ + java-11-openjdk-jmods \ No newline at end of file diff --git a/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml new file mode 100644 index 00000000..8c84a5f7 --- /dev/null +++ b/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml @@ -0,0 +1,23 @@ +apiVersion: build.openshift.io/v1 +kind: BuildConfig +metadata: + name: jlink-builder-jdk-11 + labels: + app: jlink-builder-jdk-11 +spec: + source: + type: Git + git: + uri: https://github.com/jmtd/quarkus-quickstarts.git + contextDir: getting-started + dockerfile: | + FROM registry.access.redhat.com/ubi9/openjdk-11 AS ubi9-openjdk-11-jmods + USER 0 + RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-11-openjdk-jmods + strategy: + type: Docker + output: + to: + kind: ImageStreamTag + name: ubi9-openjdk-11-jlink:latest + diff --git a/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml new file mode 100644 index 00000000..359440ee --- /dev/null +++ b/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml @@ -0,0 +1,22 @@ +apiVersion: build.openshift.io/v1 +kind: BuildConfig +metadata: + name: jlink-builder-jdk-17 + labels: + app: jlink-builder-jdk-17 +spec: + source: + type: Git + git: + uri: https://github.com/jmtd/quarkus-quickstarts.git + contextDir: getting-started + dockerfile: | + FROM registry.access.redhat.com/ubi9/openjdk-11 AS ubi9-openjdk-17-jmods + USER 0 + RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-17-openjdk-jmods + strategy: + type: Docker + output: + to: + kind: ImageStreamTag + name: ubi9-openjdk-17-jlink:latest \ No newline at end of file diff --git a/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml new file mode 100644 index 00000000..bbd4d800 --- /dev/null +++ b/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml @@ -0,0 +1,22 @@ +apiVersion: build.openshift.io/v1 +kind: BuildConfig +metadata: + name: jlink-builder-jdk-21 + labels: + app: jlink-builder-jdk-21 +spec: + source: + type: Git + git: + uri: https://github.com/jmtd/quarkus-quickstarts.git + contextDir: getting-started + dockerfile: | + FROM registry.access.redhat.com/ubi9/openjdk-21 AS ubi9-openjdk-21-jmods + USER 0 + RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-21-openjdk-jmods + strategy: + type: Docker + output: + to: + kind: ImageStreamTag + name: ubi9-openjdk-21-jlink:latest \ No newline at end of file From ab4c42557597a0f09a11e65212cdf696abc493d9 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 28 Feb 2024 04:03:41 -0500 Subject: [PATCH 033/132] Remove dockerfiles, fix 17 buildconfig, add imagestream creation script --- templates/jlink/jlink-builder/Dockerfile-jdk-11 | 9 --------- templates/jlink/jlink-builder/Dockerfile-jdk-17 | 9 --------- templates/jlink/jlink-builder/Dockerfile-jdk-21 | 9 --------- templates/jlink/jlink-builder/build-imagestreams.sh | 9 +++++++++ templates/jlink/jlink-builder/jdk-17-buildconfig.yaml | 2 +- 5 files changed, 10 insertions(+), 28 deletions(-) delete mode 100644 templates/jlink/jlink-builder/Dockerfile-jdk-11 delete mode 100644 templates/jlink/jlink-builder/Dockerfile-jdk-17 delete mode 100644 templates/jlink/jlink-builder/Dockerfile-jdk-21 create mode 100755 templates/jlink/jlink-builder/build-imagestreams.sh diff --git a/templates/jlink/jlink-builder/Dockerfile-jdk-11 b/templates/jlink/jlink-builder/Dockerfile-jdk-11 deleted file mode 100644 index 8cab836f..00000000 --- a/templates/jlink/jlink-builder/Dockerfile-jdk-11 +++ /dev/null @@ -1,9 +0,0 @@ -# Stage 1 of the multi-stage build for the Jlink workflow (OPENJDK-2686) -# Goal: Builder image based off of the OpenJDK builder image with the jmods RPM installed -FROM registry.access.redhat.com/ubi9/openjdk-11 AS ubi9-openjdk11-jmods -USER 0 -RUN microdnf --setopt=install_weak_deps=0 \ - --setopt=tsflags=nodocs \ - install \ - -y \ - java-11-openjdk-jmods \ No newline at end of file diff --git a/templates/jlink/jlink-builder/Dockerfile-jdk-17 b/templates/jlink/jlink-builder/Dockerfile-jdk-17 deleted file mode 100644 index 7451f058..00000000 --- a/templates/jlink/jlink-builder/Dockerfile-jdk-17 +++ /dev/null @@ -1,9 +0,0 @@ -# Stage 1 of the multi-stage build for the Jlink workflow (OPENJDK-2686) -# Goal: Builder image based off of the OpenJDK builder image with the jmods RPM installed -FROM registry.access.redhat.com/ubi9/openjdk-17 AS ubi9-openjdk17-jmods -USER 0 -RUN microdnf --setopt=install_weak_deps=0 \ - --setopt=tsflags=nodocs \ - install \ - -y \ - java-17-openjdk-jmods \ No newline at end of file diff --git a/templates/jlink/jlink-builder/Dockerfile-jdk-21 b/templates/jlink/jlink-builder/Dockerfile-jdk-21 deleted file mode 100644 index b7ca4ec8..00000000 --- a/templates/jlink/jlink-builder/Dockerfile-jdk-21 +++ /dev/null @@ -1,9 +0,0 @@ -# Stage 1 of the multi-stage build for the Jlink workflow (OPENJDK-2686) -# Goal: Builder image based off of the OpenJDK builder image with the jmods RPM installed -FROM registry.access.redhat.com/ubi9/openjdk-21 AS ubi9-openjdk21-jmods -USER 0 -RUN microdnf --setopt=install_weak_deps=0 \ - --setopt=tsflags=nodocs \ - install \ - -y \ - java-11-openjdk-jmods \ No newline at end of file diff --git a/templates/jlink/jlink-builder/build-imagestreams.sh b/templates/jlink/jlink-builder/build-imagestreams.sh new file mode 100755 index 00000000..eae5137a --- /dev/null +++ b/templates/jlink/jlink-builder/build-imagestreams.sh @@ -0,0 +1,9 @@ +eval $(crc oc-env) +VERSION=11 + +# Buildconfigs attempt to push to ubi9-openjdk-$VERSION-jmods, this needs to exist first +oc create imagestream ubi9-openjdk-$VERSION-jlink + +# Assuming the buildconfig exists, we can now create the buildconfig +oc create -f jdk-$VERSION-buildconfig.yaml +oc start-build jlink-builder-jdk-$VERSION \ No newline at end of file diff --git a/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml index 359440ee..28562dfb 100644 --- a/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml +++ b/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml @@ -11,7 +11,7 @@ spec: uri: https://github.com/jmtd/quarkus-quickstarts.git contextDir: getting-started dockerfile: | - FROM registry.access.redhat.com/ubi9/openjdk-11 AS ubi9-openjdk-17-jmods + FROM registry.access.redhat.com/ubi9/openjdk-17 AS ubi9-openjdk-17-jmods USER 0 RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-17-openjdk-jmods strategy: From 7aa28f47e5b42c1ed1ec8323ff4bb581bfe27558 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 28 Feb 2024 11:45:24 +0000 Subject: [PATCH 034/132] run module: depend upon pathfinder module run-java.sh sources pathfinder.sh. Signed-off-by: Jonathan Dowland --- modules/run/module.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/run/module.yaml b/modules/run/module.yaml index 249e85eb..700dfe2f 100644 --- a/modules/run/module.yaml +++ b/modules/run/module.yaml @@ -59,3 +59,4 @@ modules: - name: jboss.container.user - name: jboss.container.java.jvm - name: jboss.container.util.logging + - name: jboss.container.util.pathfinder From ab2077ccc7b69e4581b0431a4cf6ca616664ae14 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Fri, 1 Mar 2024 00:25:56 +0530 Subject: [PATCH 035/132] Address review comments for S2I_ENABLE_JLINK configuration variable Signed-off-by: Jayashree Huttanagoudar --- modules/jlink/tests/features/jlink.feature | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index fad10836..b6f0f3e6 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -9,6 +9,7 @@ Scenario: Ensure jlinked builder is used to build the containerized application | QUARKUS_PACKAGE_TYPE| uber-jar | Then run ls /tmp/jre in container and check its output for bin -Scenario: Ensure S2I_ENABLE_JLINK=false is the default - Given container is started with command env +Scenario: Ensure S2I_ENABLE_JLINK is not set to true + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i Then container log should not contain S2I_ENABLE_JLINK=true + And run ls /tmp/jre in container and check its output for ls: From 897a419dd4996728a15d76ba509877f33789b06d Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Fri, 1 Mar 2024 08:35:50 +0000 Subject: [PATCH 036/132] [OPENJDK-2736] actually fail in preflight if conditions aren't met Signed-off-by: Jonathan Dowland --- .../jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh index f9e051e9..ab7aba35 100644 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh @@ -4,9 +4,11 @@ jlink_preflight_check() if [ "$JAVA_VERSION" -lt 11 ]; then echo "Jlink integration not available for JDK${JAVA_VERSION}!" echo "Jlink integration is only supported for JDK versions 11 and newer." + exit 1 fi if [ ! -d /usr/lib/jvm/java/jmods ]; then echo "Jlink integration requires the jmods RPM to be installed in the builder image, e.g." echo " microdnf install -y java-${JAVA_VERSION}-openjdk-jmods" + exit 1 fi } From 2c30d2e5636bbc81c931e14d615d684eda9acb04 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Sat, 2 Mar 2024 00:25:02 +0530 Subject: [PATCH 037/132] Address review comment to tweak the seach string in behave test Signed-off-by: Jayashree Huttanagoudar --- modules/jlink/tests/features/jlink.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index b6f0f3e6..b7a03365 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -12,4 +12,4 @@ Scenario: Ensure jlinked builder is used to build the containerized application Scenario: Ensure S2I_ENABLE_JLINK is not set to true Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i Then container log should not contain S2I_ENABLE_JLINK=true - And run ls /tmp/jre in container and check its output for ls: + And run ls /tmp/jre in container and check its output for No such file or directory From 1bedb626e0181792d03fc25d9498cef5e245277b Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Mon, 4 Mar 2024 14:53:49 +0000 Subject: [PATCH 038/132] jlink.feature: Adjust method for testing a directory doesn't exist Signed-off-by: Jonathan Dowland --- modules/jlink/tests/features/jlink.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index b7a03365..724f2468 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -12,4 +12,4 @@ Scenario: Ensure jlinked builder is used to build the containerized application Scenario: Ensure S2I_ENABLE_JLINK is not set to true Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i Then container log should not contain S2I_ENABLE_JLINK=true - And run ls /tmp/jre in container and check its output for No such file or directory + And run bash -c "test ! -d /tmp/jre && echo PASS" in container and immediately check its output for PASS From b9bdbf335a2e592453c040685512d97ad6be51e0 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 5 Mar 2024 14:38:44 +0000 Subject: [PATCH 039/132] [OPENJDK-2182] UBI9 image streams for jlink-dev Signed-off-by: Jonathan Dowland --- templates/ubi9-community-image-streams.json | 458 ++++++++++++++++++++ 1 file changed, 458 insertions(+) create mode 100644 templates/ubi9-community-image-streams.json diff --git a/templates/ubi9-community-image-streams.json b/templates/ubi9-community-image-streams.json new file mode 100644 index 00000000..c1de1edf --- /dev/null +++ b/templates/ubi9-community-image-streams.json @@ -0,0 +1,458 @@ +{ + "kind": "List", + "apiVersion": "v1", + "metadata": { + "name": "ubi9-openjdk-image-stream", + "annotations": { + "description": "ImageStream definition for Red Hat UBI9 OpenJDK.", + "openshift.io/provider-display-name": "Red Hat, Inc." + } + }, + "items": [ + { + "kind": "ImageStream", + "apiVersion": "image.openshift.io/v1", + "metadata": { + "name": "ubi9-openjdk-11", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 11 (UBI9)", + "openshift.io/provider-display-name": "Red Hat, Inc." + } + }, + "spec": { + "tags": [ + { + "name": "1.13", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 11 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 11 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.13" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-11:1.13" + } + }, + { + "name": "1.14", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 11 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 11 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.14" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-11:1.14" + } + }, + { + "name": "1.15", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 11 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 11 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.15" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-11:1.15" + } + }, + { + "name": "1.16", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 11 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 11 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.16" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-11:1.16" + } + }, + { + "name": "1.17", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 11 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 11 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.17" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-11:1.17" + } + }, + { + "name": "1.18", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 11 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 11 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.18" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-11:1.18" + } + } + ] + } + }, +{ + "kind": "ImageStream", + "apiVersion": "image.openshift.io/v1", + "metadata": { + "name": "ubi9-openjdk-17", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 17 (UBI9)", + "openshift.io/provider-display-name": "Red Hat, Inc." + } + }, + "spec": { + "tags": [ + { + "name": "1.13", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 17 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 17 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.13" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-17:1.13" + } + }, + { + "name": "1.14", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 17 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 17 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.14" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-17:1.14" + } + }, + { + "name": "1.15", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 17 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 17 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.15" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-17:1.15" + } + }, + { + "name": "1.16", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 17 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 17 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.16" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-17:1.16" + } + }, + { + "name": "1.17", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 17 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 17 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.17" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-17:1.17" + } + }, + { + "name": "1.18", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 17 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 17 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.18" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-17:1.18" + } + } + ] + } + }, +{ + "kind": "ImageStream", + "apiVersion": "image.openshift.io/v1", + "metadata": { + "name": "ubi9-openjdk-21", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 21 (UBI9)", + "openshift.io/provider-display-name": "Red Hat, Inc." + } + }, + "spec": { + "tags": [ + { + "name": "1.17", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 21 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 21 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.17" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-21:1.17" + } + }, + { + "name": "1.18", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 21 (UBI9)", + "description": "Build and run Java applications using Maven and OpenJDK 21 upon UBI9.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,ubi9", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "1.18" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi9/openjdk-21:1.18" + } + } + ] + } + }, { + "kind": "ImageStream", + "apiVersion": "image.openshift.io/v1", + "metadata": { + "name": "java", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK", + "openshift.io/provider-display-name": "Red Hat, Inc." + } + }, + "spec": { + "tags": [ + { + "name": "openjdk-8-ubi8", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 8 (UBI 8)", + "description": "Build and run Java applications using Maven and OpenJDK 1.8 upon UBI8.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk", + "supports": "java:8,java", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "8" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi8/openjdk-8:latest" + } + }, + { + "name": "8", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 8", + "description": "Build and run Java applications using Maven and OpenJDK 1.8 upon UBI8.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,hidden", + "supports": "java:8,java", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "8" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi8/openjdk-8:latest" + } + }, + { + "name": "openjdk-11-ubi8", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 11 (UBI 8)", + "description": "Build and run Java applications using Maven and OpenJDK 11 upon UBI8.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk", + "supports": "java:11,java", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "11" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi8/openjdk-11:latest" + } + }, + { + "name": "11", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 11", + "description": "Build and run Java applications using Maven and OpenJDK 11 upon UBI8.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk,hidden", + "supports": "java:11,java", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "11" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi8/openjdk-11:latest" + } + }, + { + "name": "openjdk-17-ubi8", + "annotations": { + "openshift.io/display-name": "Red Hat OpenJDK 17 (UBI 8)", + "description": "Build and run Java applications using Maven and OpenJDK 17 upon UBI8.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk", + "supports": "java:17,java", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "17" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "DockerImage", + "name": "registry.access.redhat.com/ubi8/openjdk-17:latest" + } + }, + { + "name": "latest", + "annotations": { + "openshift.io/display-name": "Java (Latest)", + "description": "Build and run Java applications using Maven.", + "iconClass": "icon-rh-openjdk", + "tags": "builder,java,openjdk", + "supports": "java", + "sampleRepo": "https://github.com/jboss-openshift/openshift-quickstarts", + "sampleContextDir": "undertow-servlet", + "version": "latest" + }, + "referencePolicy": { + "type": "Local" + }, + "from": { + "kind": "ImageStreamTag", + "name": "openjdk-17-ubi8" + } + } + ] + } + } + ] +} \ No newline at end of file From e702815b21e2c373c209759cfeb4c09e849f7df8 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 13 Mar 2024 03:32:42 -0400 Subject: [PATCH 040/132] Addressing review feedback --- templates/jlink/jlink-builder/build-imagestreams.sh | 8 +++++++- templates/jlink/jlink-builder/jdk-11-buildconfig.yaml | 7 ++----- templates/jlink/jlink-builder/jdk-17-buildconfig.yaml | 5 +---- templates/jlink/jlink-builder/jdk-21-buildconfig.yaml | 5 +---- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/templates/jlink/jlink-builder/build-imagestreams.sh b/templates/jlink/jlink-builder/build-imagestreams.sh index eae5137a..3cb4730e 100755 --- a/templates/jlink/jlink-builder/build-imagestreams.sh +++ b/templates/jlink/jlink-builder/build-imagestreams.sh @@ -6,4 +6,10 @@ oc create imagestream ubi9-openjdk-$VERSION-jlink # Assuming the buildconfig exists, we can now create the buildconfig oc create -f jdk-$VERSION-buildconfig.yaml -oc start-build jlink-builder-jdk-$VERSION \ No newline at end of file +oc start-build jlink-builder-jdk-$VERSION + +# +# type: Git +# git: +# uri: https://github.com/jmtd/quarkus-quickstarts.git +# contextDir: getting-started \ No newline at end of file diff --git a/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml index 8c84a5f7..e6d6ecb4 100644 --- a/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml +++ b/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml @@ -6,14 +6,11 @@ metadata: app: jlink-builder-jdk-11 spec: source: - type: Git - git: - uri: https://github.com/jmtd/quarkus-quickstarts.git - contextDir: getting-started dockerfile: | - FROM registry.access.redhat.com/ubi9/openjdk-11 AS ubi9-openjdk-11-jmods + FROM - USER 0 RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-11-openjdk-jmods + USER 185 strategy: type: Docker output: diff --git a/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml index 28562dfb..9ed81f03 100644 --- a/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml +++ b/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml @@ -6,14 +6,11 @@ metadata: app: jlink-builder-jdk-17 spec: source: - type: Git - git: - uri: https://github.com/jmtd/quarkus-quickstarts.git - contextDir: getting-started dockerfile: | FROM registry.access.redhat.com/ubi9/openjdk-17 AS ubi9-openjdk-17-jmods USER 0 RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-17-openjdk-jmods + USER 185 strategy: type: Docker output: diff --git a/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml index bbd4d800..c1a689f8 100644 --- a/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml +++ b/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml @@ -6,14 +6,11 @@ metadata: app: jlink-builder-jdk-21 spec: source: - type: Git - git: - uri: https://github.com/jmtd/quarkus-quickstarts.git - contextDir: getting-started dockerfile: | FROM registry.access.redhat.com/ubi9/openjdk-21 AS ubi9-openjdk-21-jmods USER 0 RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-21-openjdk-jmods + USER 185 strategy: type: Docker output: From 4f38d38dc9b467007103023bc55f23fad56f7a04 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 13 Mar 2024 04:06:30 -0400 Subject: [PATCH 041/132] Adding Imagestream definition to buildconfig --- .../jlink/jlink-builder/jdk-11-buildconfig.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml index e6d6ecb4..e775da2c 100644 --- a/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml +++ b/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml @@ -1,3 +1,16 @@ +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + generation: 1 + name: ubi9-openjdk-11-jlink + namespace: default +spec: + lookupPolicy: + local: false +status: + dockerImageRepository: image-registry.openshift-image-registry.svc:5000/default/ubi9-openjdk-11-jlink + publicDockerImageRepository: default-route-openshift-image-registry.apps-crc.testing/default/ubi9-openjdk-11-jlink +--- apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: From 47e70e96b74a661cdf8d6d06782cd77898e667fc Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 20 Mar 2024 03:27:56 -0400 Subject: [PATCH 042/132] Pulling builder image from new ubi9 imagestreams --- templates/jlink/jlink-builder/jdk-11-buildconfig.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml index e775da2c..d7d86ee8 100644 --- a/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml +++ b/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml @@ -10,6 +10,10 @@ spec: status: dockerImageRepository: image-registry.openshift-image-registry.svc:5000/default/ubi9-openjdk-11-jlink publicDockerImageRepository: default-route-openshift-image-registry.apps-crc.testing/default/ubi9-openjdk-11-jlink +parameters: +- description: JDK version to produce a jmods image for + name: JDK_VERSION + value: 11 --- apiVersion: build.openshift.io/v1 kind: BuildConfig @@ -25,7 +29,10 @@ spec: RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-11-openjdk-jmods USER 185 strategy: - type: Docker + dockerStrategy: + from: + kind: ImageStreamTag + name: ubi9-openjdk-11:1.13 output: to: kind: ImageStreamTag From 612d017d089afa435df2863db8d973cb7af41204 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 20 Mar 2024 04:16:23 -0400 Subject: [PATCH 043/132] Rework buildconfigs into a template, add a readme with instructions. --- templates/jlink/jlink-builder/README.md | 56 +++++++++++++++++++ .../jlink/jlink-builder/build-imagestreams.sh | 15 ----- .../jlink-builder/jdk-11-buildconfig.yaml | 40 ------------- .../jlink-builder/jdk-17-buildconfig.yaml | 19 ------- .../jlink-builder/jdk-21-buildconfig.yaml | 19 ------- .../jlink-builder/jlink-builder-template.yaml | 48 ++++++++++++++++ 6 files changed, 104 insertions(+), 93 deletions(-) create mode 100644 templates/jlink/jlink-builder/README.md delete mode 100755 templates/jlink/jlink-builder/build-imagestreams.sh delete mode 100644 templates/jlink/jlink-builder/jdk-11-buildconfig.yaml delete mode 100644 templates/jlink/jlink-builder/jdk-17-buildconfig.yaml delete mode 100644 templates/jlink/jlink-builder/jdk-21-buildconfig.yaml create mode 100644 templates/jlink/jlink-builder/jlink-builder-template.yaml diff --git a/templates/jlink/jlink-builder/README.md b/templates/jlink/jlink-builder/README.md new file mode 100644 index 00000000..b31b13a9 --- /dev/null +++ b/templates/jlink/jlink-builder/README.md @@ -0,0 +1,56 @@ +# OpenShift-JLink PoC + +Try it out: + +## Stage 1: create ubi9 jlink imagestream and push a ubi9 image with jmods installed to it. + +You need: + +1. Access to an OpenShift instance, such as crc + +Steps to produce the imagestream and image: + +1. Switch to the openshift project and install the template + +oc project openshift +oc create -f templates/jlink/jlink-builder/jlink-builder-template.yaml + +This will create a Template called jlink-builder-template, you should see + +template.template.openshift.io/jlink-builder-template created + +and after running oc get template, it should be in the list as + +jlink-builder-template Template to produce an imagestream and buildconfig for a Jlink builder image 1 (all set) 2 + +2. Set the parameters and create the imagestream and buildconfig from the template. + +The template for now defines a single parameter, JDK_VERSION. Setting this will set the version of the builder image used in the BuildConfig. Currently suppoted values are 11, 17, and 21. By default this will be 11. + +oc process --parameters jlink-builder-template + +NAME DESCRIPTION GENERATOR VALUE +JDK_VERSION JDK version to produce a jmods image for 11 + +In order to set the JDK version, you will need to use the -p flag of oc process. To process the template and create the imagestreams, simply run + +oc process -n openshift jlink-builder-template -p JDK_VERSION=11 | oc create -f - + +imagestream.image.openshift.io/ubi9-openjdk-11-jlink created +buildconfig.build.openshift.io/jlink-builder-jdk-11 created + +3. Start and observe the build + +Start the build using + +oc start-build jlink-builder-jdk-11 + +build.build.openshift.io/jlink-builder-jdk-11-1 started + +Then observe it by using + +oc logs -f bc/jlink-builder-jdk-11 + +## Stage 2: build and analyse application with OpenShift source-to-image (S2I) + +TODO \ No newline at end of file diff --git a/templates/jlink/jlink-builder/build-imagestreams.sh b/templates/jlink/jlink-builder/build-imagestreams.sh deleted file mode 100755 index 3cb4730e..00000000 --- a/templates/jlink/jlink-builder/build-imagestreams.sh +++ /dev/null @@ -1,15 +0,0 @@ -eval $(crc oc-env) -VERSION=11 - -# Buildconfigs attempt to push to ubi9-openjdk-$VERSION-jmods, this needs to exist first -oc create imagestream ubi9-openjdk-$VERSION-jlink - -# Assuming the buildconfig exists, we can now create the buildconfig -oc create -f jdk-$VERSION-buildconfig.yaml -oc start-build jlink-builder-jdk-$VERSION - -# -# type: Git -# git: -# uri: https://github.com/jmtd/quarkus-quickstarts.git -# contextDir: getting-started \ No newline at end of file diff --git a/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml deleted file mode 100644 index d7d86ee8..00000000 --- a/templates/jlink/jlink-builder/jdk-11-buildconfig.yaml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: image.openshift.io/v1 -kind: ImageStream -metadata: - generation: 1 - name: ubi9-openjdk-11-jlink - namespace: default -spec: - lookupPolicy: - local: false -status: - dockerImageRepository: image-registry.openshift-image-registry.svc:5000/default/ubi9-openjdk-11-jlink - publicDockerImageRepository: default-route-openshift-image-registry.apps-crc.testing/default/ubi9-openjdk-11-jlink -parameters: -- description: JDK version to produce a jmods image for - name: JDK_VERSION - value: 11 ---- -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: jlink-builder-jdk-11 - labels: - app: jlink-builder-jdk-11 -spec: - source: - dockerfile: | - FROM - - USER 0 - RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-11-openjdk-jmods - USER 185 - strategy: - dockerStrategy: - from: - kind: ImageStreamTag - name: ubi9-openjdk-11:1.13 - output: - to: - kind: ImageStreamTag - name: ubi9-openjdk-11-jlink:latest - diff --git a/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml deleted file mode 100644 index 9ed81f03..00000000 --- a/templates/jlink/jlink-builder/jdk-17-buildconfig.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: jlink-builder-jdk-17 - labels: - app: jlink-builder-jdk-17 -spec: - source: - dockerfile: | - FROM registry.access.redhat.com/ubi9/openjdk-17 AS ubi9-openjdk-17-jmods - USER 0 - RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-17-openjdk-jmods - USER 185 - strategy: - type: Docker - output: - to: - kind: ImageStreamTag - name: ubi9-openjdk-17-jlink:latest \ No newline at end of file diff --git a/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml b/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml deleted file mode 100644 index c1a689f8..00000000 --- a/templates/jlink/jlink-builder/jdk-21-buildconfig.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: build.openshift.io/v1 -kind: BuildConfig -metadata: - name: jlink-builder-jdk-21 - labels: - app: jlink-builder-jdk-21 -spec: - source: - dockerfile: | - FROM registry.access.redhat.com/ubi9/openjdk-21 AS ubi9-openjdk-21-jmods - USER 0 - RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-21-openjdk-jmods - USER 185 - strategy: - type: Docker - output: - to: - kind: ImageStreamTag - name: ubi9-openjdk-21-jlink:latest \ No newline at end of file diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml new file mode 100644 index 00000000..7cc332cf --- /dev/null +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -0,0 +1,48 @@ +--- +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + annotations: + description: Template to produce an imagestream and buildconfig for a Jlink builder image + name: jlink-builder-template + namespace: openshift +objects: +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + generation: 1 + name: ubi9-openjdk-${JDK_VERSION}-jlink + namespace: default + spec: + lookupPolicy: + local: false + status: + dockerImageRepository: image-registry.openshift-image-registry.svc:5000/default/ubi9-openjdk-${JDK_VERSION}-jlink + publicDockerImageRepository: default-route-openshift-image-registry.apps-crc.testing/default/ubi9-openjdk-${JDK_VERSION}-jlink +- apiVersion: build.openshift.io/v1 + kind: BuildConfig + metadata: + name: jlink-builder-jdk-${JDK_VERSION} + labels: + app: jlink-builder-jdk-${JDK_VERSION} + spec: + source: + dockerfile: | + FROM - + USER 0 + RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JDK_VERSION}-openjdk-jmods + USER 185 + strategy: + dockerStrategy: + from: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}:1.18 + output: + to: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}-jlink:latest +parameters: +- description: JDK version to produce a jmods image and imagestream for + name: JDK_VERSION + value: "11" + required: true \ No newline at end of file From 6eba2258a121327311aeb35d53005d1cd429935f Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 20 Mar 2024 13:50:47 +0000 Subject: [PATCH 044/132] README.md: indent code lines, remove ref to namespaces Signed-off-by: Jonathan Dowland --- templates/jlink/jlink-builder/README.md | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/templates/jlink/jlink-builder/README.md b/templates/jlink/jlink-builder/README.md index b31b13a9..4cb4fdef 100644 --- a/templates/jlink/jlink-builder/README.md +++ b/templates/jlink/jlink-builder/README.md @@ -12,45 +12,45 @@ Steps to produce the imagestream and image: 1. Switch to the openshift project and install the template -oc project openshift -oc create -f templates/jlink/jlink-builder/jlink-builder-template.yaml + oc project openshift + oc create -f templates/jlink/jlink-builder/jlink-builder-template.yaml This will create a Template called jlink-builder-template, you should see -template.template.openshift.io/jlink-builder-template created + template.template.openshift.io/jlink-builder-template created and after running oc get template, it should be in the list as -jlink-builder-template Template to produce an imagestream and buildconfig for a Jlink builder image 1 (all set) 2 + jlink-builder-template Template to produce an imagestream and buildconfig for a Jlink builder image 1 (all set) 2 2. Set the parameters and create the imagestream and buildconfig from the template. The template for now defines a single parameter, JDK_VERSION. Setting this will set the version of the builder image used in the BuildConfig. Currently suppoted values are 11, 17, and 21. By default this will be 11. -oc process --parameters jlink-builder-template - -NAME DESCRIPTION GENERATOR VALUE -JDK_VERSION JDK version to produce a jmods image for 11 + oc process --parameters jlink-builder-template + + NAME DESCRIPTION GENERATOR VALUE + JDK_VERSION JDK version to produce a jmods image for 11 In order to set the JDK version, you will need to use the -p flag of oc process. To process the template and create the imagestreams, simply run -oc process -n openshift jlink-builder-template -p JDK_VERSION=11 | oc create -f - - -imagestream.image.openshift.io/ubi9-openjdk-11-jlink created -buildconfig.build.openshift.io/jlink-builder-jdk-11 created + oc process -n openshift jlink-builder-template -p JDK_VERSION=11 | oc create -f - + + imagestream.image.openshift.io/ubi9-openjdk-11-jlink created + buildconfig.build.openshift.io/jlink-builder-jdk-11 created 3. Start and observe the build Start the build using -oc start-build jlink-builder-jdk-11 - -build.build.openshift.io/jlink-builder-jdk-11-1 started + oc start-build jlink-builder-jdk-11 + + build.build.openshift.io/jlink-builder-jdk-11-1 started Then observe it by using -oc logs -f bc/jlink-builder-jdk-11 + oc logs -f bc/jlink-builder-jdk-11 ## Stage 2: build and analyse application with OpenShift source-to-image (S2I) -TODO \ No newline at end of file +TODO From 230f94de79a080aec47ebd632060d6f862bbf350 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 20 Mar 2024 13:51:16 +0000 Subject: [PATCH 045/132] jlink-builder-template: remove some keys that will be autopopulated In particular explicit namespace references Signed-off-by: Jonathan Dowland --- templates/jlink/jlink-builder/jlink-builder-template.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index 7cc332cf..d4b914f1 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -5,20 +5,15 @@ metadata: annotations: description: Template to produce an imagestream and buildconfig for a Jlink builder image name: jlink-builder-template - namespace: openshift objects: - apiVersion: image.openshift.io/v1 kind: ImageStream metadata: generation: 1 name: ubi9-openjdk-${JDK_VERSION}-jlink - namespace: default spec: lookupPolicy: local: false - status: - dockerImageRepository: image-registry.openshift-image-registry.svc:5000/default/ubi9-openjdk-${JDK_VERSION}-jlink - publicDockerImageRepository: default-route-openshift-image-registry.apps-crc.testing/default/ubi9-openjdk-${JDK_VERSION}-jlink - apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: @@ -45,4 +40,4 @@ parameters: - description: JDK version to produce a jmods image and imagestream for name: JDK_VERSION value: "11" - required: true \ No newline at end of file + required: true From fc7258d43ead7d4d36a085c81ddffe35d9bf1626 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 20 Mar 2024 14:16:23 +0000 Subject: [PATCH 046/132] jlink README: remove references to namespaces, prereq + ubi9 images Signed-off-by: Jonathan Dowland --- templates/jlink/jlink-builder/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/jlink/jlink-builder/README.md b/templates/jlink/jlink-builder/README.md index 4cb4fdef..07c05def 100644 --- a/templates/jlink/jlink-builder/README.md +++ b/templates/jlink/jlink-builder/README.md @@ -7,12 +7,14 @@ Try it out: You need: 1. Access to an OpenShift instance, such as crc +2. UBI9 OpenJDK ImageStreams. You can load them from this repository with + + oc create -f templates/ubi9-community-image-streams.json Steps to produce the imagestream and image: -1. Switch to the openshift project and install the template +1. install the template - oc project openshift oc create -f templates/jlink/jlink-builder/jlink-builder-template.yaml This will create a Template called jlink-builder-template, you should see @@ -34,7 +36,7 @@ The template for now defines a single parameter, JDK_VERSION. Setting this will In order to set the JDK version, you will need to use the -p flag of oc process. To process the template and create the imagestreams, simply run - oc process -n openshift jlink-builder-template -p JDK_VERSION=11 | oc create -f - + oc process jlink-builder-template -p JDK_VERSION=11 | oc create -f - imagestream.image.openshift.io/ubi9-openjdk-11-jlink created buildconfig.build.openshift.io/jlink-builder-jdk-11 created From 262e386712d21698a944b41493a785f0b92680fb Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 20 Mar 2024 14:19:23 +0000 Subject: [PATCH 047/132] jlink-builder-template: remove generation: 1 Signed-off-by: Jonathan Dowland --- templates/jlink/jlink-builder/jlink-builder-template.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index d4b914f1..2e4b5cf2 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -9,7 +9,6 @@ objects: - apiVersion: image.openshift.io/v1 kind: ImageStream metadata: - generation: 1 name: ubi9-openjdk-${JDK_VERSION}-jlink spec: lookupPolicy: From ae07f04afbf123aec8da1c74a192ff9678f21312 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 20 Mar 2024 14:19:58 +0000 Subject: [PATCH 048/132] jlink-builder-template: move parameters above objects I think it's slightly clearer (to a human) to see the template's parameters prior to the objects into which they are interpolated. Signed-off-by: Jonathan Dowland --- .../jlink/jlink-builder/jlink-builder-template.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index 2e4b5cf2..e25ee9e3 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -5,6 +5,11 @@ metadata: annotations: description: Template to produce an imagestream and buildconfig for a Jlink builder image name: jlink-builder-template +parameters: +- description: JDK version to produce a jmods image and imagestream for + name: JDK_VERSION + value: "11" + required: true objects: - apiVersion: image.openshift.io/v1 kind: ImageStream @@ -35,8 +40,3 @@ objects: to: kind: ImageStreamTag name: ubi9-openjdk-${JDK_VERSION}-jlink:latest -parameters: -- description: JDK version to produce a jmods image and imagestream for - name: JDK_VERSION - value: "11" - required: true From 5576f04c587b221ca6591f69b7a81a582a8b38d7 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 28 Mar 2024 00:52:13 +0530 Subject: [PATCH 049/132] Make suitable modifications to Dockerfile for 3-phase build template Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/jlink/Dockerfile b/templates/jlink/Dockerfile index e73acebf..a5feb121 100644 --- a/templates/jlink/Dockerfile +++ b/templates/jlink/Dockerfile @@ -2,7 +2,7 @@ #Stage-1: ubi9-jlinked-image is builder image + application + jlinked JVM # install additional system dependencies (for ubi-micro) to /mnt/jrootfs -FROM ubi9-jlinked-image AS ubi9-jlinked-image +FROM quay.io/jdowland/jlink:ubi9-jlinked-image AS ubi9-jlinked-image USER 0 RUN mkdir -p /mnt/jrootfs RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y \ From 22bda43bb96588c13be667ebd3f403efbc2518eb Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 28 Mar 2024 01:04:15 +0530 Subject: [PATCH 050/132] Add buildConfig to get a template for multistage-build Signed-off-by: Jayashree Huttanagoudar --- .../multistage-dockerfile-buildconfig.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 templates/multistage-dockerfile-buildconfig.yaml diff --git a/templates/multistage-dockerfile-buildconfig.yaml b/templates/multistage-dockerfile-buildconfig.yaml new file mode 100644 index 00000000..527cd877 --- /dev/null +++ b/templates/multistage-dockerfile-buildconfig.yaml @@ -0,0 +1,36 @@ +--- +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + annotations: + description: Template to produce a light weight imagestream and buildconfig for a multistage build + name: multistage-build-template +objects: +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: lightweight-image + spec: + lookupPolicy: + local: false +- apiVersion: build.openshift.io/v1 + kind: BuildConfig + metadata: + name: multistage-buildconfig + spec: + source: + type: Git + git: + uri: https://github.com/jhuttana/openjdk.git + ref: phase-4 + contextDir: templates/jlink/ + strategy: + type: Docker + dockerStrategy: + dockerfilePath: Dockerfile + output: + to: + kind: ImageStreamTag + name: lightweight-image:latest # Tag for the final output image + triggers: + - type: ConfigChange From fa066b74840be031e730e66899e54db5141fa65a Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Tue, 2 Apr 2024 01:23:16 +0530 Subject: [PATCH 051/132] Pull in the further changes Signed-off-by: Jayashree Huttanagoudar --- .../multistage-dockerfile-buildconfig.yaml | 55 ++++++++++++++++--- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/templates/multistage-dockerfile-buildconfig.yaml b/templates/multistage-dockerfile-buildconfig.yaml index 527cd877..5d2a204e 100644 --- a/templates/multistage-dockerfile-buildconfig.yaml +++ b/templates/multistage-dockerfile-buildconfig.yaml @@ -6,6 +6,24 @@ metadata: description: Template to produce a light weight imagestream and buildconfig for a multistage build name: multistage-build-template objects: +############################################################################## +# the INPUT ImageStream (from phase 2) +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: intermediate + spec: + lookupPolicy: + local: true + tags: + - from: + kind: DockerImage + name: quay.io/jdowland/jlink:ubi9-jlinked-image + name: latest + referencePolicy: + type: Local +############################################################################## +# the OUTPUT ImageStream - apiVersion: image.openshift.io/v1 kind: ImageStream metadata: @@ -13,21 +31,44 @@ objects: spec: lookupPolicy: local: false +############################################################################## - apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: name: multistage-buildconfig spec: source: - type: Git - git: - uri: https://github.com/jhuttana/openjdk.git - ref: phase-4 - contextDir: templates/jlink/ + images: + - from: + kind: ImageStreamTag + name: intermediate:latest + paths: +# path does not exist in intermediate image, yet +# - sourcePath: /mnt/jrootfs +# destinationDir: jrootfs + - sourcePath: /deployments + destinationDir: deployments + - sourcePath: /tmp/jre/. + destinationDir: customJVM + - sourcePath: /opt/jboss/container/. + destinationDir: runScripts + type: Dockerfile + dockerfile: | + FROM registry.access.redhat.com/ubi9/ubi-micro + ARG JAVA_HOME=/usr/lib/jvm/java + + #COPY jrootfs/ / + COPY deployments / + COPY customJVM ${JAVA_HOME} + COPY runScripts /opt/jboss/container/ + # these are in the micro image + RUN rm -rf /var/lib/dnf /var/lib/rpm + + ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH" + USER 185 + CMD /opt/jboss/container/java/run/run-java.sh strategy: type: Docker - dockerStrategy: - dockerfilePath: Dockerfile output: to: kind: ImageStreamTag From ad2fe97963e2aae580731abd81ff4a79804eddb4 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Tue, 2 Apr 2024 14:47:47 +0530 Subject: [PATCH 052/132] Move grep and gawk installation to phase-1 Signed-off-by: Jayashree Huttanagoudar --- .../jlink/jlink-builder/jlink-builder-template.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index e25ee9e3..117d7264 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -29,7 +29,15 @@ objects: dockerfile: | FROM - USER 0 - RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JDK_VERSION}-openjdk-jmods + RUN mkdir -p /mnt/jrootfs + RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y java-${JDK_VERSION}-openjdk-jmods \ + --config=/etc/dnf/dnf.conf \ + --noplugins \ + --setopt=cachedir=/var/cache \ + --setopt=reposdir=/etc/yum.repos.d \ + --setopt=varsdir=/etc/dnf/vars \ + grep gawk + RUN rm -rf /mnt/jrootfs/var/cache/* /mnt/jrootfs/var/lib/rpm /mnt/jrootfs/var/lib/dnf USER 185 strategy: dockerStrategy: From e80dbc2be662f6e500ff507d578d18e174ca4e1f Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Tue, 2 Apr 2024 18:48:27 +0530 Subject: [PATCH 053/132] Address review comments Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlink-builder/jlink-builder-template.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index 117d7264..e6297c28 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -29,6 +29,7 @@ objects: dockerfile: | FROM - USER 0 + RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JDK_VERSION}-openjdk-jmods RUN mkdir -p /mnt/jrootfs RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y java-${JDK_VERSION}-openjdk-jmods \ --config=/etc/dnf/dnf.conf \ From 724f549c565d71a26002d3d981a57eb33a510566 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Tue, 2 Apr 2024 23:04:26 +0530 Subject: [PATCH 054/132] Address review comments for jmods rpm Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlink-builder/jlink-builder-template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index e6297c28..56104542 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -31,7 +31,7 @@ objects: USER 0 RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JDK_VERSION}-openjdk-jmods RUN mkdir -p /mnt/jrootfs - RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y java-${JDK_VERSION}-openjdk-jmods \ + RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y \ --config=/etc/dnf/dnf.conf \ --noplugins \ --setopt=cachedir=/var/cache \ From 39c2f5eb285b344f4b8049d24ff485ad9122b5e3 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Wed, 3 Apr 2024 17:08:58 +0530 Subject: [PATCH 055/132] Uncomment jrootfs lines and undo the changes to Dockerfile Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/Dockerfile | 2 +- templates/multistage-dockerfile-buildconfig.yaml | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/templates/jlink/Dockerfile b/templates/jlink/Dockerfile index a5feb121..e73acebf 100644 --- a/templates/jlink/Dockerfile +++ b/templates/jlink/Dockerfile @@ -2,7 +2,7 @@ #Stage-1: ubi9-jlinked-image is builder image + application + jlinked JVM # install additional system dependencies (for ubi-micro) to /mnt/jrootfs -FROM quay.io/jdowland/jlink:ubi9-jlinked-image AS ubi9-jlinked-image +FROM ubi9-jlinked-image AS ubi9-jlinked-image USER 0 RUN mkdir -p /mnt/jrootfs RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y \ diff --git a/templates/multistage-dockerfile-buildconfig.yaml b/templates/multistage-dockerfile-buildconfig.yaml index 5d2a204e..922990d4 100644 --- a/templates/multistage-dockerfile-buildconfig.yaml +++ b/templates/multistage-dockerfile-buildconfig.yaml @@ -43,9 +43,8 @@ objects: kind: ImageStreamTag name: intermediate:latest paths: -# path does not exist in intermediate image, yet -# - sourcePath: /mnt/jrootfs -# destinationDir: jrootfs + - sourcePath: /mnt/jrootfs + destinationDir: jrootfs - sourcePath: /deployments destinationDir: deployments - sourcePath: /tmp/jre/. @@ -57,7 +56,7 @@ objects: FROM registry.access.redhat.com/ubi9/ubi-micro ARG JAVA_HOME=/usr/lib/jvm/java - #COPY jrootfs/ / + COPY jrootfs/ / COPY deployments / COPY customJVM ${JAVA_HOME} COPY runScripts /opt/jboss/container/ From 29fa4d420ddd455a1e5df6929b9328ad341b74a5 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 3 Apr 2024 20:00:54 -0400 Subject: [PATCH 056/132] Stage 2 initial implementation --- .../jlink-builder/jlink-builder-template.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index 56104542..caef411e 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -10,6 +10,15 @@ parameters: name: JDK_VERSION value: "11" required: true +- description: Application to run the jlink workflow on + name: APPLICATION + required: true +- description: Git Ref to run the jlink workflow on + name: REF + required: true +- description: Context Dir to use for the jlink workflow + name: CONTEXT_DIR + required: true objects: - apiVersion: image.openshift.io/v1 kind: ImageStream @@ -49,3 +58,31 @@ objects: to: kind: ImageStreamTag name: ubi9-openjdk-${JDK_VERSION}-jlink:latest +- apiVersion: build.openshift.io/v1 + kind: BuildConfig + metadata: + name: jlink-s2i-jdk-${JDK_VERSION} + labels: + app: jlink-s2i-jdk-${JDK_VERSION} + spec: + source: + type: Git + git: + uri: ${APPLICATION} + ref: ${REF} + contextDir: ${CONTEXT_DIR} + strategy: + sourceStrategy: + from: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream for Stage 1 + pullPolicy: Always + env: + - name: S2I_ENABLE_JLINK + value: true + - name: LOGGING_SCRIPT_DEBUG + value: true + output: + to: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}-jlink:latest From 7d669fbe5187f1731388d04a6c95988a89408262 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 4 Apr 2024 10:51:38 +0100 Subject: [PATCH 057/132] stage2: Add an intermediate ImageStream and output to it Signed-off-by: Jonathan Dowland --- .../jlink/jlink-builder/jlink-builder-template.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index caef411e..cb1e3525 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -58,6 +58,13 @@ objects: to: kind: ImageStreamTag name: ubi9-openjdk-${JDK_VERSION}-jlink:latest +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: intermediate + spec: + lookupPolicy: + local: false - apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: @@ -85,4 +92,4 @@ objects: output: to: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}-jlink:latest + name: intermediate:latest From 0970d20d6218d8a9be7144ea35b312b2dab0af63 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 4 Apr 2024 10:52:22 +0100 Subject: [PATCH 058/132] stage2: fix indentation and quote "true" quote "true" to avoid OpenShift trying to interpret it as a Boolean type. Signed-off-by: Jonathan Dowland --- .../jlink-builder/jlink-builder-template.yaml | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index cb1e3525..c122e2ea 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -74,21 +74,21 @@ objects: spec: source: type: Git - git: - uri: ${APPLICATION} - ref: ${REF} - contextDir: ${CONTEXT_DIR} - strategy: - sourceStrategy: - from: - kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream for Stage 1 - pullPolicy: Always - env: - - name: S2I_ENABLE_JLINK - value: true - - name: LOGGING_SCRIPT_DEBUG - value: true + git: + uri: ${APPLICATION} + ref: ${REF} + contextDir: ${CONTEXT_DIR} + strategy: + sourceStrategy: + from: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream for Stage 1 + pullPolicy: Always + env: + - name: S2I_ENABLE_JLINK + value: "true" + - name: LOGGING_SCRIPT_DEBUG + value: "true" output: to: kind: ImageStreamTag From 904e4b931a66d28cb3eec4e3c6c475d08cf9ce39 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Thu, 4 Apr 2024 16:52:51 +0530 Subject: [PATCH 059/132] Copy only the contents of jrootfs Signed-off-by: Jayashree Huttanagoudar --- templates/multistage-dockerfile-buildconfig.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/multistage-dockerfile-buildconfig.yaml b/templates/multistage-dockerfile-buildconfig.yaml index 922990d4..a7f5d249 100644 --- a/templates/multistage-dockerfile-buildconfig.yaml +++ b/templates/multistage-dockerfile-buildconfig.yaml @@ -56,7 +56,7 @@ objects: FROM registry.access.redhat.com/ubi9/ubi-micro ARG JAVA_HOME=/usr/lib/jvm/java - COPY jrootfs/ / + COPY jrootfs/* / COPY deployments / COPY customJVM ${JAVA_HOME} COPY runScripts /opt/jboss/container/ From 061dd82aff32f82df9123050fc76f3ca3ffa11ea Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Fri, 5 Apr 2024 13:06:10 +0530 Subject: [PATCH 060/132] Add imageStream needed for ubi-micro [OPENJDK-2896] Signed-off-by: Jayashree Huttanagoudar --- .../multistage-dockerfile-buildconfig.yaml | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/templates/multistage-dockerfile-buildconfig.yaml b/templates/multistage-dockerfile-buildconfig.yaml index a7f5d249..56c019f3 100644 --- a/templates/multistage-dockerfile-buildconfig.yaml +++ b/templates/multistage-dockerfile-buildconfig.yaml @@ -23,6 +23,22 @@ objects: referencePolicy: type: Local ############################################################################## +# the ubi-micro ImageStream +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: ubimicro + spec: + lookupPolicy: + local: true + tags: + - from: + kind: DockerImage + name: registry.access.redhat.com/ubi9/ubi-micro + name: latest + referencePolicy: + type: Local +############################################################################## # the OUTPUT ImageStream - apiVersion: image.openshift.io/v1 kind: ImageStream @@ -53,7 +69,7 @@ objects: destinationDir: runScripts type: Dockerfile dockerfile: | - FROM registry.access.redhat.com/ubi9/ubi-micro + FROM - ARG JAVA_HOME=/usr/lib/jvm/java COPY jrootfs/* / @@ -68,9 +84,23 @@ objects: CMD /opt/jboss/container/java/run/run-java.sh strategy: type: Docker + dockerStrategy: + from: + kind: ImageStreamTag + name: ubimicro:latest output: to: kind: ImageStreamTag name: lightweight-image:latest # Tag for the final output image triggers: - type: ConfigChange + - type: ImageChange + imageChange: + from: + kind: ImageStreamTag + name: intermediate:latest # ImageStreamTag for phase-2 output + - type: ImageChange + imageChange: + from: + kind: ImageStreamTag + name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro From d34ca878cd9ee754f5712b5818800c6ced3e34ee Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Mon, 8 Apr 2024 16:19:43 +0530 Subject: [PATCH 061/132] Merge all 3-templates into one Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlinked-app.yaml | 190 +++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 templates/jlink/jlinked-app.yaml diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml new file mode 100644 index 00000000..439fbc95 --- /dev/null +++ b/templates/jlink/jlinked-app.yaml @@ -0,0 +1,190 @@ +--- +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + annotations: + description: Template to produce imagestreams and buildconfigs for jlinked application + name: jlink-app-template +############################################################################## +# List of parameters required to create template +parameters: +- description: JDK version to produce a jmods image and imagestream for + name: JDK_VERSION + value: "11" + required: true +- description: Application to run the jlink workflow on + name: APP_URI + required: true +- description: Git Ref to run the jlink workflow on + name: REF + required: true +- description: Context Dir to use for the jlink workflow + name: CONTEXT_DIR + required: true +############################################################################## +# Following are the objects(imagestream and buildconfigs) for all the 3-stages +objects: +############################################################################## +# stage-1: Output ImageStream +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: ubi9-openjdk-${JDK_VERSION}-jlink + spec: + lookupPolicy: + local: false +############################################################################## +# stage-1: BuildConfig +- apiVersion: build.openshift.io/v1 + kind: BuildConfig + metadata: + name: jlink-builder-jdk-${JDK_VERSION} + labels: + app: jlink-builder-jdk-${JDK_VERSION} + spec: + source: + dockerfile: | + FROM - + USER 0 + RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JDK_VERSION}-openjdk-jmods + RUN mkdir -p /mnt/jrootfs + RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y \ + --config=/etc/dnf/dnf.conf \ + --noplugins \ + --setopt=cachedir=/var/cache \ + --setopt=reposdir=/etc/yum.repos.d \ + --setopt=varsdir=/etc/dnf/vars \ + grep gawk + RUN rm -rf /mnt/jrootfs/var/cache/* /mnt/jrootfs/var/lib/rpm /mnt/jrootfs/var/lib/dnf + USER 185 + strategy: + dockerStrategy: + from: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}:1.18 # Refer README.md to create this ImageStream + output: + to: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}-jlink:latest +############################################################################## +# stage-2: Output ImageStream +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: intermediate + spec: + lookupPolicy: + local: false +############################################################################## +# stage-2: BuildConfig +- apiVersion: build.openshift.io/v1 + kind: BuildConfig + metadata: + name: jlink-s2i-jdk-${JDK_VERSION} + labels: + app: jlink-s2i-jdk-${JDK_VERSION} + spec: + source: + type: Git + git: + uri: ${APP_URI} + ref: ${REF} + contextDir: ${CONTEXT_DIR} + strategy: + sourceStrategy: + from: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream from stage-1 + pullPolicy: Always + env: + - name: S2I_ENABLE_JLINK + value: "true" + - name: LOGGING_SCRIPT_DEBUG + value: "true" + output: + to: + kind: ImageStreamTag + name: intermediate:latest +############################################################################## +# stage-3: The ubi-micro ImageStream +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: ubimicro + spec: + lookupPolicy: + local: true + tags: + - from: + kind: DockerImage + name: registry.access.redhat.com/ubi9/ubi-micro + name: latest + referencePolicy: + type: Local +############################################################################## +# stage-3: Output ImageStream +- apiVersion: image.openshift.io/v1 + kind: ImageStream + metadata: + name: lightweight-image + spec: + lookupPolicy: + local: false +############################################################################## +# stage-3: BuildConfig +- apiVersion: build.openshift.io/v1 + kind: BuildConfig + metadata: + name: multistage-buildconfig + spec: + source: + images: + - from: + kind: ImageStreamTag + name: intermediate:latest + paths: + - sourcePath: /mnt/jrootfs + destinationDir: jrootfs + - sourcePath: /deployments + destinationDir: deployments + - sourcePath: /tmp/jre/. + destinationDir: customJVM + - sourcePath: /opt/jboss/container/. + destinationDir: runScripts + type: Dockerfile + dockerfile: | + FROM - + ARG JAVA_HOME=/usr/lib/jvm/java + + COPY jrootfs/* / + COPY deployments / + COPY customJVM ${JAVA_HOME} + COPY runScripts /opt/jboss/container/ + # these are in the micro image + RUN rm -rf /var/lib/dnf /var/lib/rpm + + ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH" + USER 185 + CMD /opt/jboss/container/java/run/run-java.sh + strategy: + type: Docker + dockerStrategy: + from: + kind: ImageStreamTag + name: ubimicro:latest + output: + to: + kind: ImageStreamTag + name: lightweight-image:latest # Tag for the final output image +# triggers: +# - type: ConfigChange +# - type: ImageChange +# imageChange: +# from: +# kind: ImageStreamTag +# name: intermediate:latest # output of stage-2 +# - type: ImageChange +# imageChange: +# from: +# kind: ImageStreamTag +# name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro From bc76f735ed10557423122b71b205f1ec9d3be81c Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Mon, 8 Apr 2024 18:35:33 +0530 Subject: [PATCH 062/132] Address review comments - Indent `output` section in stage-2 - Indent `output` section in merged version of jlink-builder-template.yaml - Uncomment `trigger` section Signed-off-by: Jayashree Huttanagoudar --- .../jlink-builder/jlink-builder-template.yaml | 8 ++--- templates/jlink/jlinked-app.yaml | 32 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml index c122e2ea..2eb251b6 100644 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ b/templates/jlink/jlink-builder/jlink-builder-template.yaml @@ -89,7 +89,7 @@ objects: value: "true" - name: LOGGING_SCRIPT_DEBUG value: "true" - output: - to: - kind: ImageStreamTag - name: intermediate:latest + output: + to: + kind: ImageStreamTag + name: intermediate:latest diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 439fbc95..7f041a72 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -101,10 +101,10 @@ objects: value: "true" - name: LOGGING_SCRIPT_DEBUG value: "true" - output: - to: - kind: ImageStreamTag - name: intermediate:latest + output: + to: + kind: ImageStreamTag + name: intermediate:latest ############################################################################## # stage-3: The ubi-micro ImageStream - apiVersion: image.openshift.io/v1 @@ -176,15 +176,15 @@ objects: to: kind: ImageStreamTag name: lightweight-image:latest # Tag for the final output image -# triggers: -# - type: ConfigChange -# - type: ImageChange -# imageChange: -# from: -# kind: ImageStreamTag -# name: intermediate:latest # output of stage-2 -# - type: ImageChange -# imageChange: -# from: -# kind: ImageStreamTag -# name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro + triggers: + - type: ConfigChange + - type: ImageChange + imageChange: + from: + kind: ImageStreamTag + name: intermediate:latest # output of stage-2 + - type: ImageChange + imageChange: + from: + kind: ImageStreamTag + name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro From df69487f6aaa27a7d663998e039eb0c414087ca3 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Mon, 8 Apr 2024 18:41:19 +0530 Subject: [PATCH 063/132] Delete jlink-builder-template.yaml and multistage-dockerfile-buildconfig.yaml Signed-off-by: Jayashree Huttanagoudar --- .../jlink-builder/jlink-builder-template.yaml | 95 ---------------- .../multistage-dockerfile-buildconfig.yaml | 106 ------------------ 2 files changed, 201 deletions(-) delete mode 100644 templates/jlink/jlink-builder/jlink-builder-template.yaml delete mode 100644 templates/multistage-dockerfile-buildconfig.yaml diff --git a/templates/jlink/jlink-builder/jlink-builder-template.yaml b/templates/jlink/jlink-builder/jlink-builder-template.yaml deleted file mode 100644 index 2eb251b6..00000000 --- a/templates/jlink/jlink-builder/jlink-builder-template.yaml +++ /dev/null @@ -1,95 +0,0 @@ ---- -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - annotations: - description: Template to produce an imagestream and buildconfig for a Jlink builder image - name: jlink-builder-template -parameters: -- description: JDK version to produce a jmods image and imagestream for - name: JDK_VERSION - value: "11" - required: true -- description: Application to run the jlink workflow on - name: APPLICATION - required: true -- description: Git Ref to run the jlink workflow on - name: REF - required: true -- description: Context Dir to use for the jlink workflow - name: CONTEXT_DIR - required: true -objects: -- apiVersion: image.openshift.io/v1 - kind: ImageStream - metadata: - name: ubi9-openjdk-${JDK_VERSION}-jlink - spec: - lookupPolicy: - local: false -- apiVersion: build.openshift.io/v1 - kind: BuildConfig - metadata: - name: jlink-builder-jdk-${JDK_VERSION} - labels: - app: jlink-builder-jdk-${JDK_VERSION} - spec: - source: - dockerfile: | - FROM - - USER 0 - RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JDK_VERSION}-openjdk-jmods - RUN mkdir -p /mnt/jrootfs - RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y \ - --config=/etc/dnf/dnf.conf \ - --noplugins \ - --setopt=cachedir=/var/cache \ - --setopt=reposdir=/etc/yum.repos.d \ - --setopt=varsdir=/etc/dnf/vars \ - grep gawk - RUN rm -rf /mnt/jrootfs/var/cache/* /mnt/jrootfs/var/lib/rpm /mnt/jrootfs/var/lib/dnf - USER 185 - strategy: - dockerStrategy: - from: - kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}:1.18 - output: - to: - kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}-jlink:latest -- apiVersion: image.openshift.io/v1 - kind: ImageStream - metadata: - name: intermediate - spec: - lookupPolicy: - local: false -- apiVersion: build.openshift.io/v1 - kind: BuildConfig - metadata: - name: jlink-s2i-jdk-${JDK_VERSION} - labels: - app: jlink-s2i-jdk-${JDK_VERSION} - spec: - source: - type: Git - git: - uri: ${APPLICATION} - ref: ${REF} - contextDir: ${CONTEXT_DIR} - strategy: - sourceStrategy: - from: - kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream for Stage 1 - pullPolicy: Always - env: - - name: S2I_ENABLE_JLINK - value: "true" - - name: LOGGING_SCRIPT_DEBUG - value: "true" - output: - to: - kind: ImageStreamTag - name: intermediate:latest diff --git a/templates/multistage-dockerfile-buildconfig.yaml b/templates/multistage-dockerfile-buildconfig.yaml deleted file mode 100644 index 56c019f3..00000000 --- a/templates/multistage-dockerfile-buildconfig.yaml +++ /dev/null @@ -1,106 +0,0 @@ ---- -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - annotations: - description: Template to produce a light weight imagestream and buildconfig for a multistage build - name: multistage-build-template -objects: -############################################################################## -# the INPUT ImageStream (from phase 2) -- apiVersion: image.openshift.io/v1 - kind: ImageStream - metadata: - name: intermediate - spec: - lookupPolicy: - local: true - tags: - - from: - kind: DockerImage - name: quay.io/jdowland/jlink:ubi9-jlinked-image - name: latest - referencePolicy: - type: Local -############################################################################## -# the ubi-micro ImageStream -- apiVersion: image.openshift.io/v1 - kind: ImageStream - metadata: - name: ubimicro - spec: - lookupPolicy: - local: true - tags: - - from: - kind: DockerImage - name: registry.access.redhat.com/ubi9/ubi-micro - name: latest - referencePolicy: - type: Local -############################################################################## -# the OUTPUT ImageStream -- apiVersion: image.openshift.io/v1 - kind: ImageStream - metadata: - name: lightweight-image - spec: - lookupPolicy: - local: false -############################################################################## -- apiVersion: build.openshift.io/v1 - kind: BuildConfig - metadata: - name: multistage-buildconfig - spec: - source: - images: - - from: - kind: ImageStreamTag - name: intermediate:latest - paths: - - sourcePath: /mnt/jrootfs - destinationDir: jrootfs - - sourcePath: /deployments - destinationDir: deployments - - sourcePath: /tmp/jre/. - destinationDir: customJVM - - sourcePath: /opt/jboss/container/. - destinationDir: runScripts - type: Dockerfile - dockerfile: | - FROM - - ARG JAVA_HOME=/usr/lib/jvm/java - - COPY jrootfs/* / - COPY deployments / - COPY customJVM ${JAVA_HOME} - COPY runScripts /opt/jboss/container/ - # these are in the micro image - RUN rm -rf /var/lib/dnf /var/lib/rpm - - ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH" - USER 185 - CMD /opt/jboss/container/java/run/run-java.sh - strategy: - type: Docker - dockerStrategy: - from: - kind: ImageStreamTag - name: ubimicro:latest - output: - to: - kind: ImageStreamTag - name: lightweight-image:latest # Tag for the final output image - triggers: - - type: ConfigChange - - type: ImageChange - imageChange: - from: - kind: ImageStreamTag - name: intermediate:latest # ImageStreamTag for phase-2 output - - type: ImageChange - imageChange: - from: - kind: ImageStreamTag - name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro From 6007bd4c5df258a3366b2361738fe27525bf69cb Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Wed, 10 Apr 2024 16:12:43 +0530 Subject: [PATCH 064/132] Delete multistage docker build sources from templates/jlink/ and also templates/jlink/jlink-builder/ Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/Dockerfile | 30 ---------- templates/jlink/README.md | 74 +++++++++++++------------ templates/jlink/jlink-builder/README.md | 58 ------------------- 3 files changed, 38 insertions(+), 124 deletions(-) delete mode 100644 templates/jlink/Dockerfile delete mode 100644 templates/jlink/jlink-builder/README.md diff --git a/templates/jlink/Dockerfile b/templates/jlink/Dockerfile deleted file mode 100644 index e73acebf..00000000 --- a/templates/jlink/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -#multi-stage build for jlinked application JAR and JRE - -#Stage-1: ubi9-jlinked-image is builder image + application + jlinked JVM -# install additional system dependencies (for ubi-micro) to /mnt/jrootfs -FROM ubi9-jlinked-image AS ubi9-jlinked-image -USER 0 -RUN mkdir -p /mnt/jrootfs -RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y \ - --config=/etc/dnf/dnf.conf \ - --noplugins \ - --setopt=cachedir=/var/cache \ - --setopt=reposdir=/etc/yum.repos.d \ - --setopt=varsdir=/etc/dnf/vars \ - grep gawk -RUN rm -rf /mnt/jrootfs/var/cache/* /mnt/jrootfs/var/lib/rpm /mnt/jrootfs/var/lib/dnf - -#Stage-2:copy application JAR and jlinked JRE to runtime image -FROM registry.access.redhat.com/ubi9/ubi-micro AS lean-runtime -ARG JAVA_HOME=/usr/lib/jvm/java - -COPY --from=ubi9-jlinked-image /mnt/jrootfs/ / -COPY --from=ubi9-jlinked-image /deployments /deployments -COPY --from=ubi9-jlinked-image /tmp/jre ${JAVA_HOME} -COPY --from=ubi9-jlinked-image /opt/jboss/container/ /opt/jboss/container/ -# these are in the micro image -RUN rm -rf /var/lib/dnf /var/lib/rpm - -ENV JAVA_HOME="${JAVA_HOME}" PATH="${JAVA_HOME}/bin:$PATH" -USER 185 -CMD /opt/jboss/container/java/run/run-java.sh diff --git a/templates/jlink/README.md b/templates/jlink/README.md index f453d0f7..07c05def 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -2,55 +2,57 @@ Try it out: -## Stage 1: build and analyse application with OpenShift source-to-image (S2I) +## Stage 1: create ubi9 jlink imagestream and push a ubi9 image with jmods installed to it. You need: -1. Access to an OpenShift instance, or, use [the s2i standalone program](https://github.com/openshift/source-to-image) - * _([you might need to use an old version](https://github.com/openshift/source-to-image/issues/1135))_ -2. The OpenJDK builder image (with the customisations from the `jlink-dev` branch). - There's one at `quay.io/jdowland/jlink:latest` -3. A quickstart ([there's a specially-prepared Quarkus quickstart](https://github.com/jmtd/quarkus-quickstarts/tree/OPENJDK-631-fastjar-layout); - in the future [the mainline Quarkus quickstarts will be suitable](https://github.com/quarkusio/quarkus-quickstarts/pull/1359)) +1. Access to an OpenShift instance, such as crc +2. UBI9 OpenJDK ImageStreams. You can load them from this repository with -Here's a recipe using local `s2i` + oc create -f templates/ubi9-community-image-streams.json -``` -BASEIMG=quay.io/jdowland/jlink:latest -APPSRC=https://github.com/jmtd/quarkus-quickstarts.git -CONTEXTDIR=getting-started -REV=OPENJDK-631-fastjar-layout -OUTIMG=ubi9-jlinked-image +Steps to produce the imagestream and image: -s2i build --pull-policy never --context-dir=${CONTEXTDIR} -r=${REV} \ - -e QUARKUS_PACKAGE_TYPE=uber-jar \ - -e S2I_ENABLE_JLINK=true \ - ${APPSRC} \ - ${BASEIMG} \ - ${OUTIMG} -``` +1. install the template -## Stage 2: multi-stage build to assemble micro runtime + oc create -f templates/jlink/jlink-builder/jlink-builder-template.yaml -You need: +This will create a Template called jlink-builder-template, you should see + + template.template.openshift.io/jlink-builder-template created + +and after running oc get template, it should be in the list as + + jlink-builder-template Template to produce an imagestream and buildconfig for a Jlink builder image 1 (all set) 2 + +2. Set the parameters and create the imagestream and buildconfig from the template. + +The template for now defines a single parameter, JDK_VERSION. Setting this will set the version of the builder image used in the BuildConfig. Currently suppoted values are 11, 17, and 21. By default this will be 11. + + oc process --parameters jlink-builder-template + + NAME DESCRIPTION GENERATOR VALUE + JDK_VERSION JDK version to produce a jmods image for 11 + +In order to set the JDK version, you will need to use the -p flag of oc process. To process the template and create the imagestreams, simply run -1. The output image from the first stage - * _here's one we made earlier: `quay.io/jdowland/jlink:quarkus-getting-started`_ -2. OpenShift, or a container runtime (e.g. Docker) -3. [this Dockerfile](Dockerfile) (In future this is an OpenShift template) + oc process jlink-builder-template -p JDK_VERSION=11 | oc create -f - + + imagestream.image.openshift.io/ubi9-openjdk-11-jlink created + buildconfig.build.openshift.io/jlink-builder-jdk-11 created -With docker, from a clone of this repository, in this directory: +3. Start and observe the build -``` -docker build -t myapp -f . -``` +Start the build using -## Stage 3: try it out! + oc start-build jlink-builder-jdk-11 + + build.build.openshift.io/jlink-builder-jdk-11-1 started -Does it work? +Then observe it by using - docker run --rm -ti -p 8080 myapp + oc logs -f bc/jlink-builder-jdk-11 -How big is it? +## Stage 2: build and analyse application with OpenShift source-to-image (S2I) - docker inspect -f '{{.Size}}' myapp +TODO diff --git a/templates/jlink/jlink-builder/README.md b/templates/jlink/jlink-builder/README.md deleted file mode 100644 index 07c05def..00000000 --- a/templates/jlink/jlink-builder/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# OpenShift-JLink PoC - -Try it out: - -## Stage 1: create ubi9 jlink imagestream and push a ubi9 image with jmods installed to it. - -You need: - -1. Access to an OpenShift instance, such as crc -2. UBI9 OpenJDK ImageStreams. You can load them from this repository with - - oc create -f templates/ubi9-community-image-streams.json - -Steps to produce the imagestream and image: - -1. install the template - - oc create -f templates/jlink/jlink-builder/jlink-builder-template.yaml - -This will create a Template called jlink-builder-template, you should see - - template.template.openshift.io/jlink-builder-template created - -and after running oc get template, it should be in the list as - - jlink-builder-template Template to produce an imagestream and buildconfig for a Jlink builder image 1 (all set) 2 - -2. Set the parameters and create the imagestream and buildconfig from the template. - -The template for now defines a single parameter, JDK_VERSION. Setting this will set the version of the builder image used in the BuildConfig. Currently suppoted values are 11, 17, and 21. By default this will be 11. - - oc process --parameters jlink-builder-template - - NAME DESCRIPTION GENERATOR VALUE - JDK_VERSION JDK version to produce a jmods image for 11 - -In order to set the JDK version, you will need to use the -p flag of oc process. To process the template and create the imagestreams, simply run - - oc process jlink-builder-template -p JDK_VERSION=11 | oc create -f - - - imagestream.image.openshift.io/ubi9-openjdk-11-jlink created - buildconfig.build.openshift.io/jlink-builder-jdk-11 created - -3. Start and observe the build - -Start the build using - - oc start-build jlink-builder-jdk-11 - - build.build.openshift.io/jlink-builder-jdk-11-1 started - -Then observe it by using - - oc logs -f bc/jlink-builder-jdk-11 - -## Stage 2: build and analyse application with OpenShift source-to-image (S2I) - -TODO From 60b982050968a2aeaffc203850d85e92b3d82fde Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Fri, 12 Apr 2024 11:01:02 +0100 Subject: [PATCH 065/132] [OPENJDK-2897] Refresh jlink README Update the template README to explain how to use it. https://issues.redhat.com/browse/OPENJDK-2897 Signed-off-by: Jonathan Dowland --- templates/jlink/README.md | 77 ++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 07c05def..d41a453f 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -1,58 +1,67 @@ -# OpenShift-JLink PoC +# OpenShift Jlink integration (Tech Preview) -Try it out: +To try it out, +you need: -## Stage 1: create ubi9 jlink imagestream and push a ubi9 image with jmods installed to it. +1. Access to an OpenShift instance, such as [OpenShift Local](https://developers.redhat.com/products/openshift-local/overview) +2. UBI9 OpenJDK ImageStreams that include `jlink-dev` changes (see below) +3. The template [jlinked-app.yaml](jlinked-app.yaml). -You need: +## Stage 0: UBI9 OpenJDK ImageStreams with jlink-dev changes -1. Access to an OpenShift instance, such as crc -2. UBI9 OpenJDK ImageStreams. You can load them from this repository with +Until the `jlink-dev` work is merged, prior to trying out the template, we must first +prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. - oc create -f templates/ubi9-community-image-streams.json +1. Build a suitable OpenJDK container image from [this + repository](https://github.com/jboss-container-images/openjdk), + branch `jlink-dev`. e.g. -Steps to produce the imagestream and image: + cekit --descriptor ubi9-openjdk-17.yaml build docker -1. install the template +2. Within your OpenShift project, - oc create -f templates/jlink/jlink-builder/jlink-builder-template.yaml + oc create imagestream ubi9-openjdk-17 -This will create a Template called jlink-builder-template, you should see +3. Log into the OpenShift registry, e.g. - template.template.openshift.io/jlink-builder-template created + REGISTRY_AUTH_PREFERENCE=docker oc registry login -and after running oc get template, it should be in the list as +4. tag and push the dev image into it. The OpenShift console gives you the + exact URI for your instance - jlink-builder-template Template to produce an imagestream and buildconfig for a Jlink builder image 1 (all set) 2 + docker tag ubi9/openjdk-17:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 + docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 -2. Set the parameters and create the imagestream and buildconfig from the template. +## Stage 1: Load the template into OpenShift and instantiate it -The template for now defines a single parameter, JDK_VERSION. Setting this will set the version of the builder image used in the BuildConfig. Currently suppoted values are 11, 17, and 21. By default this will be 11. +Create an OpenShift template `templates/jlink-app-template` from the jlinked-app template file - oc process --parameters jlink-builder-template - - NAME DESCRIPTION GENERATOR VALUE - JDK_VERSION JDK version to produce a jmods image for 11 + oc create -f templates/jlink/jlinked-app.yaml -In order to set the JDK version, you will need to use the -p flag of oc process. To process the template and create the imagestreams, simply run +Process it to create the needed objects. You can list the parameters using - oc process jlink-builder-template -p JDK_VERSION=11 | oc create -f - - - imagestream.image.openshift.io/ubi9-openjdk-11-jlink created - buildconfig.build.openshift.io/jlink-builder-jdk-11 created + oc process --parameters jlink-builder-template -3. Start and observe the build +Some suitable test values for the parameters are -Start the build using + * JDK_VERSION: 17 + * APP_URI: https://github.com/jboss-container-images/openjdk-test-applications + * REF: master + * CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar - oc start-build jlink-builder-jdk-11 - - build.build.openshift.io/jlink-builder-jdk-11-1 started + oc process \ + -p JDK_VERSION=17 \ + -p APP_URI=https://github.com/jboss-container-images/openjdk-test-applications \ + -p REF=master \ + -p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.9.2-uberjar \ + templates/jlink-app-template \ + | oc create -f - -Then observe it by using +## Stage 2: Observe the results - oc logs -f bc/jlink-builder-jdk-11 +See all the OpenShift objects that were created: -## Stage 2: build and analyse application with OpenShift source-to-image (S2I) + oc get all -TODO +Visit the Topology page within the D eveloper perspective, OpenShift web console, +and inspect the App. From 60cffc29b03e1779b00270532d906db84fd84280 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 16 Apr 2024 11:15:26 +0100 Subject: [PATCH 066/132] Describe configuring Docker to avoid TLS verifying OCP registry Thanks Jaya for the suggestion. Signed-off-by: Jonathan Dowland --- templates/jlink/README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index d41a453f..551b3922 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -22,11 +22,19 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. oc create imagestream ubi9-openjdk-17 -3. Log into the OpenShift registry, e.g. +3. You may need to configure your container engine to not TLS-verify the OpenShift + registry. For Docker, add the following to `/etc/docker/daemon.json` and restart + the daemon: + + { + "insecure-registries": [ "default-route-openshift-image-registry.apps-crc.testing" ] + } + +4. Log into the OpenShift registry, e.g. REGISTRY_AUTH_PREFERENCE=docker oc registry login -4. tag and push the dev image into it. The OpenShift console gives you the +5. tag and push the dev image into it. The OpenShift console gives you the exact URI for your instance docker tag ubi9/openjdk-17:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 From b29d66b505bf093cd7cf7ebc275b2b387c1b601b Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 25 Apr 2024 10:50:11 +0100 Subject: [PATCH 067/132] Update jlink README with final steps Correct the template name in an example command. Remove reference to Topology from Stage 2. At present the template does not create Deployment or Route objects, so nothing shows up in Topology at this stage. Add "Stage 3: Kick off builds". This is necessary until we have added further triggers between the buildConfigs. Add "Stage 4: create deployment". This is necessary until we have added Deployments, Routes etc. to the template. Signed-off-by: Jonathan Dowland --- templates/jlink/README.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 551b3922..74c16c42 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -48,7 +48,7 @@ Create an OpenShift template `templates/jlink-app-template` from the jlinked-app Process it to create the needed objects. You can list the parameters using - oc process --parameters jlink-builder-template + oc process --parameters jlink-app-template Some suitable test values for the parameters are @@ -71,5 +71,25 @@ See all the OpenShift objects that were created: oc get all -Visit the Topology page within the D eveloper perspective, OpenShift web console, -and inspect the App. +## Stage 3: Kick off builds + +There will be three BuildConfigs, called something like + +1. jlink-builder-jdk-17 +2. jlink-s2i-jdk-17 +3. multistage-buildconfig + +Start a build for (1), wait for it to complete successfully; then start (2). +Once (2) completes, (3) should be automatically triggered. + +## Stage 4: create deployment + +The ImageStreamTag `lightweight-image:latest` will be populated with the new +application container image. + +Create a deployment to see it work. E.g., in the Developer Perspective, select +"+Add", "Container Images", "Image stream tag from internal registry", ..., +"Create" + +Then from "Topology", select the "Open URL" icon to open the newly deployed +App. From 8a04730bea11ccf55c0e2d2729eacb3436077aad Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Mon, 29 Apr 2024 13:56:25 +0530 Subject: [PATCH 068/132] Add hooks to trigger stage-1 build Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlinked-app.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 7f041a72..10013fb6 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -66,6 +66,13 @@ objects: to: kind: ImageStreamTag name: ubi9-openjdk-${JDK_VERSION}-jlink:latest + triggers: + - type: ConfigChange + - type: ImageChange + imageChange: + from: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}:1.18 # UBI9 OpenJDK ImageStreams with `jlink-dev` support ############################################################################## # stage-2: Output ImageStream - apiVersion: image.openshift.io/v1 From 021931fb9a21010ec414af5cc04b008e836b81da Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Mon, 29 Apr 2024 18:02:13 +0530 Subject: [PATCH 069/132] Add hooks for stage-2 build Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlinked-app.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 7f041a72..c3b3ade9 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -105,6 +105,17 @@ objects: to: kind: ImageStreamTag name: intermediate:latest + triggers: + - type: ConfigChange + - type: ImageChange + imageChange: + from: + kind: ImageStreamTag + name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output of stage-1 which serves as input to stage-2 + - type: GitHub + github: + secret: Gvw2O0tXuaAUxleJ + event: push ############################################################################## # stage-3: The ubi-micro ImageStream - apiVersion: image.openshift.io/v1 From a231afcb6fecb1b4f31dbcafd223b8d7ce3345d7 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Tue, 30 Apr 2024 12:50:43 +0530 Subject: [PATCH 070/132] Address review comments to genereat random secret value Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlinked-app.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index c3b3ade9..d63886a1 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -21,6 +21,12 @@ parameters: - description: Context Dir to use for the jlink workflow name: CONTEXT_DIR required: true +- description: A secret string used to configure the GitHub webhook + name: GITHUB_WEBHOOK_SECRET + generate: expression + from: "[a-zA-Z0-9]{16}" + required: true +message: "... The GitHub webhook secret is ${GITHUB_WEBHOOK_SECRET} ..." ############################################################################## # Following are the objects(imagestream and buildconfigs) for all the 3-stages objects: @@ -114,7 +120,7 @@ objects: name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output of stage-1 which serves as input to stage-2 - type: GitHub github: - secret: Gvw2O0tXuaAUxleJ + secret: ${GITHUB_WEBHOOK_SECRET} event: push ############################################################################## # stage-3: The ubi-micro ImageStream From 2f70a22aa19487179c7ef29711bdd7ee050703b0 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 30 Apr 2024 09:55:21 +0100 Subject: [PATCH 071/132] Update jlink README to reflect new triggers Signed-off-by: Jonathan Dowland --- templates/jlink/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 74c16c42..d1f031a7 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -79,8 +79,8 @@ There will be three BuildConfigs, called something like 2. jlink-s2i-jdk-17 3. multistage-buildconfig -Start a build for (1), wait for it to complete successfully; then start (2). -Once (2) completes, (3) should be automatically triggered. +Start a build for (1). Once complete, builds for (2) and (3) should be +automatically triggered in sequence. ## Stage 4: create deployment From f125b754d5fc7a1fb669863ccc23b9a6df6d9d2d Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Wed, 22 May 2024 14:46:59 +0530 Subject: [PATCH 072/132] Add a guard check in Dockerfile for presence of jlink scripts Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlinked-app.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 6ccafe0c..ed25316e 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -51,6 +51,7 @@ objects: source: dockerfile: | FROM - + RUN if [ -f "/opt/jboss/container/java/jlink/preflight.sh" ]; then echo "jlink scripts exist "; else echo "jlink scripts doesn't exist"; exit 1; fi USER 0 RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JDK_VERSION}-openjdk-jmods RUN mkdir -p /mnt/jrootfs From 479ecad6a4f7794a435c3a88b5d170ba37089ce2 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 30 May 2024 11:44:34 +0100 Subject: [PATCH 073/132] silence guard check on success branch Signed-off-by: Jonathan Dowland --- templates/jlink/jlinked-app.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index ed25316e..3d3a1ce4 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -51,7 +51,7 @@ objects: source: dockerfile: | FROM - - RUN if [ -f "/opt/jboss/container/java/jlink/preflight.sh" ]; then echo "jlink scripts exist "; else echo "jlink scripts doesn't exist"; exit 1; fi + RUN if [ ! -f "/opt/jboss/container/java/jlink/preflight.sh" ]; then echo "jlink scripts doesn't exist" 2>&1; exit 1; fi USER 0 RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JDK_VERSION}-openjdk-jmods RUN mkdir -p /mnt/jrootfs From c6b5fb197a1f4e193b4303663109d6ad60f96255 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Mon, 10 Jun 2024 20:57:22 +0530 Subject: [PATCH 074/132] Spec for deployment and route object Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlinked-app.yaml | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 3d3a1ce4..3bcf3556 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -213,3 +213,43 @@ objects: from: kind: ImageStreamTag name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro +############################################################################## +# Deployment and Route object specs +- apiVersion: apps.openshift.io/v1 + kind: Deployment + metadata: + name: jlinked-app + spec: + replicas: 1 + selector: + matchLabels: + app: jlinked-app + template: + metadata: + labels: + app: jlinked-app + spec: + containers: + - name: jlinked-app-container + image: 'openshift/jlinked-app:latest' + ports: + - containerPort: 8080 +- apiVersion: v1 + kind: Service + metadata: + name: jlinked-app-service + spec: + selector: + app: jlinked-app + ports: + - protocol: TCP + port: 80 + targetPort: 8080 +- apiVersion: route.openshift.io/v1 + kind: Route + metadata: + name: jlinked-app-route + spec: + to: + kind: Service + name: jlinked-app-service From 1ceccb79947ce37ab4c004cfdd0f8ef180243569 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Tue, 11 Jun 2024 00:05:28 +0530 Subject: [PATCH 075/132] Correct apiVersion for deployment object Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlinked-app.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 3bcf3556..b6de63d8 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -215,7 +215,7 @@ objects: name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro ############################################################################## # Deployment and Route object specs -- apiVersion: apps.openshift.io/v1 +- apiVersion: apps/v1 kind: Deployment metadata: name: jlinked-app From 60d1b9ec9f0d323b67cb6ff1ac3503a0dd2daf98 Mon Sep 17 00:00:00 2001 From: Jayashree Huttanagoudar Date: Tue, 11 Jun 2024 01:33:32 +0530 Subject: [PATCH 076/132] Change the image value to lightweight-image and also add imagePullPolicy Signed-off-by: Jayashree Huttanagoudar --- templates/jlink/jlinked-app.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index b6de63d8..b4b19b1e 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -231,7 +231,8 @@ objects: spec: containers: - name: jlinked-app-container - image: 'openshift/jlinked-app:latest' + image: lightweight-image:latest + imagePullPolicy: IfNotPresent ports: - containerPort: 8080 - apiVersion: v1 From f039a32eb4fe0dc9e20e0490b068f9cb318b320b Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Thu, 4 Jul 2024 08:58:01 -0400 Subject: [PATCH 077/132] Add template parameter to ensure created objects are uniquely named. Related: OPENJDK-2903 --- templates/jlink/jlinked-app.yaml | 35 +++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 3d3a1ce4..2e97a942 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -12,6 +12,9 @@ parameters: name: JDK_VERSION value: "11" required: true +- description: A name for the application used to ensure created resources are uniquely named + name: APPNAME + required: true - description: Application to run the jlink workflow on name: APP_URI required: true @@ -35,7 +38,7 @@ objects: - apiVersion: image.openshift.io/v1 kind: ImageStream metadata: - name: ubi9-openjdk-${JDK_VERSION}-jlink + name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink spec: lookupPolicy: local: false @@ -44,9 +47,9 @@ objects: - apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: - name: jlink-builder-jdk-${JDK_VERSION} + name: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION} labels: - app: jlink-builder-jdk-${JDK_VERSION} + app: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION} spec: source: dockerfile: | @@ -72,7 +75,7 @@ objects: output: to: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}-jlink:latest + name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest triggers: - type: ConfigChange - type: ImageChange @@ -85,7 +88,7 @@ objects: - apiVersion: image.openshift.io/v1 kind: ImageStream metadata: - name: intermediate + name: ${APPNAME}-intermediate spec: lookupPolicy: local: false @@ -94,9 +97,9 @@ objects: - apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: - name: jlink-s2i-jdk-${JDK_VERSION} + name: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION} labels: - app: jlink-s2i-jdk-${JDK_VERSION} + app: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION} spec: source: type: Git @@ -108,7 +111,7 @@ objects: sourceStrategy: from: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream from stage-1 + name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream from stage-1 pullPolicy: Always env: - name: S2I_ENABLE_JLINK @@ -118,14 +121,14 @@ objects: output: to: kind: ImageStreamTag - name: intermediate:latest + name: ${APPNAME}-intermediate:latest triggers: - type: ConfigChange - type: ImageChange imageChange: from: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output of stage-1 which serves as input to stage-2 + name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output of stage-1 which serves as input to stage-2 - type: GitHub github: secret: ${GITHUB_WEBHOOK_SECRET} @@ -135,7 +138,7 @@ objects: - apiVersion: image.openshift.io/v1 kind: ImageStream metadata: - name: ubimicro + name: ${APPNAME}-ubimicro spec: lookupPolicy: local: true @@ -151,7 +154,7 @@ objects: - apiVersion: image.openshift.io/v1 kind: ImageStream metadata: - name: lightweight-image + name: ${APPNAME}-lightweight-image spec: lookupPolicy: local: false @@ -160,13 +163,13 @@ objects: - apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: - name: multistage-buildconfig + name: ${APPNAME}-multistage-buildconfig spec: source: images: - from: kind: ImageStreamTag - name: intermediate:latest + name: ${APPNAME}-intermediate:latest paths: - sourcePath: /mnt/jrootfs destinationDir: jrootfs @@ -200,14 +203,14 @@ objects: output: to: kind: ImageStreamTag - name: lightweight-image:latest # Tag for the final output image + name: ${APPNAME}-lightweight-image:latest # Tag for the final output image triggers: - type: ConfigChange - type: ImageChange imageChange: from: kind: ImageStreamTag - name: intermediate:latest # output of stage-2 + name: ${APPNAME}-intermediate:latest # output of stage-2 - type: ImageChange imageChange: from: From 7eecfc6da41fcde1897d3539daa6ad5798ab477e Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 16 Oct 2024 17:08:21 -0400 Subject: [PATCH 078/132] Add missing ubimicro prefixes --- templates/jlink/jlinked-app.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 2e97a942..ea258ec9 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -199,7 +199,7 @@ objects: dockerStrategy: from: kind: ImageStreamTag - name: ubimicro:latest + name: ${APPNAME}-ubimicro:latest output: to: kind: ImageStreamTag @@ -215,4 +215,4 @@ objects: imageChange: from: kind: ImageStreamTag - name: ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro + name: ${APPNAME}-ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro From 5222576a8491a90ec776b1a0975eec78d96c39a1 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Fri, 18 Oct 2024 16:39:41 +0100 Subject: [PATCH 079/132] [OPENJDK-3052] parameterize builder image tag Signed-off-by: Jonathan Dowland --- templates/jlink/jlinked-app.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 3d3a1ce4..a45bbdf2 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -12,6 +12,10 @@ parameters: name: JDK_VERSION value: "11" required: true +- description: OpenJDK builder image version tag + name: BUILDER_IMAGE_TAG + value: "latest" + required: true - description: Application to run the jlink workflow on name: APP_URI required: true @@ -68,7 +72,7 @@ objects: dockerStrategy: from: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}:1.18 # Refer README.md to create this ImageStream + name: ubi9-openjdk-${JDK_VERSION}:${BUILDER_IMAGE_TAG} # Refer README.md to create this ImageStream output: to: kind: ImageStreamTag @@ -79,7 +83,7 @@ objects: imageChange: from: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}:1.18 # UBI9 OpenJDK ImageStreams with `jlink-dev` support + name: ubi9-openjdk-${JDK_VERSION}:${BUILDER_IMAGE_TAG} ############################################################################## # stage-2: Output ImageStream - apiVersion: image.openshift.io/v1 From e1dea2b3f696efa8b57822177bc67c4f9193f0d3 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Mon, 21 Oct 2024 10:50:44 +0100 Subject: [PATCH 080/132] Don't run this test on JDK11 (EOL) Signed-off-by: Jonathan Dowland --- modules/jlink/tests/features/jlink.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index 724f2468..89c61800 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -1,4 +1,3 @@ -@ubi9/openjdk-11 @ubi9/openjdk-17 @ubi9/openjdk-21 Feature: Openshift OpenJDK S2I tests (jlink specific) From 7061b8e9feec939f486bf42b1ae742e3a59006f8 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Mon, 21 Oct 2024 11:30:25 -0400 Subject: [PATCH 081/132] Remove jmods rpm from builder images [OPENJDK-3376] stop installing jmods in the builder images --- modules/jdk/11/module.yaml | 1 - modules/jdk/17/module.yaml | 1 - modules/jdk/21/module.yaml | 1 - 3 files changed, 3 deletions(-) diff --git a/modules/jdk/11/module.yaml b/modules/jdk/11/module.yaml index 554a810b..7970d454 100644 --- a/modules/jdk/11/module.yaml +++ b/modules/jdk/11/module.yaml @@ -25,7 +25,6 @@ envs: packages: install: - java-11-openjdk-devel - - java-11-openjdk-jmods - tzdata-java modules: diff --git a/modules/jdk/17/module.yaml b/modules/jdk/17/module.yaml index a03a23aa..58990271 100644 --- a/modules/jdk/17/module.yaml +++ b/modules/jdk/17/module.yaml @@ -25,7 +25,6 @@ envs: packages: install: - java-17-openjdk-devel - - java-17-openjdk-jmods modules: install: diff --git a/modules/jdk/21/module.yaml b/modules/jdk/21/module.yaml index 585d4599..764a16cd 100644 --- a/modules/jdk/21/module.yaml +++ b/modules/jdk/21/module.yaml @@ -25,7 +25,6 @@ envs: packages: install: - java-21-openjdk-devel - - java-21-openjdk-jmods modules: install: From 8b8bce883665d67faaa6198fa58d646bff5f1dbd Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Mon, 21 Oct 2024 11:36:34 -0400 Subject: [PATCH 082/132] Add example APPNAME to README --- templates/jlink/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index d1f031a7..8026ef5f 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -56,12 +56,14 @@ Some suitable test values for the parameters are * APP_URI: https://github.com/jboss-container-images/openjdk-test-applications * REF: master * CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar + * APPNAME: quarkus-quickstart oc process \ -p JDK_VERSION=17 \ -p APP_URI=https://github.com/jboss-container-images/openjdk-test-applications \ -p REF=master \ -p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.9.2-uberjar \ + -p APPNAME=quarkus-quickstart \ templates/jlink-app-template \ | oc create -f - From 587d1f3ede5d102c566cf43c683ae054bac9aea3 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 5 Nov 2024 17:37:19 -0500 Subject: [PATCH 083/132] Rename created objects to follow unique naming convention --- templates/jlink/jlinked-app.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index cd0eab84..479f027c 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -221,30 +221,30 @@ objects: - apiVersion: apps/v1 kind: Deployment metadata: - name: jlinked-app + name: ${APPNAME}-jlinked-app spec: replicas: 1 selector: matchLabels: - app: jlinked-app + app: ${APPNAME}-jlinked-app template: metadata: labels: - app: jlinked-app + app: ${APPNAME}-jlinked-app spec: containers: - - name: jlinked-app-container - image: lightweight-image:latest + - name: ${APPNAME}-jlinked-app-container + image: ${APPNAME}-lightweight-image:latest imagePullPolicy: IfNotPresent ports: - containerPort: 8080 - apiVersion: v1 kind: Service metadata: - name: jlinked-app-service + name: ${APPNAME}-jlinked-app-service spec: selector: - app: jlinked-app + app: ${APPNAME}-jlinked-app ports: - protocol: TCP port: 80 @@ -252,8 +252,8 @@ objects: - apiVersion: route.openshift.io/v1 kind: Route metadata: - name: jlinked-app-route + name: ${APPNAME}-jlinked-app-route spec: to: kind: Service - name: jlinked-app-service + name: ${APPNAME}-jlinked-app-service From 5af22fdaac5378f6b1c3413110300d7ad94145b8 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 6 Nov 2024 09:02:20 -0500 Subject: [PATCH 084/132] Convert to DeploymentConfig, cleanup --- templates/jlink/jlinked-app.yaml | 40 ++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 479f027c..c4bde34a 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -29,6 +29,9 @@ parameters: generate: expression from: "[a-zA-Z0-9]{16}" required: true +- description: Target port for the created Route + name: TARGET_PORT + required: true message: "... The GitHub webhook secret is ${GITHUB_WEBHOOK_SECRET} ..." ############################################################################## # Following are the objects(imagestream and buildconfigs) for all the 3-stages @@ -217,27 +220,32 @@ objects: kind: ImageStreamTag name: ${APPNAME}-ubimicro:latest # ImageStreamTag for registry.access.redhat.com/ubi9/ubi-micro ############################################################################## -# Deployment and Route object specs -- apiVersion: apps/v1 - kind: Deployment +# DeploymentConfig and Route object specs +# DeploymentConfigs are discouraged, however the documentation sugggests to still +# use them if features are missing from Deployments, which in our case they are. +- apiVersion: apps.openshift.io/v1 + kind: DeploymentConfig metadata: - name: ${APPNAME}-jlinked-app + name: ${APPNAME}-jlinked-app-deployment + annotations: + template.alpha.openshift.io/wait-for-ready: "true" spec: replicas: 1 selector: matchLabels: app: ${APPNAME}-jlinked-app - template: - metadata: - labels: - app: ${APPNAME}-jlinked-app - spec: - containers: - - name: ${APPNAME}-jlinked-app-container - image: ${APPNAME}-lightweight-image:latest - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8080 + triggers: + - type: ConfigChange + - imageChangeParams: + automatic: true + containerNames: + - ${APPNAME}-jlinked-app-container + from: + kind: ImageStreamTag + name: ${APPNAME}-lightweight-image:latest + type: ImageChange + strategy: + type: Rolling - apiVersion: v1 kind: Service metadata: @@ -257,3 +265,5 @@ objects: to: kind: Service name: ${APPNAME}-jlinked-app-service + port: + targetPort: ${TARGET_PORT} From 040ddcac51ad98a56c243c29af44eaf2984aeea1 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 6 Nov 2024 09:36:00 -0500 Subject: [PATCH 085/132] Fix deploymentconfig --- templates/jlink/jlinked-app.yaml | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index c4bde34a..6622bdc5 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -232,20 +232,32 @@ objects: spec: replicas: 1 selector: - matchLabels: - app: ${APPNAME}-jlinked-app + app: ${APPNAME}-jlinked-app + template: + metadata: + labels: + app: ${APPNAME}-jlinked-app + spec: + containers: + - name: ${APPNAME}-jlinked-app-container + image: >- + ${APPNAME}-lightweight-image:latest + ports: + - containerPort: 8080 + protocol: TCP + strategy: + type: Rolling triggers: - - type: ConfigChange - - imageChangeParams: + - type: ImageChange + imageChangeParams: automatic: true containerNames: - - ${APPNAME}-jlinked-app-container - from: + - ${APPNAME}-jlinked-app-container + from: kind: ImageStreamTag - name: ${APPNAME}-lightweight-image:latest - type: ImageChange - strategy: - type: Rolling + name: '${APPNAME}-lightweight-image:latest' + namespace: default + - type: ConfigChange - apiVersion: v1 kind: Service metadata: From 8d6cfea7883eeaad38d316aa4381d42a5d32f8de Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Mon, 18 Nov 2024 19:21:25 -0500 Subject: [PATCH 086/132] Add ports to readme, fix Service --- templates/jlink/README.md | 4 ++++ templates/jlink/jlinked-app.yaml | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 8026ef5f..6c3f805e 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -57,6 +57,8 @@ Some suitable test values for the parameters are * REF: master * CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar * APPNAME: quarkus-quickstart + * TARGET_PORT: 8080 + * SERVICE_PORT: 8080 oc process \ -p JDK_VERSION=17 \ @@ -64,6 +66,8 @@ Some suitable test values for the parameters are -p REF=master \ -p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.9.2-uberjar \ -p APPNAME=quarkus-quickstart \ + -p TARGET_PORT=8080 \ + -p SERVICE_PORT=8080 \ templates/jlink-app-template \ | oc create -f - diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 6622bdc5..ab2ce72a 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -31,6 +31,11 @@ parameters: required: true - description: Target port for the created Route name: TARGET_PORT + value: "8080" + required: true +- description: Port for the created Service to listen on + name: SERVICE_PORT + value: "8181" required: true message: "... The GitHub webhook secret is ${GITHUB_WEBHOOK_SECRET} ..." ############################################################################## @@ -267,8 +272,9 @@ objects: app: ${APPNAME}-jlinked-app ports: - protocol: TCP - port: 80 - targetPort: 8080 + name: target-${TARGET_PORT}-tcp + port: ${{SERVICE_PORT}} + targetPort: ${{TARGET_PORT}} - apiVersion: route.openshift.io/v1 kind: Route metadata: From 4f67aa36afb34a95ee4674dbb2c9edcf7313166d Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 26 Nov 2024 16:56:48 +0000 Subject: [PATCH 087/132] [OPENJDK-3038] echo out Tech Preview warning The jlink feature will initially ship as TP. Repurpose older unit test to check for the TP warning (older test is redundant as it only worked if jmods are installed). The test depends upon this being merged first: https://github.com/cekit/behave-test-steps/pull/73 https://issues.redhat.com/browse/OPENJDK-3038 Signed-off-by: Jonathan Dowland --- .../opt/jboss/container/java/jlink/preflight.sh | 11 +++++++++++ modules/jlink/tests/features/jlink.feature | 8 ++++---- modules/s2i/bash/artifacts/usr/local/s2i/assemble | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh index ab7aba35..67154d01 100644 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/preflight.sh @@ -1,3 +1,14 @@ +jlink_techpreview_warning() +{ + { + echo "WARNING WARNING WARNING" + echo " Jlink integration is a Tech Preview feature!" + echo " See " + echo " for more information." + echo "WARNING WARNING WARNING" + } >&2 +} + jlink_preflight_check() { # preflight check: do we have what we need? diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index 89c61800..12d2a1ac 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -1,12 +1,12 @@ @ubi9/openjdk-17 @ubi9/openjdk-21 Feature: Openshift OpenJDK S2I tests (jlink specific) -Scenario: Ensure jlinked builder is used to build the containerized application image - Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i + + Scenario: tech preview warning is printed (OPENJDK-3038) + Given failing s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target using master | variable | value | | S2I_ENABLE_JLINK | true | - | QUARKUS_PACKAGE_TYPE| uber-jar | - Then run ls /tmp/jre in container and check its output for bin + Then s2i build log should contain Jlink integration is a Tech Preview feature Scenario: Ensure S2I_ENABLE_JLINK is not set to true Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i diff --git a/modules/s2i/bash/artifacts/usr/local/s2i/assemble b/modules/s2i/bash/artifacts/usr/local/s2i/assemble index 76999b56..e2f1e4ef 100644 --- a/modules/s2i/bash/artifacts/usr/local/s2i/assemble +++ b/modules/s2i/bash/artifacts/usr/local/s2i/assemble @@ -22,6 +22,7 @@ setup_java_app_and_lib if [ "$S2I_ENABLE_JLINK" = "true" ]; then source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/preflight.sh" + jlink_techpreview_warning jlink_preflight_check source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh" From d747bc3381a8c1c8dd91d90356c4bf5b4543d249 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 17 Dec 2024 22:15:27 -0500 Subject: [PATCH 088/132] Add pod to template --- templates/jlink/jlinked-app.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index ab2ce72a..f3dad11e 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -285,3 +285,14 @@ objects: name: ${APPNAME}-jlinked-app-service port: targetPort: ${TARGET_PORT} +- apiVersion: v1 + kind: Pod + metadata: + name: ${APPNAME}-jlinked-app-pod + spec: + containers: + - image: ${APPNAME}-lightweight-image:latest + name: ${APPNAME}-jlinked-app-container + ports: + - containerPort: ${{TARGET_PORT}} + protocol: TCP From adb47cce3197581b42f364bec17b353fd6b57998 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 17 Dec 2024 22:22:16 -0500 Subject: [PATCH 089/132] Add new label to each created object to allow for easy filtering --- templates/jlink/jlinked-app.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index f3dad11e..09444598 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -5,6 +5,8 @@ metadata: annotations: description: Template to produce imagestreams and buildconfigs for jlinked application name: jlink-app-template + labels: + jlink-app-name: ${APPNAME} ############################################################################## # List of parameters required to create template parameters: @@ -47,6 +49,8 @@ objects: kind: ImageStream metadata: name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink + labels: + jlink-app-name: ${APPNAME} spec: lookupPolicy: local: false @@ -58,6 +62,7 @@ objects: name: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION} labels: app: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION} + jlink-app-name: ${APPNAME} spec: source: dockerfile: | @@ -97,6 +102,8 @@ objects: kind: ImageStream metadata: name: ${APPNAME}-intermediate + labels: + jlink-app-name: ${APPNAME} spec: lookupPolicy: local: false @@ -108,6 +115,7 @@ objects: name: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION} labels: app: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION} + jlink-app-name: ${APPNAME} spec: source: type: Git @@ -147,6 +155,8 @@ objects: kind: ImageStream metadata: name: ${APPNAME}-ubimicro + labels: + jlink-app-name: ${APPNAME} spec: lookupPolicy: local: true @@ -234,6 +244,8 @@ objects: name: ${APPNAME}-jlinked-app-deployment annotations: template.alpha.openshift.io/wait-for-ready: "true" + labels: + jlink-app-name: ${APPNAME} spec: replicas: 1 selector: @@ -267,6 +279,8 @@ objects: kind: Service metadata: name: ${APPNAME}-jlinked-app-service + labels: + jlink-app-name: ${APPNAME} spec: selector: app: ${APPNAME}-jlinked-app @@ -279,6 +293,8 @@ objects: kind: Route metadata: name: ${APPNAME}-jlinked-app-route + labels: + jlink-app-name: ${APPNAME} spec: to: kind: Service @@ -289,6 +305,8 @@ objects: kind: Pod metadata: name: ${APPNAME}-jlinked-app-pod + labels: + jlink-app-name: ${APPNAME} spec: containers: - image: ${APPNAME}-lightweight-image:latest From b46af7af1a11f15a4d4bc8b8236ebb51459e491b Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 18 Dec 2024 09:47:38 -0500 Subject: [PATCH 090/132] Fix labels --- templates/jlink/jlinked-app.yaml | 61 +++++++++++++++----------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 09444598..49540de6 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -5,8 +5,6 @@ metadata: annotations: description: Template to produce imagestreams and buildconfigs for jlinked application name: jlink-app-template - labels: - jlink-app-name: ${APPNAME} ############################################################################## # List of parameters required to create template parameters: @@ -50,7 +48,8 @@ objects: metadata: name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink labels: - jlink-app-name: ${APPNAME} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: lookupPolicy: local: false @@ -61,8 +60,8 @@ objects: metadata: name: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION} labels: - app: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION} - jlink-app-name: ${APPNAME} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: source: dockerfile: | @@ -103,7 +102,8 @@ objects: metadata: name: ${APPNAME}-intermediate labels: - jlink-app-name: ${APPNAME} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: lookupPolicy: local: false @@ -114,8 +114,8 @@ objects: metadata: name: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION} labels: - app: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION} - jlink-app-name: ${APPNAME} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: source: type: Git @@ -156,7 +156,8 @@ objects: metadata: name: ${APPNAME}-ubimicro labels: - jlink-app-name: ${APPNAME} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: lookupPolicy: local: true @@ -173,6 +174,9 @@ objects: kind: ImageStream metadata: name: ${APPNAME}-lightweight-image + labels: + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: lookupPolicy: local: false @@ -182,6 +186,9 @@ objects: kind: BuildConfig metadata: name: ${APPNAME}-multistage-buildconfig + labels: + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: source: images: @@ -245,22 +252,23 @@ objects: annotations: template.alpha.openshift.io/wait-for-ready: "true" labels: - jlink-app-name: ${APPNAME} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: replicas: 1 selector: - app: ${APPNAME}-jlinked-app + app: ${APPNAME} template: metadata: labels: - app: ${APPNAME}-jlinked-app + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: containers: - name: ${APPNAME}-jlinked-app-container - image: >- - ${APPNAME}-lightweight-image:latest + image: ${APPNAME}-lightweight-image:latest ports: - - containerPort: 8080 + - containerPort: ${{TARGET_PORT}} protocol: TCP strategy: type: Rolling @@ -280,10 +288,11 @@ objects: metadata: name: ${APPNAME}-jlinked-app-service labels: - jlink-app-name: ${APPNAME} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: selector: - app: ${APPNAME}-jlinked-app + app: ${APPNAME} ports: - protocol: TCP name: target-${TARGET_PORT}-tcp @@ -294,23 +303,11 @@ objects: metadata: name: ${APPNAME}-jlinked-app-route labels: - jlink-app-name: ${APPNAME} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: to: kind: Service name: ${APPNAME}-jlinked-app-service port: - targetPort: ${TARGET_PORT} -- apiVersion: v1 - kind: Pod - metadata: - name: ${APPNAME}-jlinked-app-pod - labels: - jlink-app-name: ${APPNAME} - spec: - containers: - - image: ${APPNAME}-lightweight-image:latest - name: ${APPNAME}-jlinked-app-container - ports: - - containerPort: ${{TARGET_PORT}} - protocol: TCP + targetPort: ${{TARGET_PORT}} From a88ad3db85d84553d98072c938fd3a41031ec8c9 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Mon, 20 Jan 2025 14:40:58 +0000 Subject: [PATCH 091/132] [OPENJDK-3540] component & dist-git branch for tech-preview image Signed-off-by: Jonathan Dowland --- redhat/ubi9-openjdk-21.yaml | 2 +- ubi9-openjdk-21.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/redhat/ubi9-openjdk-21.yaml b/redhat/ubi9-openjdk-21.yaml index 5ce6f524..377d5fbc 100644 --- a/redhat/ubi9-openjdk-21.yaml +++ b/redhat/ubi9-openjdk-21.yaml @@ -10,7 +10,7 @@ osbs: signing_intent: release repository: name: containers/openjdk - branch: openjdk-21-ubi9 + branch: openjdk-21-jlink-tech-preview-ubi9 packages: manager: microdnf diff --git a/ubi9-openjdk-21.yaml b/ubi9-openjdk-21.yaml index 0e008dc0..99a0a5dd 100644 --- a/ubi9-openjdk-21.yaml +++ b/ubi9-openjdk-21.yaml @@ -17,7 +17,7 @@ labels: - name: "maintainer" value: "Red Hat OpenJDK " - name: "com.redhat.component" - value: "openjdk-21-ubi9-container" + value: "openjdk-21-jlink-tech-preview-ubi9-container" - name: "usage" value: "https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/" - name: "com.redhat.license_terms" From 1a4bbe4bfd1d71299b6a2b89ab7fcd6bdc20bdf1 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Mon, 20 Jan 2025 15:34:44 -0500 Subject: [PATCH 092/132] Add jmods rpm back into the UBI9/JDK21 image --- modules/jdk/21/module.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/jdk/21/module.yaml b/modules/jdk/21/module.yaml index 764a16cd..585d4599 100644 --- a/modules/jdk/21/module.yaml +++ b/modules/jdk/21/module.yaml @@ -25,6 +25,7 @@ envs: packages: install: - java-21-openjdk-devel + - java-21-openjdk-jmods modules: install: From 9c94e84a5bd390a542b2d9de665ac68f3aabe7a5 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Mon, 20 Jan 2025 15:55:45 -0500 Subject: [PATCH 093/132] Rename ubi9/openjdk21 images to reflect tech preview --- .github/workflows/ubi9-openjdk-21-runtime.yml | 4 ++-- .github/workflows/ubi9-openjdk-21.yml | 4 ++-- modules/jlink/tests/features/jlink.feature | 2 +- redhat/ubi9-openjdk-21.yaml | 2 +- tests/features/java.security.feature | 2 +- tests/features/java/java_s2i.feature | 2 +- tests/features/java/java_s2i_inc.feature | 2 +- tests/features/java/memory.feature | 2 +- tests/features/java/openjdk.feature | 8 ++++---- tests/features/java/openjdk_s2i.feature | 2 +- tests/features/java/ports.feature | 2 +- tests/features/java/runtime.feature | 2 +- tests/features/openshift.feature | 2 +- tests/features/s2i-core.feature | 2 +- ubi9-openjdk-21-runtime.yaml | 4 ++-- ubi9-openjdk-21.yaml | 4 ++-- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ubi9-openjdk-21-runtime.yml b/.github/workflows/ubi9-openjdk-21-runtime.yml index 1c8c5d36..aaa37f61 100644 --- a/.github/workflows/ubi9-openjdk-21-runtime.yml +++ b/.github/workflows/ubi9-openjdk-21-runtime.yml @@ -2,9 +2,9 @@ name: UBI9 OpenJDK 21 Runtime S2I Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - IMAGE: ubi9-openjdk-21-runtime + IMAGE: openjdk-21-jlink-rhel9-runtime jobs: call-openjdkci: uses: ./.github/workflows/image-workflow-template.yml with: - image: ubi9-openjdk-21-runtime + image: openjdk-21-jlink-rhel9-runtime diff --git a/.github/workflows/ubi9-openjdk-21.yml b/.github/workflows/ubi9-openjdk-21.yml index 3b23687e..28d4080b 100644 --- a/.github/workflows/ubi9-openjdk-21.yml +++ b/.github/workflows/ubi9-openjdk-21.yml @@ -2,9 +2,9 @@ name: UBI9 OpenJDK 21 S2I Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - IMAGE: ubi9-openjdk-21 + IMAGE: openjdk-21-jlink-rhel9 jobs: call-openjdkci: uses: ./.github/workflows/image-workflow-template.yml with: - image: ubi9-openjdk-21 + image: openjdk-21-jlink-rhel9 diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index 89c61800..67d1af16 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -1,5 +1,5 @@ @ubi9/openjdk-17 -@ubi9/openjdk-21 +@openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK S2I tests (jlink specific) Scenario: Ensure jlinked builder is used to build the containerized application image Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i diff --git a/redhat/ubi9-openjdk-21.yaml b/redhat/ubi9-openjdk-21.yaml index 5ce6f524..099d60a8 100644 --- a/redhat/ubi9-openjdk-21.yaml +++ b/redhat/ubi9-openjdk-21.yaml @@ -10,7 +10,7 @@ osbs: signing_intent: release repository: name: containers/openjdk - branch: openjdk-21-ubi9 + branch: openjdk-21-jlink-rhel9-runtime packages: manager: microdnf diff --git a/tests/features/java.security.feature b/tests/features/java.security.feature index 05be83d9..de8a4103 100644 --- a/tests/features/java.security.feature +++ b/tests/features/java.security.feature @@ -1,6 +1,6 @@ @ubi9/openjdk-11 @ubi9/openjdk-17 -@ubi9/openjdk-21 +@openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift S2I tests Scenario: Check networkaddress.cache.negative.ttl has been set correctly Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from binary-cli-security-property diff --git a/tests/features/java/java_s2i.feature b/tests/features/java/java_s2i.feature index 616b57b5..eb907fbe 100644 --- a/tests/features/java/java_s2i.feature +++ b/tests/features/java/java_s2i.feature @@ -2,7 +2,7 @@ @ignore @ubi9/openjdk-11 @ubi9/openjdk-17 -@ubi9/openjdk-21 +@openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK S2I tests # NOTE: these tests should be usable with the other images once we have refactored the JDK scripts. # These builds do not actually run maven. This is important, because the proxy diff --git a/tests/features/java/java_s2i_inc.feature b/tests/features/java/java_s2i_inc.feature index 57a820f2..acdd2234 100644 --- a/tests/features/java/java_s2i_inc.feature +++ b/tests/features/java/java_s2i_inc.feature @@ -1,6 +1,6 @@ @ubi9/openjdk-11 @ubi9/openjdk-17 -@ubi9/openjdk-21 +@openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK S2I tests # test incremental builds diff --git a/tests/features/java/memory.feature b/tests/features/java/memory.feature index 64ca3858..8d81c344 100644 --- a/tests/features/java/memory.feature +++ b/tests/features/java/memory.feature @@ -35,7 +35,7 @@ Feature: OPENJDK-559 JVM Memory tests # Not the runtime images @ubi9/openjdk-11 @ubi9/openjdk-17 - @ubi9/openjdk-21 + @openjdk-tech-preview/openjdk-21-jlink-rhel9 Scenario: Ensure Maven doesn't use MaxRAMPercentage=80 Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple Then s2i build log should match regex INFO Using MAVEN_OPTS.*-XX:MaxRAMPercentage=25.0$ diff --git a/tests/features/java/openjdk.feature b/tests/features/java/openjdk.feature index 031883b9..01c5e622 100644 --- a/tests/features/java/openjdk.feature +++ b/tests/features/java/openjdk.feature @@ -20,8 +20,8 @@ Feature: Miscellaneous OpenJDK-related unit tests Then available container log should not contain java-11 Then available container log should not contain java-21 - @ubi9/openjdk-21 - @ubi9/openjdk-21-runtime + @openjdk-tech-preview/openjdk-21-jlink-rhel9 + @openjdk-tech-preview/openjdk-21-jlink-rhel9-runtime Scenario: Check that only OpenJDK 21 is installed When container is started with args | arg | value | @@ -66,8 +66,8 @@ Feature: Miscellaneous OpenJDK-related unit tests Then available container log should not contain java-11 Then available container log should not contain java-21 - @ubi9/openjdk-21 - @ubi9/openjdk-21-runtime + @openjdk-tech-preview/openjdk-21-jlink-rhel9 + @openjdk-tech-preview/openjdk-21-jlink-rhel9-runtime Scenario: Check that directories from other JDKs are not present (JDK21) When container is started with args | arg | value | diff --git a/tests/features/java/openjdk_s2i.feature b/tests/features/java/openjdk_s2i.feature index 65686c8d..3f096dfa 100644 --- a/tests/features/java/openjdk_s2i.feature +++ b/tests/features/java/openjdk_s2i.feature @@ -1,7 +1,7 @@ # builder only @ubi9/openjdk-11 @ubi9/openjdk-17 -@ubi9/openjdk-21 +@openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK-only S2I tests @ignore diff --git a/tests/features/java/ports.feature b/tests/features/java/ports.feature index 6542c246..dcf0a2a5 100644 --- a/tests/features/java/ports.feature +++ b/tests/features/java/ports.feature @@ -1,6 +1,6 @@ @ubi9/openjdk-11 @ubi9/openjdk-17 -@ubi9/openjdk-21 +@openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK port tests Scenario: Check ports are available diff --git a/tests/features/java/runtime.feature b/tests/features/java/runtime.feature index 10477a62..439952a1 100644 --- a/tests/features/java/runtime.feature +++ b/tests/features/java/runtime.feature @@ -1,6 +1,6 @@ @ubi9/openjdk-11 @ubi9/openjdk-17 -@ubi9/openjdk-21 +@openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK Runtime tests Scenario: Ensure JAVA_ARGS is passed through, diagnostic options work correctly, JVM_ARGS not present in run script, OPENJDK-474 JAVA_ARGS not repeated diff --git a/tests/features/openshift.feature b/tests/features/openshift.feature index ceb6be8d..9f4e0c85 100644 --- a/tests/features/openshift.feature +++ b/tests/features/openshift.feature @@ -11,7 +11,7 @@ Feature: Tests for all openshift images # builder-only test @ubi9/openjdk-11 @ubi9/openjdk-17 - @ubi9/openjdk-21 + @openjdk-tech-preview/openjdk-21-jlink-rhel9 Scenario: Check that builder labels are correctly set Given image is built Then the image should contain label io.openshift.s2i.scripts-url with value image:///usr/local/s2i diff --git a/tests/features/s2i-core.feature b/tests/features/s2i-core.feature index cf4b3625..1ab11c78 100644 --- a/tests/features/s2i-core.feature +++ b/tests/features/s2i-core.feature @@ -1,6 +1,6 @@ @ubi9/openjdk-11 @ubi9/openjdk-17 -@ubi9/openjdk-21 +@openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift S2I tests # OPENJDK-84 - /tmp/src should not be present after build Scenario: run an s2i build and check that /tmp/src has been removed afterwards diff --git a/ubi9-openjdk-21-runtime.yaml b/ubi9-openjdk-21-runtime.yaml index 528c3634..b1b28008 100644 --- a/ubi9-openjdk-21-runtime.yaml +++ b/ubi9-openjdk-21-runtime.yaml @@ -3,7 +3,7 @@ schema_version: 1 from: "registry.access.redhat.com/ubi9/ubi-minimal" -name: &name "ubi9/openjdk-21-runtime" +name: &name "openjdk-tech-preview/openjdk-21-jlink-rhel9-runtime" version: &version "1.18" description: "Image for Red Hat OpenShift providing OpenJDK 21 runtime" @@ -17,7 +17,7 @@ labels: - name: "maintainer" value: "Red Hat OpenJDK " - name: "com.redhat.component" - value: "openjdk-21-runtime-ubi9-container" + value: "openjdk-21-jlink-rhel9-runtime-container" - name: "usage" value: "https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/" - name: "com.redhat.license_terms" diff --git a/ubi9-openjdk-21.yaml b/ubi9-openjdk-21.yaml index 0e008dc0..78ec8454 100644 --- a/ubi9-openjdk-21.yaml +++ b/ubi9-openjdk-21.yaml @@ -3,7 +3,7 @@ schema_version: 1 from: "registry.access.redhat.com/ubi9/ubi-minimal" -name: &name "ubi9/openjdk-21" +name: &name "openjdk-tech-preview/openjdk-21-jlink-rhel9" version: &version "1.18" description: "Source To Image (S2I) image for Red Hat OpenShift providing OpenJDK 21" @@ -17,7 +17,7 @@ labels: - name: "maintainer" value: "Red Hat OpenJDK " - name: "com.redhat.component" - value: "openjdk-21-ubi9-container" + value: "openjdk-21-jlink-rhel9-container" - name: "usage" value: "https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/" - name: "com.redhat.license_terms" From 4e589a84d4fdf911815414a56fe510ca7e04dfed Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Mon, 20 Jan 2025 17:50:01 -0500 Subject: [PATCH 094/132] Ensure the build fails when jdeps fails --- .../s2i/bash/artifacts/usr/local/s2i/assemble | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/s2i/bash/artifacts/usr/local/s2i/assemble b/modules/s2i/bash/artifacts/usr/local/s2i/assemble index 76999b56..e56fa4e1 100644 --- a/modules/s2i/bash/artifacts/usr/local/s2i/assemble +++ b/modules/s2i/bash/artifacts/usr/local/s2i/assemble @@ -1,6 +1,6 @@ #!/bin/sh -set -e +set -eo pipefail source "${JBOSS_CONTAINER_UTIL_LOGGING_MODULE}/logging.sh" source "${JBOSS_CONTAINER_MAVEN_S2I_MODULE}/maven-s2i" @@ -26,18 +26,30 @@ if [ "$S2I_ENABLE_JLINK" = "true" ]; then source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh" echo "Invoking mkdeps" - generate_deps + generate_deps || { + log_error "mkdeps failed, return code: $1" + exit $1 + } source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkstrippeddeps.sh" echo "Stripping dependencies" - mkstrippeddeps + mkstrippeddeps || { + log_error "stripping dependencies failed, return code: $1" + exit $1 + } source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/generatejdkdeps.sh" echo "Generating JDK dependencies" - generatejdkdeps + generatejdkdeps || { + log_error "generating JDK dependencies failed, return code: $1" + exit $1 + } source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkjreimage.sh" echo "Linking jre" - generate_jre_image + generate_jre_image || { + log_error "Linking JRE failed, return code: $1" + exit $1 + } fi From d89c5686d34d845bd569e8d62663f4922982f7a2 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 21 Jan 2025 11:35:15 -0500 Subject: [PATCH 095/132] Address review feedback --- modules/jdk/21/module.yaml | 1 + .../jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh | 1 + redhat/ubi9-openjdk-21.yaml | 2 +- ubi9-openjdk-21-runtime.yaml | 4 ++-- ubi9-openjdk-21.yaml | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/jdk/21/module.yaml b/modules/jdk/21/module.yaml index 764a16cd..585d4599 100644 --- a/modules/jdk/21/module.yaml +++ b/modules/jdk/21/module.yaml @@ -25,6 +25,7 @@ envs: packages: install: - java-21-openjdk-devel + - java-21-openjdk-jmods modules: install: diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh index bc9d55ba..06e4d8f6 100755 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh @@ -3,6 +3,7 @@ set -euo pipefail shopt -s globstar function generate_deps() { + exit 2 # Create a temporary directory for a module path # This works around "Module java.xml.bind not found, required by java.ws.rs" mkdir dependencies diff --git a/redhat/ubi9-openjdk-21.yaml b/redhat/ubi9-openjdk-21.yaml index 099d60a8..377d5fbc 100644 --- a/redhat/ubi9-openjdk-21.yaml +++ b/redhat/ubi9-openjdk-21.yaml @@ -10,7 +10,7 @@ osbs: signing_intent: release repository: name: containers/openjdk - branch: openjdk-21-jlink-rhel9-runtime + branch: openjdk-21-jlink-tech-preview-ubi9 packages: manager: microdnf diff --git a/ubi9-openjdk-21-runtime.yaml b/ubi9-openjdk-21-runtime.yaml index b1b28008..528c3634 100644 --- a/ubi9-openjdk-21-runtime.yaml +++ b/ubi9-openjdk-21-runtime.yaml @@ -3,7 +3,7 @@ schema_version: 1 from: "registry.access.redhat.com/ubi9/ubi-minimal" -name: &name "openjdk-tech-preview/openjdk-21-jlink-rhel9-runtime" +name: &name "ubi9/openjdk-21-runtime" version: &version "1.18" description: "Image for Red Hat OpenShift providing OpenJDK 21 runtime" @@ -17,7 +17,7 @@ labels: - name: "maintainer" value: "Red Hat OpenJDK " - name: "com.redhat.component" - value: "openjdk-21-jlink-rhel9-runtime-container" + value: "openjdk-21-runtime-ubi9-container" - name: "usage" value: "https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/" - name: "com.redhat.license_terms" diff --git a/ubi9-openjdk-21.yaml b/ubi9-openjdk-21.yaml index 78ec8454..10f27f13 100644 --- a/ubi9-openjdk-21.yaml +++ b/ubi9-openjdk-21.yaml @@ -17,7 +17,7 @@ labels: - name: "maintainer" value: "Red Hat OpenJDK " - name: "com.redhat.component" - value: "openjdk-21-jlink-rhel9-container" + value: "openjdk-21-jlink-tech-preview-ubi9-container" - name: "usage" value: "https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html/red_hat_java_s2i_for_openshift/" - name: "com.redhat.license_terms" From c47a6bbd86321ea7bc28d9acb9be412e460b17af Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 21 Jan 2025 11:40:23 -0500 Subject: [PATCH 096/132] Address review feedback 2 --- .github/workflows/ubi9-openjdk-21-runtime.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubi9-openjdk-21-runtime.yml b/.github/workflows/ubi9-openjdk-21-runtime.yml index aaa37f61..1c8c5d36 100644 --- a/.github/workflows/ubi9-openjdk-21-runtime.yml +++ b/.github/workflows/ubi9-openjdk-21-runtime.yml @@ -2,9 +2,9 @@ name: UBI9 OpenJDK 21 Runtime S2I Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - IMAGE: openjdk-21-jlink-rhel9-runtime + IMAGE: ubi9-openjdk-21-runtime jobs: call-openjdkci: uses: ./.github/workflows/image-workflow-template.yml with: - image: openjdk-21-jlink-rhel9-runtime + image: ubi9-openjdk-21-runtime From a6b69363c82906a92c66dc25dc03d5b21530f138 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 22 Jan 2025 09:08:44 -0500 Subject: [PATCH 097/132] Review feedback 3 --- .../artifacts/opt/jboss/container/java/jlink/mkdeps.sh | 1 - tests/features/java/openjdk.feature | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh index 06e4d8f6..bc9d55ba 100755 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh @@ -3,7 +3,6 @@ set -euo pipefail shopt -s globstar function generate_deps() { - exit 2 # Create a temporary directory for a module path # This works around "Module java.xml.bind not found, required by java.ws.rs" mkdir dependencies diff --git a/tests/features/java/openjdk.feature b/tests/features/java/openjdk.feature index 01c5e622..031883b9 100644 --- a/tests/features/java/openjdk.feature +++ b/tests/features/java/openjdk.feature @@ -20,8 +20,8 @@ Feature: Miscellaneous OpenJDK-related unit tests Then available container log should not contain java-11 Then available container log should not contain java-21 - @openjdk-tech-preview/openjdk-21-jlink-rhel9 - @openjdk-tech-preview/openjdk-21-jlink-rhel9-runtime + @ubi9/openjdk-21 + @ubi9/openjdk-21-runtime Scenario: Check that only OpenJDK 21 is installed When container is started with args | arg | value | @@ -66,8 +66,8 @@ Feature: Miscellaneous OpenJDK-related unit tests Then available container log should not contain java-11 Then available container log should not contain java-21 - @openjdk-tech-preview/openjdk-21-jlink-rhel9 - @openjdk-tech-preview/openjdk-21-jlink-rhel9-runtime + @ubi9/openjdk-21 + @ubi9/openjdk-21-runtime Scenario: Check that directories from other JDKs are not present (JDK21) When container is started with args | arg | value | From 5f046918548bd24955a8e05e284f53dd3d11f23b Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 28 Jan 2025 18:15:35 -0500 Subject: [PATCH 098/132] Fix return code handling --- .../opt/jboss/container/java/jlink/mkdeps.sh | 5 +---- .../s2i/bash/artifacts/usr/local/s2i/assemble | 16 ++++++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh index bc9d55ba..7a53e782 100755 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh @@ -21,10 +21,7 @@ function generate_deps() { --module-path dependencies \ "$JAVA_APP_JAR" \ "$JAVA_LIB_DIR"/**/*.jar \ - > deps.txt || { - echo "jdeps failed: return code $?" - exit $? - } + > deps.txt else $JAVA_HOME/bin/jdeps --multi-release $JAVA_VERSION -R -s \ --module-path dependencies \ diff --git a/modules/s2i/bash/artifacts/usr/local/s2i/assemble b/modules/s2i/bash/artifacts/usr/local/s2i/assemble index c77ee026..81dd72eb 100644 --- a/modules/s2i/bash/artifacts/usr/local/s2i/assemble +++ b/modules/s2i/bash/artifacts/usr/local/s2i/assemble @@ -28,29 +28,29 @@ if [ "$S2I_ENABLE_JLINK" = "true" ]; then source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh" echo "Invoking mkdeps" generate_deps || { - log_error "mkdeps failed, return code: $1" - exit $1 + log_error "mkdeps failed, return code: $?" + exit 1 } source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkstrippeddeps.sh" echo "Stripping dependencies" mkstrippeddeps || { - log_error "stripping dependencies failed, return code: $1" - exit $1 + log_error "stripping dependencies failed, return code: $?" + exit 1 } source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/generatejdkdeps.sh" echo "Generating JDK dependencies" generatejdkdeps || { - log_error "generating JDK dependencies failed, return code: $1" - exit $1 + log_error "generating JDK dependencies failed, return code: $?" + exit 1 } source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkjreimage.sh" echo "Linking jre" generate_jre_image || { - log_error "Linking JRE failed, return code: $1" - exit $1 + log_error "Linking JRE failed, return code: $?" + exit 1 } fi From 4cc46dcda4b452ecb6dbeaf0ed2dd06eee16a80b Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 28 Jan 2025 18:43:34 -0500 Subject: [PATCH 099/132] Add consistent label to all created objects --- templates/jlink/jlinked-app.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 4b0fb60e..ad281110 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -42,6 +42,9 @@ objects: kind: ImageStream metadata: name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink + labels: + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: lookupPolicy: local: false @@ -52,7 +55,8 @@ objects: metadata: name: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION} labels: - app: ${APPNAME}-jlink-builder-jdk-${JDK_VERSION} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: source: dockerfile: | @@ -102,7 +106,8 @@ objects: metadata: name: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION} labels: - app: ${APPNAME}-jlink-s2i-jdk-${JDK_VERSION} + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: source: type: Git @@ -142,6 +147,9 @@ objects: kind: ImageStream metadata: name: ${APPNAME}-ubimicro + labels: + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: lookupPolicy: local: true @@ -158,6 +166,9 @@ objects: kind: ImageStream metadata: name: ${APPNAME}-lightweight-image + labels: + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: lookupPolicy: local: false @@ -167,6 +178,9 @@ objects: kind: BuildConfig metadata: name: ${APPNAME}-multistage-buildconfig + labels: + app: ${APPNAME} + app.kubernetes.io/part-of: ${APPNAME} spec: source: images: From 884c6212c36324118dc8198572917fe2175cec11 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 29 Jan 2025 14:02:18 -0500 Subject: [PATCH 100/132] Rename ubi9 references to reflect tech preview --- templates/jlink/README.md | 4 ++-- templates/jlink/jlinked-app.yaml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 6c3f805e..ed5c3196 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -20,7 +20,7 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. 2. Within your OpenShift project, - oc create imagestream ubi9-openjdk-17 + oc create imagestream openjdk-17-jlink-tech-preview 3. You may need to configure your container engine to not TLS-verify the OpenShift registry. For Docker, add the following to `/etc/docker/daemon.json` and restart @@ -37,7 +37,7 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. 5. tag and push the dev image into it. The OpenShift console gives you the exact URI for your instance - docker tag ubi9/openjdk-17:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 + docker tag openjdk-tech-preview/openjdk-17-jlink-rhel9:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/openjdk-17-jlink-tech-preview:1.18 docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 ## Stage 1: Load the template into OpenShift and instantiate it diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index d1132253..d2458360 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -49,7 +49,7 @@ objects: - apiVersion: image.openshift.io/v1 kind: ImageStream metadata: - name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink + name: ${APPNAME}-openjdk-${JDK_VERSION}-jlink-tech-preview labels: app: ${APPNAME} app.kubernetes.io/part-of: ${APPNAME} @@ -86,18 +86,18 @@ objects: dockerStrategy: from: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}:${BUILDER_IMAGE_TAG} # Refer README.md to create this ImageStream + name: openjdk-${JDK_VERSION}-jlink-tech-preview:1.18 # Refer README.md to create this ImageStream output: to: kind: ImageStreamTag - name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest + name: ${APPNAME}-openjdk-${JDK_VERSION}-jlink-tech-preview:latest triggers: - type: ConfigChange - type: ImageChange imageChange: from: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}:${BUILDER_IMAGE_TAG} + name: openjdk-${JDK_VERSION}-jlink-tech-preview:${BUILDER_IMAGE_TAG} ############################################################################## # stage-2: Output ImageStream - apiVersion: image.openshift.io/v1 @@ -130,7 +130,7 @@ objects: sourceStrategy: from: kind: ImageStreamTag - name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream from stage-1 + name: ${APPNAME}-openjdk-${JDK_VERSION}-jlink-tech-preview:latest # Output Imagestream from stage-1 pullPolicy: Always env: - name: S2I_ENABLE_JLINK @@ -147,7 +147,7 @@ objects: imageChange: from: kind: ImageStreamTag - name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output of stage-1 which serves as input to stage-2 + name: ${APPNAME}-openjdk-${JDK_VERSION}-jlink-tech-preview:latest # Output of stage-1 which serves as input to stage-2 - type: GitHub github: secret: ${GITHUB_WEBHOOK_SECRET} From b45009c40a642226333bdaa2974c3ee14d9da975 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 4 Feb 2025 14:03:48 -0500 Subject: [PATCH 101/132] revert image tag to latest --- templates/jlink/jlinked-app.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index d2458360..c46c2a69 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -86,7 +86,7 @@ objects: dockerStrategy: from: kind: ImageStreamTag - name: openjdk-${JDK_VERSION}-jlink-tech-preview:1.18 # Refer README.md to create this ImageStream + name: openjdk-${JDK_VERSION}-jlink-tech-preview:latest # Refer README.md to create this ImageStream output: to: kind: ImageStreamTag From f48ffa2280003c655df9a23ddcd94a1a5a1e22e5 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 4 Feb 2025 14:09:36 -0500 Subject: [PATCH 102/132] use builder image tag parameter --- templates/jlink/jlinked-app.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index c46c2a69..65b45e45 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -86,7 +86,7 @@ objects: dockerStrategy: from: kind: ImageStreamTag - name: openjdk-${JDK_VERSION}-jlink-tech-preview:latest # Refer README.md to create this ImageStream + name: openjdk-${JDK_VERSION}-jlink-tech-preview:${BUILDER_IMAGE_TAG} # Refer README.md to create this ImageStream output: to: kind: ImageStreamTag From 6a4fcb5f5b717e1d852383584000f554bfba928e Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 18 Feb 2025 15:01:32 -0500 Subject: [PATCH 103/132] Update README to reflect new naming conventions and builds automatically triggering --- templates/jlink/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 8026ef5f..d462c08e 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -75,19 +75,19 @@ See all the OpenShift objects that were created: ## Stage 3: Kick off builds -There will be three BuildConfigs, called something like +Instantiating the template will cause 3 separate BuildConfigs to be created and will automatically start their builds in sequence: -1. jlink-builder-jdk-17 -2. jlink-s2i-jdk-17 -3. multistage-buildconfig +1. $APPNAME-jlink-builder-jdk-$JDK_VERSION +2. $APPNAME-jlink-s2i-jdk-$JDK_VERSION +3. $APPNAME-multistage-buildconfig -Start a build for (1). Once complete, builds for (2) and (3) should be -automatically triggered in sequence. +Where $APPNAME and $JDK_VERSION are the paremeters initially passed to the template. + +A build will automatically start for (1). Once complete, builds for (2) and (3) should be automatically triggered in sequence. ## Stage 4: create deployment -The ImageStreamTag `lightweight-image:latest` will be populated with the new -application container image. +The ImageStreamTag `$APPNAME-lightweight-image:latest` will be populated with the new application container image. Create a deployment to see it work. E.g., in the Developer Perspective, select "+Add", "Container Images", "Image stream tag from internal registry", ..., From cc93f0e947698fb7ef895198a33f9e8b32e83288 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 18 Feb 2025 15:12:38 -0500 Subject: [PATCH 104/132] Update README and template to reflect tech-preview status --- templates/jlink/README.md | 16 ++++++++-------- templates/jlink/jlinked-app.yaml | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 8026ef5f..e1e29a95 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -16,11 +16,11 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. repository](https://github.com/jboss-container-images/openjdk), branch `jlink-dev`. e.g. - cekit --descriptor ubi9-openjdk-17.yaml build docker + cekit --descriptor ubi9-openjdk-21.yaml build docker 2. Within your OpenShift project, - oc create imagestream ubi9-openjdk-17 + oc create imagestream ubi9-openjdk-21-jlink-tech-preview 3. You may need to configure your container engine to not TLS-verify the OpenShift registry. For Docker, add the following to `/etc/docker/daemon.json` and restart @@ -37,8 +37,8 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. 5. tag and push the dev image into it. The OpenShift console gives you the exact URI for your instance - docker tag ubi9/openjdk-17:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 - docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 + docker tag openjdk-tech-preview/openjdk-21-jlink-rhel9:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-21-jlink-tech-preview:1.18 + docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-21:1.18 ## Stage 1: Load the template into OpenShift and instantiate it @@ -52,14 +52,14 @@ Process it to create the needed objects. You can list the parameters using Some suitable test values for the parameters are - * JDK_VERSION: 17 + * JDK_VERSION: 21 * APP_URI: https://github.com/jboss-container-images/openjdk-test-applications * REF: master * CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar * APPNAME: quarkus-quickstart oc process \ - -p JDK_VERSION=17 \ + -p JDK_VERSION=21 \ -p APP_URI=https://github.com/jboss-container-images/openjdk-test-applications \ -p REF=master \ -p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.9.2-uberjar \ @@ -77,8 +77,8 @@ See all the OpenShift objects that were created: There will be three BuildConfigs, called something like -1. jlink-builder-jdk-17 -2. jlink-s2i-jdk-17 +1. jlink-builder-jdk-21 +2. jlink-s2i-jdk-21 3. multistage-buildconfig Start a build for (1). Once complete, builds for (2) and (3) should be diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index ad281110..bb45c18e 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -41,7 +41,7 @@ objects: - apiVersion: image.openshift.io/v1 kind: ImageStream metadata: - name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink + name: ${APPNAME}-openjdk-${JDK_VERSION}-jlink-tech-preview labels: app: ${APPNAME} app.kubernetes.io/part-of: ${APPNAME} @@ -78,18 +78,18 @@ objects: dockerStrategy: from: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}:${BUILDER_IMAGE_TAG} # Refer README.md to create this ImageStream + name: openjdk-${JDK_VERSION}-jlink-tech-preview:${BUILDER_IMAGE_TAG} # Refer README.md to create this ImageStream output: to: kind: ImageStreamTag - name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest + name: ${APPNAME}-openjdk-${JDK_VERSION}-jlink-tech-preview:latest triggers: - type: ConfigChange - type: ImageChange imageChange: from: kind: ImageStreamTag - name: ubi9-openjdk-${JDK_VERSION}:${BUILDER_IMAGE_TAG} + name: openjdk-${JDK_VERSION}-jlink-tech-preview:${BUILDER_IMAGE_TAG} ############################################################################## # stage-2: Output ImageStream - apiVersion: image.openshift.io/v1 @@ -119,7 +119,7 @@ objects: sourceStrategy: from: kind: ImageStreamTag - name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output Imagestream from stage-1 + name: ${APPNAME}-openjdk-${JDK_VERSION}-jlink-tech-preview:latest # Output Imagestream from stage-1 pullPolicy: Always env: - name: S2I_ENABLE_JLINK @@ -136,7 +136,7 @@ objects: imageChange: from: kind: ImageStreamTag - name: ${APPNAME}-ubi9-openjdk-${JDK_VERSION}-jlink:latest # Output of stage-1 which serves as input to stage-2 + name: ${APPNAME}-openjdk-${JDK_VERSION}-jlink-tech-preview:latest # Output of stage-1 which serves as input to stage-2 - type: GitHub github: secret: ${GITHUB_WEBHOOK_SECRET} From d38995e4b954e3a10ec0973162abe690c7c895e0 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 18 Feb 2025 15:57:19 -0500 Subject: [PATCH 105/132] Add test to check that /tmp/jre exists when jlink is enabled --- modules/jlink/tests/features/jlink.feature | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index 8594a6f0..8e1cba78 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -12,3 +12,10 @@ Scenario: Ensure S2I_ENABLE_JLINK is not set to true Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i Then container log should not contain S2I_ENABLE_JLINK=true And run bash -c "test ! -d /tmp/jre && echo PASS" in container and immediately check its output for PASS + +Scenario: Check that /tmp/jre/bin/java and /tmp/jre/lib/modules exist post s2i build if jlink is enabled. + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i + | variable | value | + | S2I_ENABLE_JLINK | true | + Then container log should contain S2I_ENABLE_JLINK=true + and run bash -c "test -d /tmp/jre/bin/java && test -d /tmp/jre/lib/modules && echo PASS" in container and immediately check its output for PASS From 6a8f07be18b6617363b06390760957cff61c3542 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 18 Feb 2025 16:14:58 -0500 Subject: [PATCH 106/132] Update test application --- modules/jlink/tests/features/jlink.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index 8e1cba78..80956287 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -14,7 +14,7 @@ Scenario: Ensure S2I_ENABLE_JLINK is not set to true And run bash -c "test ! -d /tmp/jre && echo PASS" in container and immediately check its output for PASS Scenario: Check that /tmp/jre/bin/java and /tmp/jre/lib/modules exist post s2i build if jlink is enabled. - Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i + Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.9.2-uberjar | variable | value | | S2I_ENABLE_JLINK | true | Then container log should contain S2I_ENABLE_JLINK=true From 29f7c36695981d26c9bfb35a632f7dd58b740bfe Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 18 Feb 2025 16:28:10 -0500 Subject: [PATCH 107/132] Update README for appname parameter and docker tags --- templates/jlink/README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index e1e29a95..8cccd88e 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -37,8 +37,8 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. 5. tag and push the dev image into it. The OpenShift console gives you the exact URI for your instance - docker tag openjdk-tech-preview/openjdk-21-jlink-rhel9:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-21-jlink-tech-preview:1.18 - docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-21:1.18 + docker tag openjdk-tech-preview/openjdk-21-jlink-rhel9:latest default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-21-jlink-tech-preview:latest + docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-21:latest ## Stage 1: Load the template into OpenShift and instantiate it @@ -77,16 +77,18 @@ See all the OpenShift objects that were created: There will be three BuildConfigs, called something like -1. jlink-builder-jdk-21 -2. jlink-s2i-jdk-21 -3. multistage-buildconfig +1. $APPNAME-jlink-builder-jdk-21 +2. $APPNAME-jlink-s2i-jdk-21 +3. $APPNAME-multistage-buildconfig + +Where $APPNAME is the parameter initially passed to the template. Start a build for (1). Once complete, builds for (2) and (3) should be automatically triggered in sequence. ## Stage 4: create deployment -The ImageStreamTag `lightweight-image:latest` will be populated with the new +The ImageStreamTag `$APPNAME-lightweight-image:latest` will be populated with the new application container image. Create a deployment to see it work. E.g., in the Developer Perspective, select From 9dce7671045cbc18190c38dfb7f648cdae4fbf3b Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 25 Feb 2025 22:31:45 -0500 Subject: [PATCH 108/132] Update README with warning about projects, convert DeploymentConfig to Deployment --- templates/jlink/README.md | 17 ++++++++++++----- templates/jlink/jlinked-app.yaml | 30 +++++++++++------------------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index e9c03c9a..76d04ad2 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -7,6 +7,8 @@ you need: 2. UBI9 OpenJDK ImageStreams that include `jlink-dev` changes (see below) 3. The template [jlinked-app.yaml](jlinked-app.yaml). +DISCLAIMER: This template requires OpenShift to be able to resolve ImageStreams, as such it can only be used in projects where the openshift.io/run-level label set to 0 or 1. This means it cannot be used with default, kube-public, kube-system, openshift, openshift-infra, openshift-node, and other system-created projects. + ## Stage 0: UBI9 OpenJDK ImageStreams with jlink-dev changes Until the `jlink-dev` work is merged, prior to trying out the template, we must first @@ -18,11 +20,16 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. cekit --descriptor ubi9-openjdk-17.yaml build docker -2. Within your OpenShift project, +2. Create an OpenShift project and namespace + + oc new-project jlink-dev + oc create namespace jlink + +3. Within your OpenShift project, oc create imagestream openjdk-17-jlink-tech-preview -3. You may need to configure your container engine to not TLS-verify the OpenShift +4. You may need to configure your container engine to not TLS-verify the OpenShift registry. For Docker, add the following to `/etc/docker/daemon.json` and restart the daemon: @@ -30,11 +37,11 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. "insecure-registries": [ "default-route-openshift-image-registry.apps-crc.testing" ] } -4. Log into the OpenShift registry, e.g. +5. Log into the OpenShift registry, e.g. REGISTRY_AUTH_PREFERENCE=docker oc registry login -5. tag and push the dev image into it. The OpenShift console gives you the +6. tag and push the dev image into it. The OpenShift console gives you the exact URI for your instance docker tag openjdk-tech-preview/openjdk-17-jlink-rhel9:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/openjdk-17-jlink-tech-preview:1.18 @@ -52,7 +59,7 @@ Process it to create the needed objects. You can list the parameters using Some suitable test values for the parameters are - * JDK_VERSION: 17 + * JDK_VERSION: 21 * APP_URI: https://github.com/jboss-container-images/openjdk-test-applications * REF: master * CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 65b45e45..1b65467a 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -10,7 +10,7 @@ metadata: parameters: - description: JDK version to produce a jmods image and imagestream for name: JDK_VERSION - value: "11" + value: "21" required: true - description: OpenJDK builder image version tag name: BUILDER_IMAGE_TAG @@ -182,7 +182,8 @@ objects: app.kubernetes.io/part-of: ${APPNAME} spec: lookupPolicy: - local: false + # Must be true for the Deployment to resolve the ImageStream + local: true ############################################################################## # stage-3: BuildConfig - apiVersion: build.openshift.io/v1 @@ -248,24 +249,26 @@ objects: # DeploymentConfig and Route object specs # DeploymentConfigs are discouraged, however the documentation sugggests to still # use them if features are missing from Deployments, which in our case they are. -- apiVersion: apps.openshift.io/v1 - kind: DeploymentConfig +- apiVersion: apps/v1 + kind: Deployment metadata: name: ${APPNAME}-jlinked-app-deployment - annotations: - template.alpha.openshift.io/wait-for-ready: "true" labels: app: ${APPNAME} app.kubernetes.io/part-of: ${APPNAME} spec: replicas: 1 selector: - app: ${APPNAME} + matchLabels: + app: ${APPNAME} template: metadata: labels: app: ${APPNAME} app.kubernetes.io/part-of: ${APPNAME} + annotations: + # Allows Deployments to use ImageStreams + alpha.image.policy.openshift.io/resolve-names: '*' spec: containers: - name: ${APPNAME}-jlinked-app-container @@ -274,18 +277,7 @@ objects: - containerPort: ${{TARGET_PORT}} protocol: TCP strategy: - type: Rolling - triggers: - - type: ImageChange - imageChangeParams: - automatic: true - containerNames: - - ${APPNAME}-jlinked-app-container - from: - kind: ImageStreamTag - name: '${APPNAME}-lightweight-image:latest' - namespace: default - - type: ConfigChange + type: RollingUpdate - apiVersion: v1 kind: Service metadata: From b566af7e075f22ba5c4015fc72a13c293f8a18a2 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 25 Feb 2025 22:38:18 -0500 Subject: [PATCH 109/132] Fix imagestream name, docker commands --- templates/jlink/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 8cccd88e..ea4c9f69 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -20,7 +20,7 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. 2. Within your OpenShift project, - oc create imagestream ubi9-openjdk-21-jlink-tech-preview + oc create imagestream openjdk-${JDK_VERSION}-jlink-tech-preview 3. You may need to configure your container engine to not TLS-verify the OpenShift registry. For Docker, add the following to `/etc/docker/daemon.json` and restart @@ -37,8 +37,8 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. 5. tag and push the dev image into it. The OpenShift console gives you the exact URI for your instance - docker tag openjdk-tech-preview/openjdk-21-jlink-rhel9:latest default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-21-jlink-tech-preview:latest - docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-21:latest + docker tag openjdk-tech-preview/openjdk-21-jlink-rhel9:latest default-route-openshift-image-registry.apps-crc.testing/jlink1/openjdk-21-jlink-tech-preview:latest + docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/openjdk-21-jlink-tech-preview:latest ## Stage 1: Load the template into OpenShift and instantiate it From 7793e2a33b2823db556aeb62c8b6b4d2ef361e45 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Fri, 28 Feb 2025 13:53:22 -0500 Subject: [PATCH 110/132] README fixes --- templates/jlink/README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 76d04ad2..76e77aed 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -18,16 +18,15 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. repository](https://github.com/jboss-container-images/openjdk), branch `jlink-dev`. e.g. - cekit --descriptor ubi9-openjdk-17.yaml build docker + cekit --descriptor ubi9-openjdk-21.yaml build podman -2. Create an OpenShift project and namespace +2. Create an OpenShift project - oc new-project jlink-dev - oc create namespace jlink + oc new-project $PROJECT 3. Within your OpenShift project, - oc create imagestream openjdk-17-jlink-tech-preview + oc create imagestream openjdk-21-jlink-tech-preview 4. You may need to configure your container engine to not TLS-verify the OpenShift registry. For Docker, add the following to `/etc/docker/daemon.json` and restart @@ -44,8 +43,8 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. 6. tag and push the dev image into it. The OpenShift console gives you the exact URI for your instance - docker tag openjdk-tech-preview/openjdk-17-jlink-rhel9:1.18 default-route-openshift-image-registry.apps-crc.testing/jlink1/openjdk-17-jlink-tech-preview:1.18 - docker push default-route-openshift-image-registry.apps-crc.testing/jlink1/ubi9-openjdk-17:1.18 + podman tag openjdk-tech-preview/openjdk-21-jlink-rhel9:1.18 default-route-openshift-image-registry.apps-crc.testing/$PROJECT/openjdk-21-jlink-tech-preview:1.18 + podman push default-route-openshift-image-registry.apps-crc.testing/$PROJECT/openjdk-21-jlink-tech-preview:1.18 ## Stage 1: Load the template into OpenShift and instantiate it From 31708a37b97f2036e81da5058a47e5cb5925851e Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 4 Mar 2025 11:39:25 +0000 Subject: [PATCH 111/132] [OPENJDK-3647] adjust jlink Behave tests Some behavioural change (S2I_ENABLE_JLINK is not echoed in the logs); fix syntax of final test; adjust approach used to check for the presence or absence of files and directories. Signed-off-by: Jonathan Dowland --- modules/jlink/tests/features/jlink.feature | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index 80956287..ebeb5c4d 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -1,21 +1,20 @@ -@ubi9/openjdk-17 @openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK S2I tests (jlink specific) Scenario: tech preview warning is printed (OPENJDK-3038) - Given failing s2i build https://github.com/jboss-container-images/openjdk-test-applications from spring-boot-sample-simple/target using master + Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from spring-boot-sample-simple/target using master | variable | value | | S2I_ENABLE_JLINK | true | Then s2i build log should contain Jlink integration is a Tech Preview feature Scenario: Ensure S2I_ENABLE_JLINK is not set to true - Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.0.1.Final-nos2i - Then container log should not contain S2I_ENABLE_JLINK=true - And run bash -c "test ! -d /tmp/jre && echo PASS" in container and immediately check its output for PASS + Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from spring-boot-sample-simple/target using master + Then s2i build log should not contain Jlink integration is a Tech Preview feature + And file /tmp/jre should not exist Scenario: Check that /tmp/jre/bin/java and /tmp/jre/lib/modules exist post s2i build if jlink is enabled. - Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from quarkus-quickstarts/getting-started-3.9.2-uberjar + Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from quarkus-quickstarts/getting-started-3.9.2-uberjar | variable | value | | S2I_ENABLE_JLINK | true | - Then container log should contain S2I_ENABLE_JLINK=true - and run bash -c "test -d /tmp/jre/bin/java && test -d /tmp/jre/lib/modules && echo PASS" in container and immediately check its output for PASS + Then file /tmp/jre/bin/java should exist and be a file + And file /tmp/jre/lib/modules should exist and be a file From 0b86528fdad308ed1fd4202281ca05f0ad33f3b6 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 4 Mar 2025 13:05:10 -0500 Subject: [PATCH 112/132] Remove jmods rpm installation from stage 1 --- templates/jlink/jlinked-app.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/jlink/jlinked-app.yaml b/templates/jlink/jlinked-app.yaml index 1b65467a..79b200af 100644 --- a/templates/jlink/jlinked-app.yaml +++ b/templates/jlink/jlinked-app.yaml @@ -71,7 +71,6 @@ objects: FROM - RUN if [ ! -f "/opt/jboss/container/java/jlink/preflight.sh" ]; then echo "jlink scripts doesn't exist" 2>&1; exit 1; fi USER 0 - RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y java-${JDK_VERSION}-openjdk-jmods RUN mkdir -p /mnt/jrootfs RUN microdnf install --installroot /mnt/jrootfs --releasever 9 --setopt install_weak_deps=0 --nodocs -y \ --config=/etc/dnf/dnf.conf \ From 4563d8e6070ca6bde44f565a0d5f0564f37eed3e Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 4 Mar 2025 14:04:11 -0500 Subject: [PATCH 113/132] Create temporary jlink files under /tmp/jlink, clean up based on S2I_DELETE_SOURCE --- .../jboss/container/java/jlink/generatejdkdeps.sh | 8 ++++---- .../opt/jboss/container/java/jlink/mkdeps.sh | 6 +++--- .../opt/jboss/container/java/jlink/mkjreimage.sh | 2 +- .../opt/jboss/container/java/jlink/mkstrippeddeps.sh | 4 ++-- modules/jlink/module.yaml | 2 ++ modules/s2i/bash/artifacts/usr/local/s2i/assemble | 12 ++++++++++++ 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/generatejdkdeps.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/generatejdkdeps.sh index 8f59d56c..c7a1fe40 100755 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/generatejdkdeps.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/generatejdkdeps.sh @@ -2,8 +2,8 @@ function generatejdkdeps() { echo "Generating JDK deps" - $JAVA_HOME/bin/java --list-modules > java-modules.txt - < java-modules.txt sed "s/\\@.*//" > modules.txt - grep -Fx -f stripped-deps.txt modules.txt | tr '\n' ',' | tr -d "[:space:]" > module-deps.txt - echo "jdk.zipfs" >> module-deps.txt + $JAVA_HOME/bin/java --list-modules > $S2I_JLINK_TEMP_PATH/java-modules.txt + < $S2I_JLINK_TEMP_PATH/java-modules.txt sed "s/\\@.*//" > $S2I_JLINK_TEMP_PATH/modules.txt + grep -Fx -f $S2I_JLINK_TEMP_PATH/stripped-deps.txt $S2I_JLINK_TEMP_PATH/modules.txt | tr '\n' ',' | tr -d "[:space:]" > $S2I_JLINK_TEMP_PATH/module-deps.txt + echo "jdk.zipfs" >> $S2I_JLINK_TEMP_PATH/module-deps.txt } \ No newline at end of file diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh index 7a53e782..938e3db0 100755 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh @@ -21,12 +21,12 @@ function generate_deps() { --module-path dependencies \ "$JAVA_APP_JAR" \ "$JAVA_LIB_DIR"/**/*.jar \ - > deps.txt + > $S2I_JLINK_TEMP_PATH/deps.txt else $JAVA_HOME/bin/jdeps --multi-release $JAVA_VERSION -R -s \ --module-path dependencies \ "$JAVA_APP_JAR" \ - > deps.txt - cat deps.txt + > $S2I_JLINK_TEMP_PATH/deps.txt + cat $S2I_JLINK_TEMP_PATH/deps.txt fi } diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkjreimage.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkjreimage.sh index e2b5366f..7063e4e8 100755 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkjreimage.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkjreimage.sh @@ -2,7 +2,7 @@ # TODO: Still Needed? set -euo pipefail -depsfile="module-deps.txt" +depsfile="$S2I_JLINK_TEMP_PATH/module-deps.txt" function generate_jre_image() { test -f $depsfile diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkstrippeddeps.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkstrippeddeps.sh index 0b9e0742..000a860e 100755 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkstrippeddeps.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkstrippeddeps.sh @@ -2,7 +2,7 @@ set -euo pipefail function mkstrippeddeps() { - if [ -f "deps.txt" ]; then + if [ -f "$S2I_JLINK_TEMP_PATH/deps.txt" ]; then echo "deps exists, filtering" /dev/null)" ]; then + log_info "Cleaning up temporary file directory /tmp/jlink" + rm -rf /tmp/jlink + fi +fi \ No newline at end of file From dd54f04a8260f187ad7f0e4eb73c1ed71502079b Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 4 Mar 2025 14:32:32 -0500 Subject: [PATCH 114/132] Correct delete source check to use variable rather than hardcoded path --- modules/s2i/bash/artifacts/usr/local/s2i/assemble | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/s2i/bash/artifacts/usr/local/s2i/assemble b/modules/s2i/bash/artifacts/usr/local/s2i/assemble index 088ce675..4fbb6e1e 100644 --- a/modules/s2i/bash/artifacts/usr/local/s2i/assemble +++ b/modules/s2i/bash/artifacts/usr/local/s2i/assemble @@ -29,7 +29,7 @@ if [ "$S2I_ENABLE_JLINK" = "true" ]; then log_info "S2I_JLINK_TEMP_PATH does not exist, creating ${S2I_JLINK_TEMP_PATH}" mkdir -pm 775 "${S2I_JLINK_TEMP_PATH}" fi - + source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh" echo "Invoking mkdeps" generate_deps || { @@ -61,8 +61,8 @@ if [ "$S2I_ENABLE_JLINK" = "true" ]; then fi if [ "$S2I_DELETE_SOURCE" == "true" ]; then - if [ -n "$(find /tmp/jlink -maxdepth 0 -type d ! -empty 2> /dev/null)" ]; then - log_info "Cleaning up temporary file directory /tmp/jlink" - rm -rf /tmp/jlink + if [ -n "$(find $S2I_JLINK_TEMP_PATH -maxdepth 0 -type d ! -empty 2> /dev/null)" ]; then + log_info "Cleaning up temporary file directory $S2I_JLINK_TEMP_PATH" + rm -rf $S2I_JLINK_TEMP_PATH fi fi \ No newline at end of file From a4f482b40eda5abfea1712cff1f7a69abe8ec1e9 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 5 Mar 2025 08:57:09 +0000 Subject: [PATCH 115/132] [OPENJDK-3683] revert change to GHA image name This variable is used to find the image descriptor which hasn't been renamed. This commit should fix the GHA jobs. Signed-off-by: Jonathan Dowland --- .github/workflows/ubi9-openjdk-21.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubi9-openjdk-21.yml b/.github/workflows/ubi9-openjdk-21.yml index 28d4080b..3b23687e 100644 --- a/.github/workflows/ubi9-openjdk-21.yml +++ b/.github/workflows/ubi9-openjdk-21.yml @@ -2,9 +2,9 @@ name: UBI9 OpenJDK 21 S2I Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - IMAGE: openjdk-21-jlink-rhel9 + IMAGE: ubi9-openjdk-21 jobs: call-openjdkci: uses: ./.github/workflows/image-workflow-template.yml with: - image: openjdk-21-jlink-rhel9 + image: ubi9-openjdk-21 From ccfa477aa00a3dbc540815856ebee9429a8d415a Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 5 Mar 2025 12:48:42 -0500 Subject: [PATCH 116/132] Address review feedback --- .../opt/jboss/container/java/jlink/mkstrippeddeps.sh | 2 +- modules/s2i/bash/artifacts/usr/local/s2i/assemble | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkstrippeddeps.sh b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkstrippeddeps.sh index 000a860e..0f6c7e64 100755 --- a/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkstrippeddeps.sh +++ b/modules/jlink/artifacts/opt/jboss/container/java/jlink/mkstrippeddeps.sh @@ -4,7 +4,7 @@ set -euo pipefail function mkstrippeddeps() { if [ -f "$S2I_JLINK_TEMP_PATH/deps.txt" ]; then echo "deps exists, filtering" - //" | # remove src of src -> dep diff --git a/modules/s2i/bash/artifacts/usr/local/s2i/assemble b/modules/s2i/bash/artifacts/usr/local/s2i/assemble index 4fbb6e1e..66190688 100644 --- a/modules/s2i/bash/artifacts/usr/local/s2i/assemble +++ b/modules/s2i/bash/artifacts/usr/local/s2i/assemble @@ -58,11 +58,11 @@ if [ "$S2I_ENABLE_JLINK" = "true" ]; then exit 1 } + if [ "$S2I_DELETE_SOURCE" == "true" ]; then + if [ -n "$(find $S2I_JLINK_TEMP_PATH -maxdepth 0 -type d ! -empty 2> /dev/null)" ]; then + log_info "Cleaning up temporary file directory $S2I_JLINK_TEMP_PATH" + rm -rf $S2I_JLINK_TEMP_PATH + fi + fi fi -if [ "$S2I_DELETE_SOURCE" == "true" ]; then - if [ -n "$(find $S2I_JLINK_TEMP_PATH -maxdepth 0 -type d ! -empty 2> /dev/null)" ]; then - log_info "Cleaning up temporary file directory $S2I_JLINK_TEMP_PATH" - rm -rf $S2I_JLINK_TEMP_PATH - fi -fi \ No newline at end of file From 4ddcde6aabfb94c5fdd6902a19fc51095011773a Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Wed, 5 Mar 2025 13:04:08 -0500 Subject: [PATCH 117/132] Add behave test --- modules/jlink/tests/features/jlink.feature | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index ebeb5c4d..e5610939 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -18,3 +18,11 @@ Scenario: Check that /tmp/jre/bin/java and /tmp/jre/lib/modules exist post s2i b | S2I_ENABLE_JLINK | true | Then file /tmp/jre/bin/java should exist and be a file And file /tmp/jre/lib/modules should exist and be a file + +Scenario: Check that /tmp/jlink is deleted when S2I_DELETE_SOURCE is set + Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from quarkus-quickstarts/getting-started-3.9.2-uberjar + | variable | value | + | S2I_ENABLE_JLINK | true | + | S2I_DELETE_SOURCE | true | + Then s2i build log should contain Cleaning up temporary file directory /tmp/jlink + And file /tmp/jlink should not exist \ No newline at end of file From ec538a02df8f2c6b2b9e4fb0c68ac2798d0b74a3 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Thu, 6 Mar 2025 12:32:58 -0500 Subject: [PATCH 118/132] Add second behave test --- modules/jlink/tests/features/jlink.feature | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/jlink/tests/features/jlink.feature b/modules/jlink/tests/features/jlink.feature index e5610939..1a60593e 100644 --- a/modules/jlink/tests/features/jlink.feature +++ b/modules/jlink/tests/features/jlink.feature @@ -25,4 +25,12 @@ Scenario: Check that /tmp/jlink is deleted when S2I_DELETE_SOURCE is set | S2I_ENABLE_JLINK | true | | S2I_DELETE_SOURCE | true | Then s2i build log should contain Cleaning up temporary file directory /tmp/jlink - And file /tmp/jlink should not exist \ No newline at end of file + And file /tmp/jlink should not exist + +Scenario: Check that /tmp/jlink is not deleted when S2I_DELETE_SOURCE is set to false + Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications from quarkus-quickstarts/getting-started-3.9.2-uberjar + | variable | value | + | S2I_ENABLE_JLINK | true | + | S2I_DELETE_SOURCE | false | + Then s2i build log should not contain Cleaning up temporary file directory /tmp/jlink + And file /tmp/jlink should exist \ No newline at end of file From d0125f363281ed75f74f394d420ad825edd20ca2 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Fri, 7 Mar 2025 15:26:03 +0000 Subject: [PATCH 119/132] Revert "Extend GHA to push images that pass tests" This reverts commit 4967f2c989089f323aa1a1d3fadc505608abaa52. Should address OPENJDK-3680. --- .github/workflows/image-workflow-template.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/image-workflow-template.yml b/.github/workflows/image-workflow-template.yml index 766f45cf..7674a047 100644 --- a/.github/workflows/image-workflow-template.yml +++ b/.github/workflows/image-workflow-template.yml @@ -7,11 +7,8 @@ on: type: string env: LANG: en_US.UTF-8 - IMAGE_URI: ghcr.io/jboss-container-images/${{ inputs.image }}:${{ github.ref_name }} jobs: openjdkci: - permissions: - packages: write name: OpenJDK S2I Build and Test timeout-minutes: 60 runs-on: ubuntu-latest @@ -27,7 +24,7 @@ jobs: - name: Build run: | - cekit -v --descriptor ${{ inputs.image }}.yaml build docker --no-squash --tag localimage + cekit -v --descriptor ${{ inputs.image }}.yaml build docker --no-squash - name: Install and cache S2I CLI tool from GitHub uses: redhat-actions/openshift-tools-installer@v1 From 37c1153e4273a36827d96d7b8e9dd0e6e4b0cab4 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 11 Mar 2025 13:05:20 -0400 Subject: [PATCH 120/132] Remove measure.sh --- measure.sh | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 measure.sh diff --git a/measure.sh b/measure.sh deleted file mode 100644 index f32f4426..00000000 --- a/measure.sh +++ /dev/null @@ -1,51 +0,0 @@ -# script to measure the sizes (and size savings) - -S2I=${S2I-s2i} -ENGINE=${ENGINE-docker} # or e.g. podman -BASEIMG=registry.access.redhat.com/ubi9/openjdk-17:latest -APPSRC=https://github.com/quarkusio/quarkus-quickstarts -CONTEXTDIR=getting-started -rev=3.6.6 -OUTIMG=out-s2i-image - -# first build the image using shipped builder images -$S2I build --pull-policy never \ - -e MAVEN_S2I_ARTIFACT_DIRS=target \ - -e S2I_SOURCE_DEPLOYMENTS_FILTER="*.jar quarkus-app" \ - -e QUARKUS_PACKAGE_TYPE=uber-jar \ - -e MAVEN_CLEAR_REPO=true \ - -e JAVA_APP_JAR=getting-started-1.0.0-SNAPSHOT-runner.jar \ - --context-dir=$CONTEXTDIR -r=${rev} \ - $APPSRC \ - $BASEIMG \ - $OUTIMG - -echo "baseline (simple S2I output):" -${ENGINE} inspect -f '{{.Size}}' $OUTIMG - -# second, do a build with the image from jlink-dev branch -# make sure it's been built! -# NOTE: we override most variables from .s2i/environment in the quickstart -# sources below, in order to an uber-jar. -BASEIMG=ubi9/openjdk-17:latest -OUTIMG=ubi9-jlinked-image # matches input in templates/jlink/Dockerfile - -$S2I build --pull-policy never \ - -e S2I_ENABLE_JLINK=true \ - -e MAVEN_S2I_ARTIFACT_DIRS=target \ - -e S2I_SOURCE_DEPLOYMENTS_FILTER="*.jar quarkus-app" \ - -e QUARKUS_PACKAGE_TYPE=uber-jar \ - -e JAVA_APP_JAR=getting-started-1.0.0-SNAPSHOT-runner.jar \ - --context-dir=$CONTEXTDIR -r=${rev} \ - $APPSRC \ - $BASEIMG \ - $OUTIMG - -echo "intermediate jlink image size:" -docker inspect -f '{{.Size}}' $OUTIMG - -# third, run the above thru the second-stage process -OUTIMG=jlink-final -${ENGINE} build -t "$OUTIMG" templates/jlink -echo "final jlinked image size:" -docker inspect -f '{{.Size}}' "$OUTIMG" From 6fc07ed9b7e5c6d44169d42b6f469d15a05d0182 Mon Sep 17 00:00:00 2001 From: jmatsuok Date: Tue, 11 Mar 2025 13:24:54 -0400 Subject: [PATCH 121/132] Correct org.opencontainers.image.source --- ubi9-openjdk-11-runtime.yaml | 2 +- ubi9-openjdk-11.yaml | 2 +- ubi9-openjdk-17-runtime.yaml | 2 +- ubi9-openjdk-17.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ubi9-openjdk-11-runtime.yaml b/ubi9-openjdk-11-runtime.yaml index 80612ae8..12db02e8 100644 --- a/ubi9-openjdk-11-runtime.yaml +++ b/ubi9-openjdk-11-runtime.yaml @@ -23,7 +23,7 @@ labels: - name: "com.redhat.license_terms" value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" - name: "org.opencontainers.image.source" - value: "https://github.com/jboss-container-images/openjdk" + value: "https://github.com/rh-openjdk/redhat-openjdk-containers" - name: "org.opencontainers.image.documentation" value: *docs - name: "name" diff --git a/ubi9-openjdk-11.yaml b/ubi9-openjdk-11.yaml index 87373f79..8e8773d4 100644 --- a/ubi9-openjdk-11.yaml +++ b/ubi9-openjdk-11.yaml @@ -23,7 +23,7 @@ labels: - name: "com.redhat.license_terms" value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" - name: "org.opencontainers.image.source" - value: "https://github.com/jboss-container-images/openjdk" + value: "https://github.com/rh-openjdk/redhat-openjdk-containers" - name: "org.opencontainers.image.documentation" value: *docs - name: "name" diff --git a/ubi9-openjdk-17-runtime.yaml b/ubi9-openjdk-17-runtime.yaml index 57a7d438..6684d56e 100644 --- a/ubi9-openjdk-17-runtime.yaml +++ b/ubi9-openjdk-17-runtime.yaml @@ -23,7 +23,7 @@ labels: - name: "com.redhat.license_terms" value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" - name: "org.opencontainers.image.source" - value: "https://github.com/jboss-container-images/openjdk" + value: "https://github.com/rh-openjdk/redhat-openjdk-containers" - name: "org.opencontainers.image.documentation" value: *docs - name: "name" diff --git a/ubi9-openjdk-17.yaml b/ubi9-openjdk-17.yaml index b9c1ef03..e7529676 100644 --- a/ubi9-openjdk-17.yaml +++ b/ubi9-openjdk-17.yaml @@ -23,7 +23,7 @@ labels: - name: "com.redhat.license_terms" value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" - name: "org.opencontainers.image.source" - value: "https://github.com/jboss-container-images/openjdk" + value: "https://github.com/rh-openjdk/redhat-openjdk-containers" - name: "org.opencontainers.image.documentation" value: *docs - name: "name" From 9ab88accef24dec8dbc6c7fbb78b89ef8d7f9d25 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 9 Apr 2025 14:14:37 +0100 Subject: [PATCH 122/132] [OPENJDK-3686] update jlink README with RHEC link, customer focus Signed-off-by: Jonathan Dowland --- templates/jlink/README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index c8d43dd6..7dd18561 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -11,11 +11,12 @@ DISCLAIMER: This template requires OpenShift to be able to resolve ImageStreams, ## Stage 0: UBI9 OpenJDK ImageStreams with jlink-dev changes -Until the `jlink-dev` work is merged, prior to trying out the template, we must first -prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. +Whilst the `jlink-dev` feature is in Tech Preview, we must prepare separate +UBI9 OpenJDK ImageStreams with `jlink-dev` support. -1. Build a suitable OpenJDK container image from [this - repository](https://github.com/jboss-container-images/openjdk), +1. Obtain a suitable OpenJDK container image with Jlink integration. + Either download [the Tech Preview Image](https://catalog.redhat.com/software/containers/openjdk-tech-preview/openjdk-21-jlink-rhel9/678e61ffd77a3837d6962f3f?), + or build your own from [this repository](https://github.com/jboss-container-images/openjdk), branch `jlink-dev`. e.g. cekit --descriptor ubi9-openjdk-21.yaml build podman @@ -36,10 +37,20 @@ prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. "insecure-registries": [ "default-route-openshift-image-registry.apps-crc.testing" ] } + For podman, add the following to `~/.config/containers/registries.conf`: + + [[registry]] + location = "default-route-openshift-image-registry.apps-crc.testing" + insecure = true + 5. Log into the OpenShift registry, e.g. REGISTRY_AUTH_PREFERENCE=docker oc registry login + or + + oc registry login + 6. tag and push the dev image into it. The OpenShift console gives you the exact URI for your instance From 406b3b718f8d0a0084838958083fa2289f817ff8 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 15 Apr 2025 16:31:40 +0100 Subject: [PATCH 123/132] Update the example APP_URI and CONTEXT_DIR Signed-off-by: Jonathan Dowland --- templates/jlink/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index c8d43dd6..665d2a7a 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -59,18 +59,18 @@ Process it to create the needed objects. You can list the parameters using Some suitable test values for the parameters are * JDK_VERSION: 21 - * APP_URI: https://github.com/jboss-container-images/openjdk-test-applications + * APP_URI: https://github.com/rh-openjdk/openjdk-container-test-applications * REF: master - * CONTEXT_DIR: quarkus-quickstarts/getting-started-3.9.2-uberjar + * CONTEXT_DIR: quarkus-quickstarts/getting-started-3.21.2-uberjar * APPNAME: quarkus-quickstart * TARGET_PORT: 8080 * SERVICE_PORT: 8080 oc process \ -p JDK_VERSION=21 \ - -p APP_URI=https://github.com/jboss-container-images/openjdk-test-applications \ + -p APP_URI=https://github.com/rh-openjdk/openjdk-container-test-applications \ -p REF=master \ - -p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.9.2-uberjar \ + -p CONTEXT_DIR=quarkus-quickstarts/getting-started-3.21.2-uberjar \ -p APPNAME=quarkus-quickstart \ -p TARGET_PORT=8080 \ -p SERVICE_PORT=8080 \ From 917c54537d2c9e17ec64e7de19d31e02ea8a5855 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland <63694+jmtd@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:33:10 +0100 Subject: [PATCH 124/132] Update README.md: suggest pulling TP image --- templates/jlink/README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index c8d43dd6..69f15276 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -14,9 +14,17 @@ DISCLAIMER: This template requires OpenShift to be able to resolve ImageStreams, Until the `jlink-dev` work is merged, prior to trying out the template, we must first prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. -1. Build a suitable OpenJDK container image from [this - repository](https://github.com/jboss-container-images/openjdk), - branch `jlink-dev`. e.g. +1.a. Pull the Tech-Preview image + + podman pull registry.access.redhat.com/openjdk-tech-preview/openjdk-21-jlink-rhel9:latest + podman tag registry.access.redhat.com/openjdk-tech-preview/openjdk-21-jlink-rhel9:latest \ + openjdk-tech-preview/openjdk-21-jlink-rhel9:latest + +OR + +1.b. Build a suitable OpenJDK container image from [this + repository](https://github.com/jboss-container-images/openjdk), + branch `jlink-dev`. e.g. cekit --descriptor ubi9-openjdk-21.yaml build podman From 605bf8927ca2c6add08634672d33079063b8f873 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland <63694+jmtd@users.noreply.github.com> Date: Tue, 22 Apr 2025 09:34:10 +0100 Subject: [PATCH 125/132] Update README.md: fix list syntax --- templates/jlink/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/jlink/README.md b/templates/jlink/README.md index 69f15276..fbc2e406 100644 --- a/templates/jlink/README.md +++ b/templates/jlink/README.md @@ -14,17 +14,17 @@ DISCLAIMER: This template requires OpenShift to be able to resolve ImageStreams, Until the `jlink-dev` work is merged, prior to trying out the template, we must first prepare UBI9 OpenJDK ImageStreams with `jlink-dev` support. -1.a. Pull the Tech-Preview image +1. Pull the Tech-Preview image - podman pull registry.access.redhat.com/openjdk-tech-preview/openjdk-21-jlink-rhel9:latest - podman tag registry.access.redhat.com/openjdk-tech-preview/openjdk-21-jlink-rhel9:latest \ - openjdk-tech-preview/openjdk-21-jlink-rhel9:latest + podman pull registry.access.redhat.com/openjdk-tech-preview/openjdk-21-jlink-rhel9:latest + podman tag registry.access.redhat.com/openjdk-tech-preview/openjdk-21-jlink-rhel9:latest \ + openjdk-tech-preview/openjdk-21-jlink-rhel9:latest OR -1.b. Build a suitable OpenJDK container image from [this - repository](https://github.com/jboss-container-images/openjdk), - branch `jlink-dev`. e.g. +1. Build a suitable OpenJDK container image from [this + repository](https://github.com/jboss-container-images/openjdk), + branch `jlink-dev`. e.g. cekit --descriptor ubi9-openjdk-21.yaml build podman From e54b04431089e0489214034c3d2c1962de8175d1 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 23 Jul 2025 15:28:25 +0100 Subject: [PATCH 126/132] restore JDK21 tags to tests Signed-off-by: Jonathan Dowland --- modules/jvm/tests/features/memory.feature | 1 + modules/jvm/tests/features/runtime.feature | 1 + modules/maven/s2i/tests/features/java_s2i.feature | 1 + modules/maven/s2i/tests/features/java_s2i_inc.feature | 1 + modules/run/tests/features/java.security.feature | 1 + tests/features/imagebasic.feature | 1 + tests/features/java/ports.feature | 1 + 7 files changed, 7 insertions(+) diff --git a/modules/jvm/tests/features/memory.feature b/modules/jvm/tests/features/memory.feature index 621cc4be..8b5f465d 100644 --- a/modules/jvm/tests/features/memory.feature +++ b/modules/jvm/tests/features/memory.feature @@ -35,6 +35,7 @@ Feature: OPENJDK-559 JVM Memory tests # Not the runtime images @ubi9/openjdk-11 @ubi9/openjdk-17 + @ubi9/openjdk-21 @openjdk-tech-preview/openjdk-21-jlink-rhel9 Scenario: Ensure Maven doesn't use MaxRAMPercentage=80 Given s2i build https://github.com/rh-openjdk/openjdk-container-test-applications.git from spring-boot-sample-simple diff --git a/modules/jvm/tests/features/runtime.feature b/modules/jvm/tests/features/runtime.feature index 62679e9c..86aabf1f 100644 --- a/modules/jvm/tests/features/runtime.feature +++ b/modules/jvm/tests/features/runtime.feature @@ -1,5 +1,6 @@ @ubi9/openjdk-11 @ubi9/openjdk-17 +@ubi9/openjdk-21 @openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK Runtime tests diff --git a/modules/maven/s2i/tests/features/java_s2i.feature b/modules/maven/s2i/tests/features/java_s2i.feature index f5ec266e..dc2d089f 100644 --- a/modules/maven/s2i/tests/features/java_s2i.feature +++ b/modules/maven/s2i/tests/features/java_s2i.feature @@ -2,6 +2,7 @@ @ignore @ubi9/openjdk-11 @ubi9/openjdk-17 +@ubi9/openjdk-21 @openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK S2I tests # NOTE: these tests should be usable with the other images once we have refactored the JDK scripts. diff --git a/modules/maven/s2i/tests/features/java_s2i_inc.feature b/modules/maven/s2i/tests/features/java_s2i_inc.feature index 3c3c145d..baf8c342 100644 --- a/modules/maven/s2i/tests/features/java_s2i_inc.feature +++ b/modules/maven/s2i/tests/features/java_s2i_inc.feature @@ -1,5 +1,6 @@ @ubi9/openjdk-11 @ubi9/openjdk-17 +@ubi9/openjdk-21 @openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK S2I tests diff --git a/modules/run/tests/features/java.security.feature b/modules/run/tests/features/java.security.feature index e8c94600..e335c516 100644 --- a/modules/run/tests/features/java.security.feature +++ b/modules/run/tests/features/java.security.feature @@ -1,5 +1,6 @@ @ubi9/openjdk-11 @ubi9/openjdk-17 +@ubi9/openjdk-21 @openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift S2I tests Scenario: Check networkaddress.cache.negative.ttl has been set correctly diff --git a/tests/features/imagebasic.feature b/tests/features/imagebasic.feature index ec81156a..d110b4e7 100644 --- a/tests/features/imagebasic.feature +++ b/tests/features/imagebasic.feature @@ -11,6 +11,7 @@ Feature: Tests for all openshift images # builder-only test @ubi9/openjdk-11 @ubi9/openjdk-17 + @ubi9/openjdk-21 @openjdk-tech-preview/openjdk-21-jlink-rhel9 Scenario: Check that builder labels are correctly set Given image is built diff --git a/tests/features/java/ports.feature b/tests/features/java/ports.feature index db39aa01..3079c182 100644 --- a/tests/features/java/ports.feature +++ b/tests/features/java/ports.feature @@ -1,5 +1,6 @@ @ubi9/openjdk-11 @ubi9/openjdk-17 +@ubi9/openjdk-21 @openjdk-tech-preview/openjdk-21-jlink-rhel9 Feature: Openshift OpenJDK port tests From 4bc0ae3c332038f4d7917b0ceb2cab490667b021 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 23 Jul 2025 15:29:12 +0100 Subject: [PATCH 127/132] Split jlink TP into separate image descriptor Signed-off-by: Jonathan Dowland --- openjdk-21-jlink-rhel9.yaml | 64 ++++++++++++++++++++++++++++++ redhat/openjdk-21-jlink-rhel9.yaml | 33 +++++++++++++++ redhat/ubi9-openjdk-21.yaml | 2 +- ubi9-openjdk-21.yaml | 4 +- 4 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 openjdk-21-jlink-rhel9.yaml create mode 100644 redhat/openjdk-21-jlink-rhel9.yaml diff --git a/openjdk-21-jlink-rhel9.yaml b/openjdk-21-jlink-rhel9.yaml new file mode 100644 index 00000000..e69ae665 --- /dev/null +++ b/openjdk-21-jlink-rhel9.yaml @@ -0,0 +1,64 @@ +# This is an Image descriptor for Cekit + +schema_version: 1 + +from: "registry.access.redhat.com/ubi9/ubi-minimal" +name: &name "openjdk-tech-preview/openjdk-21-jlink-rhel9" +version: &version "1.23" +description: "Source To Image (S2I) image for Red Hat OpenShift providing OpenJDK 21" + +labels: +- name: "io.k8s.description" + value: "Platform for building and running plain Java applications (fat-jar and flat classpath)" +- name: "io.k8s.display-name" + value: "Java Applications" +- name: "io.openshift.tags" + value: "builder,java" +- name: "maintainer" + value: "Red Hat OpenJDK " +- name: "com.redhat.component" + value: "openjdk-21-jlink-tech-preview-ubi9-container" +- name: "usage" + value: &docs "https://rh-openjdk.github.io/redhat-openjdk-containers/" +- name: "com.redhat.license_terms" + value: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" +- name: "org.opencontainers.image.documentation" + value: *docs +- name: "name" + value: *name +- name: "version" + value: *version + +envs: +- name: PATH + value: $PATH:"/usr/local/s2i" +- name: "JBOSS_IMAGE_NAME" + value: *name +- name: "JBOSS_IMAGE_VERSION" + value: *version +- name: "LANG" + value: "C.utf8" + +ports: +- value: 8080 +- value: 8443 + +modules: + repositories: + - path: modules + install: + - name: jboss.container.util.pkg-update + - name: jboss.container.openjdk.jdk + version: "21" + - name: jboss.container.maven + version: "3.9.21" + - name: jboss.container.util.tzdata + - name: jboss.container.java.s2i.bash + - name: jboss.container.util.tzdata + - name: jboss.container.java.jlink + +help: + add: true + +packages: + manager: microdnf diff --git a/redhat/openjdk-21-jlink-rhel9.yaml b/redhat/openjdk-21-jlink-rhel9.yaml new file mode 100644 index 00000000..3df38266 --- /dev/null +++ b/redhat/openjdk-21-jlink-rhel9.yaml @@ -0,0 +1,33 @@ +# This OSBS Base Image is designed and engineered to be the base layer for +# Red Hat products. This base image is only supported for approved Red Hat +# products. This image is maintained by Red Hat and updated regularly. +from: registry.redhat.io/rhel9-osbs/osbs-ubi9-minimal +osbs: + configuration: + container: + compose: + pulp_repos: true + packages: + - java-21-openjdk + - java-21-openjdk-devel + - java-21-openjdk-headless + signing_intent: release + repository: + name: containers/openjdk + branch: openjdk-21-jlink-tech-preview-ubi9 + +packages: + manager: microdnf + content_sets: + x86_64: + - rhel-9-for-x86_64-baseos-rpms + - rhel-9-for-x86_64-appstream-rpms + ppc64le: + - rhel-9-for-ppc64le-baseos-rpms + - rhel-9-for-ppc64le-appstream-rpms + aarch64: + - rhel-9-for-aarch64-baseos-rpms + - rhel-9-for-aarch64-appstream-rpms + s390x: + - rhel-9-for-s390x-baseos-rpms + - rhel-9-for-s390x-appstream-rpms diff --git a/redhat/ubi9-openjdk-21.yaml b/redhat/ubi9-openjdk-21.yaml index 3df38266..19905492 100644 --- a/redhat/ubi9-openjdk-21.yaml +++ b/redhat/ubi9-openjdk-21.yaml @@ -14,7 +14,7 @@ osbs: signing_intent: release repository: name: containers/openjdk - branch: openjdk-21-jlink-tech-preview-ubi9 + branch: openjdk-21-ubi9 packages: manager: microdnf diff --git a/ubi9-openjdk-21.yaml b/ubi9-openjdk-21.yaml index b8cf6c64..9aaf10a3 100644 --- a/ubi9-openjdk-21.yaml +++ b/ubi9-openjdk-21.yaml @@ -3,7 +3,7 @@ schema_version: 1 from: "registry.access.redhat.com/ubi9/ubi-minimal" -name: &name "openjdk-tech-preview/openjdk-21-jlink-rhel9" +name: &name "ubi9/openjdk-21" version: &version "1.23" description: "Source To Image (S2I) image for Red Hat OpenShift providing OpenJDK 21" @@ -17,7 +17,7 @@ labels: - name: "maintainer" value: "Red Hat OpenJDK " - name: "com.redhat.component" - value: "openjdk-21-jlink-tech-preview-ubi9-container" + value: "openjdk-21-ubi9-container" - name: "usage" value: &docs "https://rh-openjdk.github.io/redhat-openjdk-containers/" - name: "com.redhat.license_terms" From e3b93d342f108d380bd7baf2ea1b0f792c8a77ee Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Wed, 23 Jul 2025 15:29:42 +0100 Subject: [PATCH 128/132] Remove jlink-specific changes to common modules the s2i and jdk modules are used by the non-jlink images; remove the changes to those made in the jlink-dev work. Move those changes to the jlink module. Note: prior commit added an explicit dependency on the jlink module to the jlink-dev image descriptor. Signed-off-by: Jonathan Dowland --- modules/jdk/21/module.yaml | 1 - modules/jlink/module.yaml | 5 +++++ modules/s2i/bash/module.yaml | 1 - modules/s2i/core/module.yaml | 5 ----- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/jdk/21/module.yaml b/modules/jdk/21/module.yaml index 9a0e2d0d..85834284 100644 --- a/modules/jdk/21/module.yaml +++ b/modules/jdk/21/module.yaml @@ -25,7 +25,6 @@ envs: packages: install: - java-21-openjdk-devel - - java-21-openjdk-jmods modules: install: diff --git a/modules/jlink/module.yaml b/modules/jlink/module.yaml index 49504f2d..518e0fe8 100644 --- a/modules/jlink/module.yaml +++ b/modules/jlink/module.yaml @@ -16,6 +16,10 @@ envs: value: /tmp/jre - name: S2I_JLINK_TEMP_PATH value: /tmp/jlink +- name: S2I_ENABLE_JLINK + description: ^ + Enables the Jdeps/JLink workflow to minimize JRE size + example: "false" modules: install: @@ -25,3 +29,4 @@ modules: packages: install: - binutils # for objcopy + - java-21-openjdk-jmods diff --git a/modules/s2i/bash/module.yaml b/modules/s2i/bash/module.yaml index 64f02229..880745e6 100644 --- a/modules/s2i/bash/module.yaml +++ b/modules/s2i/bash/module.yaml @@ -13,7 +13,6 @@ modules: - name: jboss.container.maven.s2i - name: jboss.container.java.run - name: jboss.container.util.logging - - name: jboss.container.java.jlink - name: jboss.container.util.pathfinder packages: diff --git a/modules/s2i/core/module.yaml b/modules/s2i/core/module.yaml index 5d706a47..28e3e88f 100644 --- a/modules/s2i/core/module.yaml +++ b/modules/s2i/core/module.yaml @@ -112,11 +112,6 @@ envs: Delete source files at the end of build. Defaults to true. example: "false" -- name: S2I_ENABLE_JLINK - description: ^ - Enables the Jdeps/JLink workflow to minimize JRE size - example: "false" - run: cmd: - "/usr/local/s2i/run" From e4d595c5a6f7bc07806705ef71aa429c8f01b556 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Tue, 5 Aug 2025 16:05:06 +0100 Subject: [PATCH 129/132] Update pathfinder install to set sensible permissions Adjusting jlink-dev work to the expectations after OPENJDK-3655 Signed-off-by: Jonathan Dowland --- modules/util/pathfinder/configure.sh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/modules/util/pathfinder/configure.sh b/modules/util/pathfinder/configure.sh index c21a6352..94810789 100644 --- a/modules/util/pathfinder/configure.sh +++ b/modules/util/pathfinder/configure.sh @@ -1,14 +1,7 @@ -#!/bin/sh -# Configure module -set -e +#!/bin/bash +set -euo pipefail SCRIPT_DIR=$(dirname $0) ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts -chown -R default:root $SCRIPT_DIR -chmod -R ug+rwX $SCRIPT_DIR -chmod ug+x ${ARTIFACTS_DIR}/opt/jboss/container/util/pathfinder/* - -pushd ${ARTIFACTS_DIR} -cp -pr * / -popd +install -m 0644 -D {${ARTIFACTS_DIR},}/opt/jboss/container/util/pathfinder/pathfinder.sh From 563b37f5ced9f2088dc7aa13a435a5ec3092acf7 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 4 Sep 2025 09:21:48 +0100 Subject: [PATCH 130/132] [OPENJDK-3666] merge jboss.container.java.s2i.{core,bash} modules Signed-off-by: Jonathan Dowland --- .../opt/jboss/container/maven/s2i/maven-s2i | 2 +- modules/maven/s2i/module.yaml | 1 - .../jboss/container/java/s2i/maven-overrides | 0 .../container/java/s2i/maven-s2i-overrides | 2 +- .../opt/jboss/container/java/s2i}/s2i-core | 0 .../jboss/container/java/s2i/s2i-core-hooks | 0 .../artifacts/usr/libexec/s2i/assemble | 0 .../{bash => }/artifacts/usr/libexec/s2i/run | 2 +- .../artifacts/usr/libexec/s2i/usage | 0 modules/s2i/bash/module.yaml | 23 ---------- modules/s2i/{bash => }/configure.sh | 6 +++ modules/s2i/core/configure.sh | 15 ------- modules/s2i/{core => }/module.yaml | 43 ++++++++++--------- .../{bash => }/tests/features/files.feature | 0 .../tests/features/java_s2i_quarkus.feature | 0 .../tests/features/s2i-core.feature | 0 ubi10-openjdk-21.yaml | 2 +- 17 files changed, 32 insertions(+), 64 deletions(-) rename modules/s2i/{bash => }/artifacts/opt/jboss/container/java/s2i/maven-overrides (100%) rename modules/s2i/{bash => }/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides (96%) rename modules/s2i/{core/artifacts/opt/jboss/container/s2i/core => artifacts/opt/jboss/container/java/s2i}/s2i-core (100%) rename modules/s2i/{bash => }/artifacts/opt/jboss/container/java/s2i/s2i-core-hooks (100%) rename modules/s2i/{bash => }/artifacts/usr/libexec/s2i/assemble (100%) mode change 100644 => 100755 rename modules/s2i/{bash => }/artifacts/usr/libexec/s2i/run (93%) mode change 100644 => 100755 rename modules/s2i/{bash => }/artifacts/usr/libexec/s2i/usage (100%) mode change 100644 => 100755 delete mode 100644 modules/s2i/bash/module.yaml rename modules/s2i/{bash => }/configure.sh (59%) mode change 100644 => 100755 delete mode 100755 modules/s2i/core/configure.sh rename modules/s2i/{core => }/module.yaml (91%) rename modules/s2i/{bash => }/tests/features/files.feature (100%) rename modules/s2i/{core => }/tests/features/java_s2i_quarkus.feature (100%) rename modules/s2i/{core => }/tests/features/s2i-core.feature (100%) diff --git a/modules/maven/s2i/artifacts/opt/jboss/container/maven/s2i/maven-s2i b/modules/maven/s2i/artifacts/opt/jboss/container/maven/s2i/maven-s2i index 157eadc3..386324b0 100644 --- a/modules/maven/s2i/artifacts/opt/jboss/container/maven/s2i/maven-s2i +++ b/modules/maven/s2i/artifacts/opt/jboss/container/maven/s2i/maven-s2i @@ -1,7 +1,7 @@ # include dependencies source "${JBOSS_CONTAINER_UTIL_LOGGING_MODULE}/logging.sh" -source "${JBOSS_CONTAINER_S2I_CORE_MODULE}/s2i-core" +source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core" # initialization of maven s2i module function maven_s2i_init() { diff --git a/modules/maven/s2i/module.yaml b/modules/maven/s2i/module.yaml index bda76a18..d273e5f0 100644 --- a/modules/maven/s2i/module.yaml +++ b/modules/maven/s2i/module.yaml @@ -29,7 +29,6 @@ execute: modules: install: - name: jboss.container.user - - name: jboss.container.s2i.core - name: jboss.container.maven.default - name: jboss.container.util.logging diff --git a/modules/s2i/bash/artifacts/opt/jboss/container/java/s2i/maven-overrides b/modules/s2i/artifacts/opt/jboss/container/java/s2i/maven-overrides similarity index 100% rename from modules/s2i/bash/artifacts/opt/jboss/container/java/s2i/maven-overrides rename to modules/s2i/artifacts/opt/jboss/container/java/s2i/maven-overrides diff --git a/modules/s2i/bash/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides b/modules/s2i/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides similarity index 96% rename from modules/s2i/bash/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides rename to modules/s2i/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides index 2def2413..82e472e3 100644 --- a/modules/s2i/bash/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides +++ b/modules/s2i/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides @@ -1,6 +1,6 @@ source "${JBOSS_CONTAINER_UTIL_LOGGING_MODULE}/logging.sh" -source "${JBOSS_CONTAINER_S2I_CORE_MODULE}/s2i-core" +source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core" # inject our overridden maven_*() functions function maven_s2i_source_maven_overrides() { diff --git a/modules/s2i/core/artifacts/opt/jboss/container/s2i/core/s2i-core b/modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core similarity index 100% rename from modules/s2i/core/artifacts/opt/jboss/container/s2i/core/s2i-core rename to modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core diff --git a/modules/s2i/bash/artifacts/opt/jboss/container/java/s2i/s2i-core-hooks b/modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core-hooks similarity index 100% rename from modules/s2i/bash/artifacts/opt/jboss/container/java/s2i/s2i-core-hooks rename to modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core-hooks diff --git a/modules/s2i/bash/artifacts/usr/libexec/s2i/assemble b/modules/s2i/artifacts/usr/libexec/s2i/assemble old mode 100644 new mode 100755 similarity index 100% rename from modules/s2i/bash/artifacts/usr/libexec/s2i/assemble rename to modules/s2i/artifacts/usr/libexec/s2i/assemble diff --git a/modules/s2i/bash/artifacts/usr/libexec/s2i/run b/modules/s2i/artifacts/usr/libexec/s2i/run old mode 100644 new mode 100755 similarity index 93% rename from modules/s2i/bash/artifacts/usr/libexec/s2i/run rename to modules/s2i/artifacts/usr/libexec/s2i/run index 0c6f5718..a33efbaf --- a/modules/s2i/bash/artifacts/usr/libexec/s2i/run +++ b/modules/s2i/artifacts/usr/libexec/s2i/run @@ -4,7 +4,7 @@ args="$*" source "${JBOSS_CONTAINER_UTIL_LOGGING_MODULE}/logging.sh" -source "${JBOSS_CONTAINER_S2I_CORE_MODULE}/s2i-core" +source "$JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core" # include our s2i_core_*() overrides/extensions source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core-hooks" diff --git a/modules/s2i/bash/artifacts/usr/libexec/s2i/usage b/modules/s2i/artifacts/usr/libexec/s2i/usage old mode 100644 new mode 100755 similarity index 100% rename from modules/s2i/bash/artifacts/usr/libexec/s2i/usage rename to modules/s2i/artifacts/usr/libexec/s2i/usage diff --git a/modules/s2i/bash/module.yaml b/modules/s2i/bash/module.yaml deleted file mode 100644 index ffcfbc0b..00000000 --- a/modules/s2i/bash/module.yaml +++ /dev/null @@ -1,23 +0,0 @@ -schema_version: 1 -name: jboss.container.java.s2i.bash -version: '1.0' -description: Customization of common Maven S2I for Java S2I image. - -envs: -- name: JBOSS_CONTAINER_JAVA_S2I_MODULE - value: /opt/jboss/container/java/s2i - -execute: -- script: configure.sh - -modules: - install: - - name: jboss.container.user - - name: jboss.container.maven.s2i - - name: jboss.container.java.run - - name: jboss.container.util.logging - - name: jboss.container.s2i.core - -packages: - install: - - rsync diff --git a/modules/s2i/bash/configure.sh b/modules/s2i/configure.sh old mode 100644 new mode 100755 similarity index 59% rename from modules/s2i/bash/configure.sh rename to modules/s2i/configure.sh index e5eb983d..206aa1f8 --- a/modules/s2i/bash/configure.sh +++ b/modules/s2i/configure.sh @@ -7,3 +7,9 @@ ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts install -D ${ARTIFACTS_DIR}/usr/libexec/s2i/* /usr/libexec/s2i install -m 0644 -D -t /opt/jboss/container/java/s2i \ ${ARTIFACTS_DIR}/opt/jboss/container/java/s2i/* + +install -m 0644 -D {${ARTIFACTS_DIR},}/opt/jboss/container/java/s2i/s2i-core + +mkdir -p /deployments \ + && chmod -R "ug+rwX" /deployments \ + && chown -R $USER:root /deployments diff --git a/modules/s2i/core/configure.sh b/modules/s2i/core/configure.sh deleted file mode 100755 index 21081256..00000000 --- a/modules/s2i/core/configure.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -euo pipefail - -SCRIPT_DIR=$(dirname $0) -ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts - -install -m 0644 -D {${ARTIFACTS_DIR},}/opt/jboss/container/s2i/core/s2i-core - -pushd ${ARTIFACTS_DIR} -cp -pr * / -popd - -mkdir -p /deployments \ - && chmod -R "ug+rwX" /deployments \ - && chown -R $USER:root /deployments diff --git a/modules/s2i/core/module.yaml b/modules/s2i/module.yaml similarity index 91% rename from modules/s2i/core/module.yaml rename to modules/s2i/module.yaml index eb24eb11..19095b6e 100644 --- a/modules/s2i/core/module.yaml +++ b/modules/s2i/module.yaml @@ -1,28 +1,23 @@ schema_version: 1 -name: jboss.container.s2i.core -version: '9.0' -description: "Provides support for core s2i capabilities." +name: jboss.container.java.s2i +version: '1.0' +description: Customization of common Maven S2I for Java S2I image. -execute: -- script: configure.sh +modules: + install: + - name: jboss.container.user + - name: jboss.container.maven.s2i + - name: jboss.container.java.run + - name: jboss.container.util.logging packages: install: - findutils - rsync -labels: - # XXX this modules does not install files in this path -- name: "io.openshift.s2i.scripts-url" - value: "image:///usr/libexec/s2i" -- name: io.openshift.s2i.destination - value: "/tmp" -- name: org.jboss.container.deployments-dir - value: "/deployments" - envs: -- name: JBOSS_CONTAINER_S2I_CORE_MODULE - value: /opt/jboss/container/s2i/core/ +- name: JBOSS_CONTAINER_JAVA_S2I_MODULE + value: /opt/jboss/container/java/s2i - name: S2I_DESTINATION_DIR description: ^ @@ -113,11 +108,17 @@ envs: Delete source files at the end of build. Defaults to true. example: "false" +labels: +- name: "io.openshift.s2i.scripts-url" + value: "image:///usr/libexec/s2i" +- name: io.openshift.s2i.destination + value: "/tmp" +- name: org.jboss.container.deployments-dir + value: "/deployments" + +execute: +- script: configure.sh + run: cmd: - # XXX this script is in a different module - "/usr/libexec/s2i/run" - -modules: - install: - - name: jboss.container.user diff --git a/modules/s2i/bash/tests/features/files.feature b/modules/s2i/tests/features/files.feature similarity index 100% rename from modules/s2i/bash/tests/features/files.feature rename to modules/s2i/tests/features/files.feature diff --git a/modules/s2i/core/tests/features/java_s2i_quarkus.feature b/modules/s2i/tests/features/java_s2i_quarkus.feature similarity index 100% rename from modules/s2i/core/tests/features/java_s2i_quarkus.feature rename to modules/s2i/tests/features/java_s2i_quarkus.feature diff --git a/modules/s2i/core/tests/features/s2i-core.feature b/modules/s2i/tests/features/s2i-core.feature similarity index 100% rename from modules/s2i/core/tests/features/s2i-core.feature rename to modules/s2i/tests/features/s2i-core.feature diff --git a/ubi10-openjdk-21.yaml b/ubi10-openjdk-21.yaml index a8b9aa97..6708e1c7 100644 --- a/ubi10-openjdk-21.yaml +++ b/ubi10-openjdk-21.yaml @@ -57,7 +57,7 @@ modules: version: "21" - name: jboss.container.maven version: "3.9.21" - - name: jboss.container.java.s2i.bash + - name: jboss.container.java.s2i help: add: true From ec2166b1ea2d72ce8c67fe77b7678bb306fb5634 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 4 Sep 2025 09:33:49 +0100 Subject: [PATCH 131/132] Remove s2i_core_env_init_hook s2i-core-hooks only defined one function, s2i_core_env_init_hook This was only called by s2i_core_env_init in s2i-core (it overrides an empty definition of the same function name in s2i-core) Fold the content of the function into s2i_core_env_init and remove the s2i-core-hooks file Remove includes of it from s2i/assemble and run (which didn't call the function anyway) Signed-off-by: Jonathan Dowland --- .../artifacts/opt/jboss/container/java/s2i/s2i-core | 10 ++-------- .../opt/jboss/container/java/s2i/s2i-core-hooks | 7 ------- modules/s2i/artifacts/usr/libexec/s2i/assemble | 3 --- modules/s2i/artifacts/usr/libexec/s2i/run | 4 +--- 4 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core-hooks diff --git a/modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core b/modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core index 47446df2..e2b37c17 100644 --- a/modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core +++ b/modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core @@ -19,8 +19,8 @@ function s2i_core_init() { } function s2i_core_env_init() { - # initialize core s2i environmet variables - s2i_core_env_init_hook + # initialize core s2i environment variables + S2I_TARGET_DATA_DIR="${S2I_TARGET_DATA_DIR:-${JAVA_DATA_DIR:-/deployments/data}}" S2I_DESTINATION_DIR="${S2I_DESTINATION_DIR:-/tmp}" S2I_ARTIFACTS_DIR="${S2I_DESTINATION_DIR}/artifacts" S2I_SOURCE_DIR="${S2I_DESTINATION_DIR}/src" @@ -35,12 +35,6 @@ function s2i_core_env_init() { S2I_DELETE_SOURCE="${S2I_DELETE_SOURCE:-true}" } -# extensions may override this method to initialize environment variables -# to suit their own needs. -function s2i_core_env_init_hook() { - : -} - # Copy files from a source path to a destination path # Do not attempt to change metadata of the destination path, which we # may not own diff --git a/modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core-hooks b/modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core-hooks deleted file mode 100644 index 6cc5e529..00000000 --- a/modules/s2i/artifacts/opt/jboss/container/java/s2i/s2i-core-hooks +++ /dev/null @@ -1,7 +0,0 @@ - -source "${JBOSS_CONTAINER_UTIL_LOGGING_MODULE}/logging.sh" - -# override core variables -function s2i_core_env_init_hook() { - S2I_TARGET_DATA_DIR="${S2I_TARGET_DATA_DIR:-${JAVA_DATA_DIR:-/deployments/data}}" -} diff --git a/modules/s2i/artifacts/usr/libexec/s2i/assemble b/modules/s2i/artifacts/usr/libexec/s2i/assemble index fa5e0f20..ff4a9e82 100755 --- a/modules/s2i/artifacts/usr/libexec/s2i/assemble +++ b/modules/s2i/artifacts/usr/libexec/s2i/assemble @@ -5,9 +5,6 @@ set -e source "${JBOSS_CONTAINER_UTIL_LOGGING_MODULE}/logging.sh" source "${JBOSS_CONTAINER_MAVEN_S2I_MODULE}/maven-s2i" -# include our s2i_core_*() overrides/extensions -source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core-hooks" - # inject our overridden maven_s2i_*() functions source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/maven-s2i-overrides" diff --git a/modules/s2i/artifacts/usr/libexec/s2i/run b/modules/s2i/artifacts/usr/libexec/s2i/run index a33efbaf..0b23df10 100755 --- a/modules/s2i/artifacts/usr/libexec/s2i/run +++ b/modules/s2i/artifacts/usr/libexec/s2i/run @@ -4,9 +4,7 @@ args="$*" source "${JBOSS_CONTAINER_UTIL_LOGGING_MODULE}/logging.sh" -source "$JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core" -# include our s2i_core_*() overrides/extensions -source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core-hooks" +source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core" # Global S2I variable setup s2i_core_env_init From 397d0f4bbf27c79a61226495dac5a2250c0a2339 Mon Sep 17 00:00:00 2001 From: Jonathan Dowland Date: Thu, 4 Sep 2025 09:39:28 +0100 Subject: [PATCH 132/132] Remove maven_s2i_deploy_artifacts_override The function maven_s2i_deploy_artifacts checked for the existence of maven_s2i_deploy_artifacts_override, and if it exists, calls it and returns. The implementation of maven_s2i_deploy_artifacts_override simply deleted itself and called maven_s2i_deploy_artifacts again. Signed-off-by: Jonathan Dowland --- .../s2i/artifacts/opt/jboss/container/maven/s2i/maven-s2i | 5 ----- .../opt/jboss/container/java/s2i/maven-s2i-overrides | 6 ------ 2 files changed, 11 deletions(-) diff --git a/modules/maven/s2i/artifacts/opt/jboss/container/maven/s2i/maven-s2i b/modules/maven/s2i/artifacts/opt/jboss/container/maven/s2i/maven-s2i index 386324b0..a1a42919 100644 --- a/modules/maven/s2i/artifacts/opt/jboss/container/maven/s2i/maven-s2i +++ b/modules/maven/s2i/artifacts/opt/jboss/container/maven/s2i/maven-s2i @@ -80,11 +80,6 @@ function maven_s2i_maven_build() { # copy build output to deployments folder # internal method function maven_s2i_deploy_artifacts() { - if [ -n "$(type -t maven_s2i_deploy_artifacts_override)" ]; then - eval maven_s2i_deploy_artifacts_override $* - return $? - fi - local artifact_dirs=${1:-${MAVEN_S2I_ARTIFACT_DIRS}} if [[ ! "${S2I_SOURCE_DIR}" =~ ^\/ ]]; then diff --git a/modules/s2i/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides b/modules/s2i/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides index 82e472e3..184c92c3 100644 --- a/modules/s2i/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides +++ b/modules/s2i/artifacts/opt/jboss/container/java/s2i/maven-s2i-overrides @@ -33,9 +33,3 @@ function maven_s2i_custom_binary_build() { recursive_copy_files "${binary_dir}" "${S2I_TARGET_DEPLOYMENTS_DIR}" } - -function maven_s2i_deploy_artifacts_override() { - unset -f maven_s2i_deploy_artifacts_override - eval maven_s2i_deploy_artifacts $* - return $? -}