diff --git a/.github/workflows/image-workflow-template.yml b/.github/workflows/image-workflow-template.yml new file mode 100644 index 00000000..4c1b332b --- /dev/null +++ b/.github/workflows/image-workflow-template.yml @@ -0,0 +1,45 @@ +name: UBI8 OpenJDK S2I Image CI template +on: + workflow_call: + inputs: + image: + required: true + type: string +env: + LANG: en_US.UTF-8 +jobs: + openjdkci: + name: OpenJDK S2I Build and Test + timeout-minutes: 60 + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v2 + - name: Verify latest UBI image is present + run: docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest + + - name: Install CEKit + uses: cekit/actions-setup-cekit@v1.1.5 + + - name: Build + run: | + 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 + with: + source: "github" + github_pat: ${{ github.token }} + s2i: "1.3.4" + + # s2i misbehaves if registry credentials are present: tries and fails to query + # image metadata from docker.io before each build, etc. See: + # https://github.com/openshift/source-to-image/issues/1134 + - name: clear docker credentials + run: docker logout + + - name: Behave Tests + run: | + echo /home/runner/work/_temp/openshift-bin >> $GITHUB_PATH + cekit -v --descriptor ${{ inputs.image }}.yaml test behave --steps-url https://github.com/jmtd/behave-test-steps diff --git a/.github/workflows/ubi8-openjdk-11-runtime.yml b/.github/workflows/ubi8-openjdk-11-runtime.yml index f7ff7e7e..01a40733 100644 --- a/.github/workflows/ubi8-openjdk-11-runtime.yml +++ b/.github/workflows/ubi8-openjdk-11-runtime.yml @@ -1,50 +1,10 @@ -name: OpenJDK 11 Runtime Image CI +name: UBI8 OpenJDK 11 Runtime Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - CEKIT_VERSION: 4.6.0 - S2I_URI: https://github.com/openshift/source-to-image/releases/download/v1.3.1/source-to-image-v1.3.1-a5a77147-linux-amd64.tar.gz + IMAGE: ubi8-openjdk-11-runtime jobs: - openjdkci: - name: OpenJDK Runtime Build and Test - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v2 - - name: Verify latest UBI image is present - run: | - docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest - docker image ls | grep ubi8 - - name: Setup required system packages - run: | - sudo apt-get update - sudo apt-get install -y virtualenv libkrb5-dev - - name: Setup virtualenv and install cekit and required packages - run: | - mkdir ~/cekit${{ env.CEKIT_VERSION }} - virtualenv -p python3 ~/cekit${{ env.CEKIT_VERSION }} - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - pip3 install cekit==${{ env.CEKIT_VERSION }} docker docker-squash odcs behave lxml - - name: Build - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-11-runtime.yaml build docker - docker image ls - -# even though we don't run any S2I tests for the runtime images, the test suite -# will fail to start if the s2i binary is not present. - - name: install s2i binary - run: | - echo ===== Installing s2i from ${{ env.S2I_URL }} ===== - mkdir /tmp/s2i/ && cd /tmp/s2i/ - wget ${{ env.S2I_URI }} - tar xvf source-to-image*.gz - sudo mv s2i /usr/bin - which s2i - s2i version - - - name: Behave Tests - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-11-runtime.yaml test behave + call-openjdkci: + uses: ./.github/workflows/image-workflow-template.yml + with: + image: ubi8-openjdk-11-runtime diff --git a/.github/workflows/ubi8-openjdk-11.yml b/.github/workflows/ubi8-openjdk-11.yml index 8c1bf6eb..140a2cf3 100644 --- a/.github/workflows/ubi8-openjdk-11.yml +++ b/.github/workflows/ubi8-openjdk-11.yml @@ -1,46 +1,10 @@ -name: OpenJDK 11 S2I Image CI +name: UBI8 OpenJDK 11 S2I Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - CEKIT_VERSION: 4.6.0 - S2I_URI: https://github.com/openshift/source-to-image/releases/download/v1.3.1/source-to-image-v1.3.1-a5a77147-linux-amd64.tar.gz + IMAGE: ubi8-openjdk-11 jobs: - openjdkci: - name: OpenJDK S2I Build and Test - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v2 - - name: Verify latest UBI image is present - run: | - docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest - docker image ls | grep ubi8 - - name: Setup required system packages - run: | - sudo apt-get update - sudo apt-get install -y virtualenv libkrb5-dev - - name: Setup virtualenv and install cekit and required packages - run: | - mkdir ~/cekit${{ env.CEKIT_VERSION }} - virtualenv -p python3 ~/cekit${{ env.CEKIT_VERSION }} - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - pip3 install cekit==${{ env.CEKIT_VERSION }} docker docker-squash odcs behave lxml - - name: Build - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-11.yaml build docker - docker image ls - - name: install s2i binary - run: | - echo ===== Installing s2i from ${{ env.S2I_URL }} ===== - mkdir /tmp/s2i/ && cd /tmp/s2i/ - wget ${{ env.S2I_URI }} - tar xvf source-to-image*.gz - sudo mv s2i /usr/bin - which s2i - s2i version - - name: Behave Tests - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-11.yaml test behave + call-openjdkci: + uses: ./.github/workflows/image-workflow-template.yml + with: + image: ubi8-openjdk-11 diff --git a/.github/workflows/ubi8-openjdk-17-runtime.yml b/.github/workflows/ubi8-openjdk-17-runtime.yml index 70df9278..c6e68318 100644 --- a/.github/workflows/ubi8-openjdk-17-runtime.yml +++ b/.github/workflows/ubi8-openjdk-17-runtime.yml @@ -1,50 +1,10 @@ -name: OpenJDK 17 Runtime Image CI +name: UBI8 OpenJDK 17 Runtime Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - CEKIT_VERSION: 4.6.0 - S2I_URI: https://github.com/openshift/source-to-image/releases/download/v1.3.1/source-to-image-v1.3.1-a5a77147-linux-amd64.tar.gz + IMAGE: ubi8-openjdk-17-runtime jobs: - openjdkci: - name: OpenJDK Runtime Build and Test - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v2 - - name: Verify latest UBI image is present - run: | - docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest - docker image ls | grep ubi8 - - name: Setup required system packages - run: | - sudo apt-get update - sudo apt-get install -y virtualenv libkrb5-dev - - name: Setup virtualenv and install cekit and required packages - run: | - mkdir ~/cekit${{ env.CEKIT_VERSION }} - virtualenv -p python3 ~/cekit${{ env.CEKIT_VERSION }} - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - pip3 install cekit==${{ env.CEKIT_VERSION }} docker docker-squash odcs behave lxml - - name: Build - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-17-runtime.yaml build docker - docker image ls - -# even though we don't run any S2I tests for the runtime images, the test suite -# will fail to start if the s2i binary is not present. - - name: install s2i binary - run: | - echo ===== Installing s2i from ${{ env.S2I_URL }} ===== - mkdir /tmp/s2i/ && cd /tmp/s2i/ - wget ${{ env.S2I_URI }} - tar xvf source-to-image*.gz - sudo mv s2i /usr/bin - which s2i - s2i version - - - name: Behave Tests - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-17-runtime.yaml test behave + call-openjdkci: + uses: ./.github/workflows/image-workflow-template.yml + with: + image: ubi8-openjdk-17-runtime diff --git a/.github/workflows/ubi8-openjdk-17.yml b/.github/workflows/ubi8-openjdk-17.yml index 1865a9d7..79cc732d 100644 --- a/.github/workflows/ubi8-openjdk-17.yml +++ b/.github/workflows/ubi8-openjdk-17.yml @@ -1,46 +1,10 @@ -name: OpenJDK 17 S2I Image CI +name: UBI8 OpenJDK 17 S2I Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - CEKIT_VERSION: 4.6.0 - S2I_URI: https://github.com/openshift/source-to-image/releases/download/v1.3.1/source-to-image-v1.3.1-a5a77147-linux-amd64.tar.gz + IMAGE: ubi8-openjdk-17 jobs: - openjdkci: - name: OpenJDK S2I Build and Test - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v2 - - name: Verify latest UBI image is present - run: | - docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest - docker image ls | grep ubi8 - - name: Setup required system packages - run: | - sudo apt-get update - sudo apt-get install -y virtualenv libkrb5-dev - - name: Setup virtualenv and install cekit and required packages - run: | - mkdir ~/cekit${{ env.CEKIT_VERSION }} - virtualenv -p python3 ~/cekit${{ env.CEKIT_VERSION }} - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - pip3 install cekit==${{ env.CEKIT_VERSION }} docker docker-squash odcs behave lxml - - name: Build - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-17.yaml build docker - docker image ls - - name: install s2i binary - run: | - echo ===== Installing s2i from ${{ env.S2I_URL }} ===== - mkdir /tmp/s2i/ && cd /tmp/s2i/ - wget ${{ env.S2I_URI }} - tar xvf source-to-image*.gz - sudo mv s2i /usr/bin - which s2i - s2i version - - name: Behave Tests - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-17.yaml test behave + call-openjdkci: + uses: ./.github/workflows/image-workflow-template.yml + with: + image: ubi8-openjdk-17 diff --git a/.github/workflows/ubi8-openjdk-21-runtime.yml b/.github/workflows/ubi8-openjdk-21-runtime.yml index 88080677..20079c79 100644 --- a/.github/workflows/ubi8-openjdk-21-runtime.yml +++ b/.github/workflows/ubi8-openjdk-21-runtime.yml @@ -1,4 +1,4 @@ -name: UBI8 OpenJDK 21 Runtime S2I Image CI +name: UBI8 OpenJDK 21 Runtime Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 diff --git a/.github/workflows/ubi8-openjdk-8-runtime.yml b/.github/workflows/ubi8-openjdk-8-runtime.yml index 34f4c970..96667c8f 100644 --- a/.github/workflows/ubi8-openjdk-8-runtime.yml +++ b/.github/workflows/ubi8-openjdk-8-runtime.yml @@ -1,50 +1,10 @@ -name: OpenJDK 8 Runtime Image CI +name: UBI8 OpenJDK 8 Runtime Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - CEKIT_VERSION: 4.6.0 - S2I_URI: https://github.com/openshift/source-to-image/releases/download/v1.3.1/source-to-image-v1.3.1-a5a77147-linux-amd64.tar.gz + IMAGE: ubi8-openjdk-8-runtime jobs: - openjdkci: - name: OpenJDK Runtime Build and Test - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v2 - - name: Verify latest UBI image is present - run: | - docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest - docker image ls | grep ubi8 - - name: Setup required system packages - run: | - sudo apt-get update - sudo apt-get install -y virtualenv libkrb5-dev - - name: Setup virtualenv and install cekit and required packages - run: | - mkdir ~/cekit${{ env.CEKIT_VERSION }} - virtualenv -p python3 ~/cekit${{ env.CEKIT_VERSION }} - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - pip3 install cekit==${{ env.CEKIT_VERSION }} docker docker-squash odcs behave lxml - - name: Build - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-8-runtime.yaml build docker - docker image ls - -# even though we don't run any S2I tests for the runtime images, the test suite -# will fail to start if the s2i binary is not present. - - name: install s2i binary - run: | - echo ===== Installing s2i from ${{ env.S2I_URL }} ===== - mkdir /tmp/s2i/ && cd /tmp/s2i/ - wget ${{ env.S2I_URI }} - tar xvf source-to-image*.gz - sudo mv s2i /usr/bin - which s2i - s2i version - - - name: Behave Tests - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-8-runtime.yaml test behave + call-openjdkci: + uses: ./.github/workflows/image-workflow-template.yml + with: + image: ubi8-openjdk-8-runtime diff --git a/.github/workflows/ubi8-openjdk-8.yml b/.github/workflows/ubi8-openjdk-8.yml index 300af4e6..747c435d 100644 --- a/.github/workflows/ubi8-openjdk-8.yml +++ b/.github/workflows/ubi8-openjdk-8.yml @@ -1,46 +1,10 @@ -name: OpenJDK 8 S2I Image CI +name: UBI8 OpenJDK 8 S2I Image CI on: [push, pull_request] env: LANG: en_US.UTF-8 - CEKIT_VERSION: 4.6.0 - S2I_URI: https://github.com/openshift/source-to-image/releases/download/v1.3.1/source-to-image-v1.3.1-a5a77147-linux-amd64.tar.gz + IMAGE: ubi8-openjdk-8 jobs: - openjdkci: - name: OpenJDK S2I Build and Test - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v2 - - name: Verify latest UBI image is present - run: | - docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest - docker image ls | grep ubi8 - - name: Setup required system packages - run: | - sudo apt-get update - sudo apt-get install -y virtualenv libkrb5-dev - - name: Setup virtualenv and install cekit and required packages - run: | - mkdir ~/cekit${{ env.CEKIT_VERSION }} - virtualenv -p python3 ~/cekit${{ env.CEKIT_VERSION }} - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - pip3 install cekit==${{ env.CEKIT_VERSION }} docker docker-squash odcs behave lxml - - name: Build - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-8.yaml build docker - docker image ls - - name: install s2i binary - run: | - echo ===== Installing s2i from ${{ env.S2I_URL }} ===== - mkdir /tmp/s2i/ && cd /tmp/s2i/ - wget ${{ env.S2I_URI }} - tar xvf source-to-image*.gz - sudo mv s2i /usr/bin - which s2i - s2i version - - name: Behave Tests - run: | - . ~/cekit${{ env.CEKIT_VERSION }}/bin/activate - cekit -v --descriptor ubi8-openjdk-8.yaml test behave + call-openjdkci: + uses: ./.github/workflows/image-workflow-template.yml + with: + image: ubi8-openjdk-8 diff --git a/tests/features/java/java_s2i.feature b/tests/features/java/java_s2i.feature index 212acde6..b357c544 100644 --- a/tests/features/java/java_s2i.feature +++ b/tests/features/java/java_s2i.feature @@ -1,3 +1,6 @@ +# temporarily marking 'ignore' so these tests are skipped on GHA +# See: https://issues.redhat.com/browse/OPENJDK-2602 +@ignore @ubi8/openjdk-8 @ubi8/openjdk-11 @ubi8/openjdk-17 @@ -328,10 +331,3 @@ Feature: Openshift OpenJDK S2I tests Given s2i build https://github.com/jboss-container-images/openjdk-test-applications from OPENJDK-1549 with env | variable | value | | MAVEN_ARGS | validate | - - Scenario: Ensure that run-env.sh placed in the JAVA_APP_DIR is sourced in the run script before launching java - 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_SOURCE_DATA_DIR | ./ | - | S2I_TARGET_DATA_DIR | /deployments | - Then container log should contain INFO exec -a "someUniqueString" java diff --git a/tests/features/java/java_s2i_quarkus.feature b/tests/features/java/java_s2i_quarkus.feature new file mode 100644 index 00000000..c3b3547a --- /dev/null +++ b/tests/features/java/java_s2i_quarkus.feature @@ -0,0 +1,10 @@ +@ubi8/openjdk-11 +@ubi8/openjdk-17 +@ubi8/openjdk-21 +Feature: Openshift OpenJDK S2I tests (Quarkus-based) + Scenario: Ensure that run-env.sh placed in the JAVA_APP_DIR is sourced in the run script before launching java + 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_SOURCE_DATA_DIR | ./ | + | S2I_TARGET_DATA_DIR | /deployments | + Then container log should contain INFO exec -a "someUniqueString" java diff --git a/tests/features/java/openjdk_s2i.feature b/tests/features/java/openjdk_s2i.feature index f749b054..88dd4123 100644 --- a/tests/features/java/openjdk_s2i.feature +++ b/tests/features/java/openjdk_s2i.feature @@ -5,6 +5,9 @@ Feature: Openshift OpenJDK-only S2I tests @ubi8/openjdk-8 + # temporarily marking 'ignore' so these tests are skipped on GHA + # See: https://issues.redhat.com/browse/OPENJDK-2602 + @ignore Scenario: Check java perf dir owned by jboss (CLOUD-2070) 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 diff --git a/ubi8-openjdk-11-runtime.yaml b/ubi8-openjdk-11-runtime.yaml index d07cffd1..d2595cc9 100644 --- a/ubi8-openjdk-11-runtime.yaml +++ b/ubi8-openjdk-11-runtime.yaml @@ -24,6 +24,10 @@ labels: 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: "JBOSS_IMAGE_NAME" diff --git a/ubi8-openjdk-11.yaml b/ubi8-openjdk-11.yaml index be36571f..26c14aea 100644 --- a/ubi8-openjdk-11.yaml +++ b/ubi8-openjdk-11.yaml @@ -24,6 +24,10 @@ labels: 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 diff --git a/ubi8-openjdk-17-runtime.yaml b/ubi8-openjdk-17-runtime.yaml index 2085ad59..cdb9dc7b 100644 --- a/ubi8-openjdk-17-runtime.yaml +++ b/ubi8-openjdk-17-runtime.yaml @@ -24,6 +24,10 @@ labels: 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: "JBOSS_IMAGE_NAME" diff --git a/ubi8-openjdk-17.yaml b/ubi8-openjdk-17.yaml index 523eb244..26ebb041 100644 --- a/ubi8-openjdk-17.yaml +++ b/ubi8-openjdk-17.yaml @@ -24,6 +24,10 @@ labels: 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 diff --git a/ubi8-openjdk-21-runtime.yaml b/ubi8-openjdk-21-runtime.yaml index f3547c27..bcb94d18 100644 --- a/ubi8-openjdk-21-runtime.yaml +++ b/ubi8-openjdk-21-runtime.yaml @@ -24,6 +24,10 @@ labels: 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: "JBOSS_IMAGE_NAME" diff --git a/ubi8-openjdk-21.yaml b/ubi8-openjdk-21.yaml index 73d4b8a8..29c1ae02 100644 --- a/ubi8-openjdk-21.yaml +++ b/ubi8-openjdk-21.yaml @@ -24,6 +24,10 @@ labels: 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 diff --git a/ubi8-openjdk-8-runtime.yaml b/ubi8-openjdk-8-runtime.yaml index db6c94e3..c380802b 100644 --- a/ubi8-openjdk-8-runtime.yaml +++ b/ubi8-openjdk-8-runtime.yaml @@ -24,6 +24,10 @@ labels: 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: "JBOSS_IMAGE_NAME" diff --git a/ubi8-openjdk-8.yaml b/ubi8-openjdk-8.yaml index 02c05e5b..62c56858 100644 --- a/ubi8-openjdk-8.yaml +++ b/ubi8-openjdk-8.yaml @@ -24,6 +24,10 @@ labels: 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