From 361d402d65689a1387f64bcd15ade6bc0e5156d3 Mon Sep 17 00:00:00 2001 From: Christopher May Date: Tue, 1 Nov 2022 10:29:44 -0400 Subject: [PATCH] Add tool and build containers for JDK 17 --- .github/workflows/publish.yaml | 482 ++++++++++++++++++++++++++++++++- 1 file changed, 467 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index b40982f..a6ce2b9 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -143,9 +143,9 @@ jobs: - name: Image Digest ๐Ÿ”– run: echo ${{ steps.image_build.outputs.digest }} - ######################################## - # ploigos-ci-agent-jenkins_java8_ubi8 # - ######################################## + ####################################### + # ploigos-ci-agent-jenkins_java8_ubi8 # + ####################################### ploigos-ci-agent-jenkins_java8_ubi8: needs: - ploigos-tool-java_java8_ubi8 @@ -248,7 +248,7 @@ jobs: run: echo ${{ steps.image_build.outputs.digest }} ######################################## - # ploigos-ci-agent-jenkins_java11_ubi8 # + # ploigos-ci-agent-jenkins_java11_ubi8 # ######################################## ploigos-ci-agent-jenkins_java11_ubi8: needs: @@ -351,9 +351,113 @@ jobs: - name: Image Digest ๐Ÿ”– run: echo ${{ steps.image_build.outputs.digest }} - ######################### - # ploigos-jenkins-init # - ######################### + ######################################## + # ploigos-ci-agent-jenkins_java17_ubi8 # + ######################################## + ploigos-ci-agent-jenkins_java17_ubi8: + needs: + - ploigos-tool-java_java17_ubi8 + + runs-on: ubuntu-latest + + env: + IMAGE_CONTEXT: ./ploigos-ci-agent-jenkins + IMAGE_FILE: Containerfile.ubi8 + IMAGE_NAME: ploigos-ci-agent-jenkins + IMAGE_TAG_LOCAL: localhost:5000/${{ secrets.REGISTRY_REPOSITORY }}/ploigos-ci-agent-jenkins:latest.java17.ubi8 + BASE_IMAGE_NAME: ploigos-tool-java + BASE_IMAGE_VERSION: ${{ needs.ploigos-tool-java_java17_ubi8.outputs.version }} + IMAGE_TAG_FLAVOR: .java17.ubi8 + IMAGE_IS_DEFAULT_FLAVOR: false + + services: + registry: + image: registry:2 + ports: + - 5000:5000 + + outputs: + version: ${{ steps.prep.outputs.version }} + + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Determine Image Version and Tags โš™๏ธ + id: prep + run: ${GITHUB_WORKSPACE}/.github/scripts/determine-image-version.sh + + - name: Version ๐Ÿ“Œ + run: echo ${{ steps.prep.outputs.version }} + + - name: Image Tags ๐Ÿท + run: echo ${{ steps.prep.outputs.tags }} + + - name: Set up QEMU ๐Ÿงฐ + uses: docker/setup-qemu-action@v1.0.1 + + - name: Set up Docker Buildx ๐Ÿงฐ + uses: docker/setup-buildx-action@v1.0.4 + with: + driver-opts: network=host + + - name: Cache Docker layers ๐Ÿ—ƒ + uses: actions/cache@v2.1.3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build Image ๐Ÿ›  + id: image_build + uses: docker/build-push-action@v2.2.1 + env: + IMAGE_BUILD_ARGS: BASE_IMAGE=${{ secrets.REGISTRY_URI }}/${{ secrets.REGISTRY_REPOSITORY }}/${{ env.BASE_IMAGE_NAME }}:${{ env.BASE_IMAGE_VERSION }} + with: + context: ${{ env.IMAGE_CONTEXT }} + file: ${{ env.IMAGE_CONTEXT }}/${{ env.IMAGE_FILE }} + build-args: ${{ env.IMAGE_BUILD_ARGS }} + push: true + tags: ${{ env.IMAGE_TAG_LOCAL }} + labels: | + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.version=${{ steps.prep.outputs.version }} + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.licenses=${{ github.event.repository.license.name }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Test Image ๐Ÿงช + run: | + echo "Running: docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} run-jnlp-client" + docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} run-jnlp-client + + - name: Login to External Registry ๐Ÿ”‘ + uses: docker/login-action@v1 + with: + registry: ${{ secrets.REGISTRY_URI }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Push to External Registry ๐Ÿ”บ + id: push + run: | + docker pull ${{ env.IMAGE_TAG_LOCAL }} + + TAGS=${{ steps.prep.outputs.tags }} + for TAG in ${TAGS//,/ }; do + docker tag ${{ env.IMAGE_TAG_LOCAL }} ${TAG} + docker push ${TAG} + done + + - name: Image Digest ๐Ÿ”– + run: echo ${{ steps.image_build.outputs.digest }} + + ######################## + # ploigos-jenkins-init # + ######################## ploigos-jenkins-init: needs: - cancel-previous @@ -988,6 +1092,112 @@ jobs: - name: Image Digest ๐Ÿ”– run: echo ${{ steps.image_build.outputs.digest }} + ################################# + # ploigos-tool-java_java17_ubi8 # + ################################# + ploigos-tool-java_java17_ubi8 : + needs: + - ploigos-base_ubi8 + + runs-on: ubuntu-latest + + env: + IMAGE_CONTEXT: ./ploigos-tool-java + IMAGE_FILE: Containerfile.ubi8 + IMAGE_NAME: ploigos-tool-java + IMAGE_TAG_LOCAL: localhost:5000/${{ secrets.REGISTRY_REPOSITORY }}/ploigos-tool-java:latest.java17.ubi8 + BASE_IMAGE_NAME: ploigos-base + BASE_IMAGE_VERSION: ${{ needs.ploigos-base_ubi8.outputs.version }} + IMAGE_TAG_FLAVOR: .java17.ubi8 + IMAGE_IS_DEFAULT_FLAVOR: false + + services: + registry: + image: registry:2 + ports: + - 5000:5000 + + outputs: + version: ${{ steps.prep.outputs.version }} + + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Determine Image Version and Tags โš™๏ธ + id: prep + run: ${GITHUB_WORKSPACE}/.github/scripts/determine-image-version.sh + + - name: Version ๐Ÿ“Œ + run: echo ${{ steps.prep.outputs.version }} + + - name: Image Tags ๐Ÿท + run: echo ${{ steps.prep.outputs.tags }} + + - name: Set up QEMU ๐Ÿงฐ + uses: docker/setup-qemu-action@v1.0.1 + + - name: Set up Docker Buildx ๐Ÿงฐ + uses: docker/setup-buildx-action@v1.0.4 + with: + driver-opts: network=host + + - name: Cache Docker layers ๐Ÿ—ƒ + uses: actions/cache@v2.1.3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build Image ๐Ÿ›  + id: image_build + uses: docker/build-push-action@v2.2.1 + env: + IMAGE_BUILD_ARGS: | + BASE_IMAGE=${{ secrets.REGISTRY_URI }}/${{ secrets.REGISTRY_REPOSITORY }}/${{ env.BASE_IMAGE_NAME }}:${{ env.BASE_IMAGE_VERSION }} + JAVA_VERSION=17 + with: + context: ${{ env.IMAGE_CONTEXT }} + file: ${{ env.IMAGE_CONTEXT }}/${{ env.IMAGE_FILE }} + build-args: ${{ env.IMAGE_BUILD_ARGS }} + push: true + tags: ${{ env.IMAGE_TAG_LOCAL }} + labels: | + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.version=${{ steps.prep.outputs.version }} + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.licenses=${{ github.event.repository.license.name }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Test Image ๐Ÿงช + run: | + echo "Verify java installed" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} java -version + + - name: Login to External Registry ๐Ÿ”‘ + uses: docker/login-action@v1 + with: + registry: ${{ secrets.REGISTRY_URI }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Push to External Registry ๐Ÿ”บ + id: push + run: | + docker pull ${{ env.IMAGE_TAG_LOCAL }} + + TAGS=${{ steps.prep.outputs.tags }} + for TAG in ${TAGS//,/ }; do + docker tag ${{ env.IMAGE_TAG_LOCAL }} ${TAG} + docker push ${TAG} + done + + - name: Image Digest ๐Ÿ”– + run: echo ${{ steps.image_build.outputs.digest }} + ################################# # ploigos-tool-maven_java8_ubi8 # ################################# @@ -1208,6 +1418,116 @@ jobs: - name: Image Digest ๐Ÿ”– run: echo ${{ steps.image_build.outputs.digest }} + ################################## + # ploigos-tool-maven_java17_ubi8 # + ################################## + ploigos-tool-maven_java17_ubi8: + needs: + - ploigos-tool-java_java17_ubi8 + + runs-on: ubuntu-latest + + env: + IMAGE_CONTEXT: ./ploigos-tool-maven + IMAGE_FILE: Containerfile.ubi8 + IMAGE_NAME: ploigos-tool-maven + IMAGE_TAG_LOCAL: localhost:5000/${{ secrets.REGISTRY_REPOSITORY }}/ploigos-tool-maven:latest.java17.ubi8 + IMAGE_TAG_FLAVOR: .java17.ubi8 + IMAGE_IS_DEFAULT_FLAVOR: false + BASE_IMAGE_NAME: ploigos-tool-java + BASE_IMAGE_VERSION: ${{ needs.ploigos-tool-java_java17_ubi8.outputs.version }} + + services: + registry: + image: registry:2 + ports: + - 5000:5000 + + outputs: + version: ${{ steps.prep.outputs.version }} + + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Determine Image Version and Tags โš™๏ธ + id: prep + run: ${GITHUB_WORKSPACE}/.github/scripts/determine-image-version.sh + + - name: Version ๐Ÿ“Œ + run: echo ${{ steps.prep.outputs.version }} + + - name: Image Tags ๐Ÿท + run: echo ${{ steps.prep.outputs.tags }} + + - name: Set up QEMU ๐Ÿงฐ + uses: docker/setup-qemu-action@v1.0.1 + + - name: Set up Docker Buildx ๐Ÿงฐ + uses: docker/setup-buildx-action@v1.0.4 + with: + driver-opts: network=host + + - name: Cache Docker layers ๐Ÿ—ƒ + uses: actions/cache@v2.1.3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build Image ๐Ÿ›  + id: image_build + uses: docker/build-push-action@v2.2.1 + env: + IMAGE_BUILD_ARGS: BASE_IMAGE=${{ secrets.REGISTRY_URI }}/${{ secrets.REGISTRY_REPOSITORY }}/${{ env.BASE_IMAGE_NAME }}:${{ env.BASE_IMAGE_VERSION }} + with: + context: ${{ env.IMAGE_CONTEXT }} + file: ${{ env.IMAGE_CONTEXT }}/${{ env.IMAGE_FILE }} + build-args: ${{ env.IMAGE_BUILD_ARGS }} + push: true + tags: ${{ env.IMAGE_TAG_LOCAL }} + labels: | + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.version=${{ steps.prep.outputs.version }} + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.licenses=${{ github.event.repository.license.name }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Test Image ๐Ÿงช + run: | + echo "Verify java installed" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} java -version + + echo "Verify maven installed" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} mvn --version + + echo "Verify can create file in ~/.m2" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} /bin/bash -c "mkdir -p ~/.m2 && touch ~/.m2/test-settings.xml" + + - name: Login to External Registry ๐Ÿ”‘ + uses: docker/login-action@v1 + with: + registry: ${{ secrets.REGISTRY_URI }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Push to External Registry ๐Ÿ”บ + id: push + run: | + docker pull ${{ env.IMAGE_TAG_LOCAL }} + + TAGS=${{ steps.prep.outputs.tags }} + for TAG in ${TAGS//,/ }; do + docker tag ${{ env.IMAGE_TAG_LOCAL }} ${TAG} + docker push ${TAG} + done + + - name: Image Digest ๐Ÿ”– + run: echo ${{ steps.image_build.outputs.digest }} + ################################# # ploigos-tool-jkube_java8_ubi8 # ################################# @@ -1340,9 +1660,9 @@ jobs: - name: Image Digest ๐Ÿ”– run: echo ${{ steps.image_build.outputs.digest }} - ################################# + ################################## # ploigos-tool-jkube_java11_ubi8 # - ################################# + ################################## ploigos-tool-jkube_java11_ubi8: needs: - ploigos-tool-maven_java11_ubi8 @@ -1472,6 +1792,138 @@ jobs: - name: Image Digest ๐Ÿ”– run: echo ${{ steps.image_build.outputs.digest }} + ################################## + # ploigos-tool-jkube_java17_ubi8 # + ################################## + ploigos-tool-jkube_java17_ubi8: + needs: + - ploigos-tool-maven_java17_ubi8 + + runs-on: ubuntu-latest + + env: + IMAGE_CONTEXT: ./ploigos-tool-jkube + IMAGE_FILE: Containerfile.ubi8 + IMAGE_NAME: ploigos-tool-jkube + IMAGE_TAG_LOCAL: localhost:5000/${{ secrets.REGISTRY_REPOSITORY }}/ploigos-tool-jkube:latest.java17.ubi8 + BASE_IMAGE_NAME: ploigos-tool-maven + BASE_IMAGE_VERSION: ${{ needs.ploigos-tool-maven_java17_ubi8.outputs.version }} + IMAGE_TAG_FLAVOR: .java17.ubi8 + IMAGE_IS_DEFAULT_FLAVOR: false + + services: + registry: + image: registry:2 + ports: + - 5000:5000 + + outputs: + version: ${{ steps.prep.outputs.version }} + + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v2 + + - name: Determine Image Version and Tags โš™๏ธ + id: prep + run: ${GITHUB_WORKSPACE}/.github/scripts/determine-image-version.sh + + - name: Version ๐Ÿ“Œ + run: echo ${{ steps.prep.outputs.version }} + + - name: Image Tags ๐Ÿท + run: echo ${{ steps.prep.outputs.tags }} + + - name: Set up QEMU ๐Ÿงฐ + uses: docker/setup-qemu-action@v1.0.1 + + - name: Set up Docker Buildx ๐Ÿงฐ + uses: docker/setup-buildx-action@v1.0.4 + with: + driver-opts: network=host + + - name: Cache Docker layers ๐Ÿ—ƒ + uses: actions/cache@v2.1.3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build Image ๐Ÿ›  + id: image_build + uses: docker/build-push-action@v2.2.1 + env: + IMAGE_BUILD_ARGS: BASE_IMAGE=${{ secrets.REGISTRY_URI }}/${{ secrets.REGISTRY_REPOSITORY }}/${{ env.BASE_IMAGE_NAME }}:${{ env.BASE_IMAGE_VERSION }} + with: + context: ${{ env.IMAGE_CONTEXT }} + file: ${{ env.IMAGE_CONTEXT }}/${{ env.IMAGE_FILE }} + build-args: ${{ env.IMAGE_BUILD_ARGS }} + push: true + tags: ${{ env.IMAGE_TAG_LOCAL }} + labels: | + org.opencontainers.image.created=${{ steps.prep.outputs.created }} + org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.version=${{ steps.prep.outputs.version }} + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.licenses=${{ github.event.repository.license.name }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Test Image ๐Ÿงช + run: | + echo "Verify java installed" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} java -version + + echo "Verify maven installed" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} mvn --version + + echo "Verify can create file in ~/.m2" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} /bin/bash -c "mkdir -p ~/.m2 && touch ~/.m2/test-settings.xml" + + echo "test skopeo" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} skopeo --version + + echo "test podman" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} podman --version + + echo "test buildah" + docker run -u 1001 ${{ env.IMAGE_TAG_LOCAL }} buildah --version + + # NOTE: using --privilaged here, but in kubernetes we give it the specific capabilities + echo "test podman socket created" + docker run -u 1001 --privileged ${{ env.IMAGE_TAG_LOCAL }} /bin/bash -c "ls /home/ploigos/podman.sock" + + # NOTE: using --privilaged here, but in kubernetes we give it the specific capabilities + echo "test can run jkube build" + docker run -u 1001 --privileged ${{ env.IMAGE_TAG_LOCAL }} /bin/bash -c \ + "cd /home/ploigos && git clone https://github.com/eclipse/jkube.git && \ + cd jkube/quickstarts/maven/spring-boot && \ + git checkout v1.3.0 && + mvn package k8s:build -Pkubernetes && \ + (podman images | grep spring-boot)" + + - name: Login to External Registry ๐Ÿ”‘ + uses: docker/login-action@v1 + with: + registry: ${{ secrets.REGISTRY_URI }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Push to External Registry ๐Ÿ”บ + id: push + run: | + docker pull ${{ env.IMAGE_TAG_LOCAL }} + + TAGS=${{ steps.prep.outputs.tags }} + for TAG in ${TAGS//,/ }; do + docker tag ${{ env.IMAGE_TAG_LOCAL }} ${TAG} + docker push ${TAG} + done + + - name: Image Digest ๐Ÿ”– + run: echo ${{ steps.image_build.outputs.digest }} + ########################### # ploigos-tool-sonar_ubi8 # ########################### @@ -2001,9 +2453,9 @@ jobs: - name: Image Digest ๐Ÿ”– run: echo ${{ steps.image_build.outputs.digest }} - ######################################### - # ploigos-tool-javascript_java8_ubi8 # - ######################################### + ###################################### + # ploigos-tool-javascript_java8_ubi8 # + ###################################### ploigos-tool-javascript_java8_ubi8: needs: - ploigos-tool-java_java8_ubi8 @@ -2108,9 +2560,9 @@ jobs: - name: Image Digest ๐Ÿ”– run: echo ${{ steps.image_build.outputs.digest }} - ######################################### - # ploigos-tool-javascript_java11_ubi8 # - ######################################### + ####################################### + # ploigos-tool-javascript_java11_ubi8 # + ####################################### ploigos-tool-javascript_java11_ubi8: needs: - ploigos-tool-java_java11_ubi8