From 4a1eac902e92b2dd9ba8fb88e9d7fdd8dc523cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 26 Nov 2022 06:04:16 +0100 Subject: [PATCH 1/5] Re-add sapjvm 8 docker images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .circleci/config.yml | 129 +++++++++++++++++- Dockerfile_mbtci_template | 65 ++++++--- cmd/testdata/mtahtml5/mta.sh | 2 +- integration/testdata/mtahtml5/mta.sh | 2 +- internal/archive/testdata/mtahtml5/mta.sh | 2 +- internal/archive/testdata/testproject/mta.sh | 2 +- internal/buildops/testdata/mtahtml5/mta.sh | 2 +- internal/buildops/testdata/testproject/mta.sh | 2 +- internal/exec/testdata/mtahtml5/mta.sh | 2 +- package-lock.json | 4 +- scripts/build_image | 2 +- scripts/common_image | 2 +- 12 files changed, 182 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b5ec4b72..b7639091 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,7 +52,7 @@ jobs: command: | go mod vendor - run: cf login -a $CF_API -o $ORG -s $SPACE -u $TECH_USER -p $TECH_PASS - - run: cd integration && go test -tags=integration + - run: cd integration && go test -tags=integration compliance: docker: @@ -139,6 +139,102 @@ jobs: export GITHUB_TOKEN=${CLOUD_MTA_BOT_GITHUB_TOKEN} curl -sfL https://goreleaser.com/static/run | bash + publish-to-dockerhub-java8-node14: + docker: + - image: cimg/go:1.17 + working_directory: ~/go/src/github.com/SAP/cloud-mta-build-tool + steps: + - checkout + - setup_remote_docker: + version: 20.10.6 + - run: + name: build image pre-setup + command: | + #Make sure HEAD points to master + git checkout master + git fetch + git rebase + - run: + name: build Java 8.1.091 & Node 14.21.1 image + command: | + MBT_VERSION=$(cat ./VERSION) + sh $PWD/scripts/build_image 8.1.091 14.21.1 ${MBT_VERSION} + - run: + name: publish Java 8.1.091 & Node 14.21.1 image + command: | + MBT_VERSION=$(cat ./VERSION) + echo "Image release: ${MBT_VERSION}" + #Push to Docker Hub + echo "$DOCKER_HUB_TOKEN" | docker login --username $DOCKER_HUB_USER --password-stdin + sh $PWD/scripts/publish_image 8.1.091 14.21.1 ${MBT_VERSION} "devxci" + #Push to GitHub Container Registry + echo "$CLOUD_MTA_BOT_GITHUB_TOKEN" | docker login "ghcr.io" --username $CLOUD_MTA_BOT_USER --password-stdin + sh $PWD/scripts/publish_image 8.1.091 14.21.1 ${MBT_VERSION} "ghcr.io/sap" + + publish-to-dockerhub-java8-node16: + docker: + - image: cimg/go:1.17 + working_directory: ~/go/src/github.com/SAP/cloud-mta-build-tool + steps: + - checkout + - setup_remote_docker: + version: 20.10.6 + - run: + name: build image pre-setup + command: | + #Make sure HEAD points to master + git checkout master + git fetch + git rebase + - run: + name: build Java 8.1.091 & Node 16.18.1 image + command: | + MBT_VERSION=$(cat ./VERSION) + sh $PWD/scripts/build_image 8.1.091 16.18.1 ${MBT_VERSION} + - run: + name: publish Java 8.1.091 & Node 16.18.1 image + command: | + MBT_VERSION=$(cat ./VERSION) + echo "Image release: ${MBT_VERSION}" + #Push to Docker Hub + echo "$DOCKER_HUB_TOKEN" | docker login --username $DOCKER_HUB_USER --password-stdin + sh $PWD/scripts/publish_image 8.1.091 16.18.1 ${MBT_VERSION} "devxci" + #Push to GitHub Container Registry + echo "$CLOUD_MTA_BOT_GITHUB_TOKEN" | docker login "ghcr.io" --username $CLOUD_MTA_BOT_USER --password-stdin + sh $PWD/scripts/publish_image 8.1.091 16.18.1 ${MBT_VERSION} "ghcr.io/sap" + + publish-to-dockerhub-java8-node18: + docker: + - image: cimg/go:1.17 + working_directory: ~/go/src/github.com/SAP/cloud-mta-build-tool + steps: + - checkout + - setup_remote_docker: + version: 20.10.6 + - run: + name: build image pre-setup + command: | + #Make sure HEAD points to master + git checkout master + git fetch + git rebase + - run: + name: build Java 8.1.091 & Node 18.12.1 image + command: | + MBT_VERSION=$(cat ./VERSION) + sh $PWD/scripts/build_image 8.1.091 18.12.1 ${MBT_VERSION} + - run: + name: publish Java 8.1.091 & Node 18.12.1 image + command: | + MBT_VERSION=$(cat ./VERSION) + echo "Image release: ${MBT_VERSION}" + #Push to Docker Hub + echo "$DOCKER_HUB_TOKEN" | docker login --username $DOCKER_HUB_USER --password-stdin + sh $PWD/scripts/publish_image 8.1.091 18.12.1 ${MBT_VERSION} "devxci" + #Push to GitHub Container Registry + echo "$CLOUD_MTA_BOT_GITHUB_TOKEN" | docker login "ghcr.io" --username $CLOUD_MTA_BOT_USER --password-stdin + sh $PWD/scripts/publish_image 8.1.091 18.12.1 ${MBT_VERSION} "ghcr.io/sap" + publish-to-dockerhub-java11-node14: docker: - image: cimg/go:1.17 @@ -157,8 +253,8 @@ jobs: - run: name: build Java 11.0.17 & Node 14.21.1 image command: | - MBT_VERSION=$(cat ./VERSION) - sh $PWD/scripts/build_image 11.0.17 14.21.1 ${MBT_VERSION} + MBT_VERSION=$(cat ./VERSION) + sh $PWD/scripts/build_image 11.0.17 14.21.1 ${MBT_VERSION} - run: name: publish Java 11.0.17 & Node 14.21.1 image command: | @@ -553,6 +649,30 @@ workflows: only: /release/ branches: ignore: /.*/ + - publish-to-dockerhub-java8-node14: + requires: + - publish-to-npm + filters: + tags: + only: /release/ + branches: + ignore: /.*/ + - publish-to-dockerhub-java8-node16: + requires: + - publish-to-npm + filters: + tags: + only: /release/ + branches: + ignore: /.*/ + - publish-to-dockerhub-java8-node18: + requires: + - publish-to-npm + filters: + tags: + only: /release/ + branches: + ignore: /.*/ - publish-to-dockerhub-java11-node14: requires: - publish-to-npm @@ -627,6 +747,9 @@ workflows: ignore: /.*/ - remove-github-release-tag: requires: + - publish-to-dockerhub-java8-node14 + - publish-to-dockerhub-java8-node16 + - publish-to-dockerhub-java8-node18 - publish-to-dockerhub-java11-node14 - publish-to-dockerhub-java11-node16 - publish-to-dockerhub-java11-node18 diff --git a/Dockerfile_mbtci_template b/Dockerfile_mbtci_template index 3c7ccf93..015654ed 100644 --- a/Dockerfile_mbtci_template +++ b/Dockerfile_mbtci_template @@ -135,31 +135,56 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ && go version # Install SAPMachine -RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ - && case "${dpkgArch##*-}" in \ +RUN sapmachine_install() { \ + ARCH=; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ amd64) ARCH='amd64';; \ *) echo "unsupported architecture"; exit 1 ;; \ - esac \ + esac; \ + apt-get update; \ + apt-get install -y ca-certificates gnupg dirmngr --no-install-recommends; \ + rm -rf /var/lib/apt/lists/*; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in \ + CACB9FE09150307D1D22D82962754C3B3ABCFE23 \ + ; do \ + gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/sapmachine.gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ + gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/sapmachine.gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \ + done; \ + chmod 644 /etc/apt/trusted.gpg.d/sapmachine.gpg; \ + echo "deb http://dist.sapmachine.io/debian/${ARCH}/ ./" | tee /etc/apt/sources.list.d/sapmachine.list; \ + apt-get update; \ + apt-get install -y sapmachine-$(echo ${SAPMACHINE_VERSION} | cut -d. -f1)-jdk=${SAPMACHINE_VERSION} --no-install-recommends; \ + rm -rf "$GNUPGHOME" /var/lib/apt/lists/*; \ + apt-get remove --purge --autoremove -y ca-certificates gnupg dirmngr; \ + }; \ + sapjvm_install() { \ + ARCH=; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) ARCH='x64';; \ + ppc64el) ARCH='ppc64le';; \ + *) echo "unsupported architecture"; exit 1 ;; \ + esac; \ + apt-get update; \ + apt-get install -y ca-certificates curl libarchive-tools --no-install-recommends; \ + rm -rf /var/lib/apt/lists/*; \ + curl -fsSLO --compressed -b 'eula_3_1_agreed=tools.hana.ondemand.com/developer-license-3_1.txt' https://tools.hana.ondemand.com/additional/sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip; \ + echo "583dedfeee0c119839a610ddc8c6768d0c044429 sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip" | sha1sum -c -; \ + bsdtar -xvf sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip -C /usr/local --strip-components=1; \ + rm -f sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip; \ + apt-get remove --purge --auto-remove -y ca-certificates curl libarchive-tools; \ + } \ && set -ex \ - && apt-get update \ - && apt-get install -y ca-certificates gnupg dirmngr --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* \ - && export GNUPGHOME="$(mktemp -d)" \ - && for key in \ - CACB9FE09150307D1D22D82962754C3B3ABCFE23 \ - ; do \ - gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/sapmachine.gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ - gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/sapmachine.gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \ - done \ - && chmod 644 /etc/apt/trusted.gpg.d/sapmachine.gpg \ - && echo "deb http://dist.sapmachine.io/debian/${ARCH}/ ./" | tee /etc/apt/sources.list.d/sapmachine.list \ - && apt-get update \ - && apt-get install -y sapmachine-$(echo ${SAPMACHINE_VERSION} | cut -d. -f1)-jdk=${SAPMACHINE_VERSION} --no-install-recommends \ - && rm -rf "$GNUPGHOME" /var/lib/apt/lists/* \ - && apt-get remove --purge --autoremove -y ca-certificates gnupg dirmngr \ + && if [ $(echo ${SAPMACHINE_VERSION} | cut -d. -f1) -le 8 ]; then \ + sapjvm_install; \ + else \ + sapmachine_install; \ + fi \ # smoke test && echo "SAPMachine ${SAPMACHINE_VERSION} install smoke test!" \ - && java --version + && java -version # Install Maven RUN set -ex \ diff --git a/cmd/testdata/mtahtml5/mta.sh b/cmd/testdata/mtahtml5/mta.sh index fdf3eead..e6466e02 100644 --- a/cmd/testdata/mtahtml5/mta.sh +++ b/cmd/testdata/mtahtml5/mta.sh @@ -16,7 +16,7 @@ # ----Executing build for module ui5app ------- # installing module dependencies & execute grunt & remove dev dependencies - (npm install && grunt && npm prune production ) & + (npm install && grunt && npm prune production) & # wait to the process to finish wait # Pack module after build for deployment diff --git a/integration/testdata/mtahtml5/mta.sh b/integration/testdata/mtahtml5/mta.sh index fdf3eead..e6466e02 100755 --- a/integration/testdata/mtahtml5/mta.sh +++ b/integration/testdata/mtahtml5/mta.sh @@ -16,7 +16,7 @@ # ----Executing build for module ui5app ------- # installing module dependencies & execute grunt & remove dev dependencies - (npm install && grunt && npm prune production ) & + (npm install && grunt && npm prune production) & # wait to the process to finish wait # Pack module after build for deployment diff --git a/internal/archive/testdata/mtahtml5/mta.sh b/internal/archive/testdata/mtahtml5/mta.sh index fdf3eead..e6466e02 100755 --- a/internal/archive/testdata/mtahtml5/mta.sh +++ b/internal/archive/testdata/mtahtml5/mta.sh @@ -16,7 +16,7 @@ # ----Executing build for module ui5app ------- # installing module dependencies & execute grunt & remove dev dependencies - (npm install && grunt && npm prune production ) & + (npm install && grunt && npm prune production) & # wait to the process to finish wait # Pack module after build for deployment diff --git a/internal/archive/testdata/testproject/mta.sh b/internal/archive/testdata/testproject/mta.sh index fdf3eead..e6466e02 100644 --- a/internal/archive/testdata/testproject/mta.sh +++ b/internal/archive/testdata/testproject/mta.sh @@ -16,7 +16,7 @@ # ----Executing build for module ui5app ------- # installing module dependencies & execute grunt & remove dev dependencies - (npm install && grunt && npm prune production ) & + (npm install && grunt && npm prune production) & # wait to the process to finish wait # Pack module after build for deployment diff --git a/internal/buildops/testdata/mtahtml5/mta.sh b/internal/buildops/testdata/mtahtml5/mta.sh index fdf3eead..e6466e02 100644 --- a/internal/buildops/testdata/mtahtml5/mta.sh +++ b/internal/buildops/testdata/mtahtml5/mta.sh @@ -16,7 +16,7 @@ # ----Executing build for module ui5app ------- # installing module dependencies & execute grunt & remove dev dependencies - (npm install && grunt && npm prune production ) & + (npm install && grunt && npm prune production) & # wait to the process to finish wait # Pack module after build for deployment diff --git a/internal/buildops/testdata/testproject/mta.sh b/internal/buildops/testdata/testproject/mta.sh index fdf3eead..e6466e02 100644 --- a/internal/buildops/testdata/testproject/mta.sh +++ b/internal/buildops/testdata/testproject/mta.sh @@ -16,7 +16,7 @@ # ----Executing build for module ui5app ------- # installing module dependencies & execute grunt & remove dev dependencies - (npm install && grunt && npm prune production ) & + (npm install && grunt && npm prune production) & # wait to the process to finish wait # Pack module after build for deployment diff --git a/internal/exec/testdata/mtahtml5/mta.sh b/internal/exec/testdata/mtahtml5/mta.sh index fdf3eead..e6466e02 100644 --- a/internal/exec/testdata/mtahtml5/mta.sh +++ b/internal/exec/testdata/mtahtml5/mta.sh @@ -16,7 +16,7 @@ # ----Executing build for module ui5app ------- # installing module dependencies & execute grunt & remove dev dependencies - (npm install && grunt && npm prune production ) & + (npm install && grunt && npm prune production) & # wait to the process to finish wait # Pack module after build for deployment diff --git a/package-lock.json b/package-lock.json index 1d2733f8..cc693595 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mbt", - "version": "1.2.19", + "version": "1.2.20", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mbt", - "version": "1.2.19", + "version": "1.2.20", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/scripts/build_image b/scripts/build_image index 405c6ea4..46c78d8d 100644 --- a/scripts/build_image +++ b/scripts/build_image @@ -19,7 +19,7 @@ echo "Build mbtci${JAVA_VERSION}${NODE_VERSION}:${MBT_VERSION}" docker build -t mbtci${JAVA_VERSION}${NODE_VERSION}:${MBT_VERSION} . # test image -if [ "$JAVA_MAJOR_VERSION" = "11" ] || [ "$JAVA_MAJOR_VERSION" = "17" ] || [ "$JAVA_MAJOR_VERSION" = "19" ]; then +if [ "$JAVA_MAJOR_VERSION" = "8" ] || [ "$JAVA_MAJOR_VERSION" = "11" ] || [ "$JAVA_MAJOR_VERSION" = "17" ] || [ "$JAVA_MAJOR_VERSION" = "19" ]; then cp test/goss/goss_template.yaml test/goss/goss.yaml sed_i "s/NODE_VERSION_TEMPLATE/${NODE_VERSION_TEMPLATE}/" test/goss/goss.yaml sed_i "s/JAVA_VERSION_TEMPLATE/${JAVA_VERSION_TEMPLATE}/" test/goss/goss.yaml diff --git a/scripts/common_image b/scripts/common_image index 804616b7..3a5509b6 100644 --- a/scripts/common_image +++ b/scripts/common_image @@ -11,7 +11,7 @@ export NODE_MAJOR_VERSION="$(echo ${NODE_VERSION_TEMPLATE}|awk -F. '{printf "%d" echo "Java major version: ${JAVA_MAJOR_VERSION}, Node major version: ${NODE_MAJOR_VERSION}" -if ([ "$JAVA_MAJOR_VERSION" -ne "11" ] && [ "$JAVA_MAJOR_VERSION" -ne "17" ] && [ "$JAVA_MAJOR_VERSION" -ne "19" ]) || \ +if ([ "$JAVA_MAJOR_VERSION" -ne "8" ] && [ "$JAVA_MAJOR_VERSION" -ne "11" ] && [ "$JAVA_MAJOR_VERSION" -ne "17" ] && [ "$JAVA_MAJOR_VERSION" -ne "19" ]) || \ ([ "$NODE_MAJOR_VERSION" -ne "14" ] && [ "$NODE_MAJOR_VERSION" -ne "16" ] && [ "$NODE_MAJOR_VERSION" -ne "18" ]) then echo "Java: ${JAVA_MAJOR_VERSION}, Node: ${NODE_MAJOR_VERSION} combination is not supported!" From bbbb80e919918dbc1b066cf04787fc9d2acc2718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 26 Nov 2022 06:35:15 +0100 Subject: [PATCH 2/5] Ensure JAVA_HOME is properly define as env variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- Dockerfile_mbtci_template | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile_mbtci_template b/Dockerfile_mbtci_template index 015654ed..afa828ec 100644 --- a/Dockerfile_mbtci_template +++ b/Dockerfile_mbtci_template @@ -12,6 +12,7 @@ ARG SAPMACHINE_VERSION=JAVA_VERSION_TEMPLATE # Environment variables ENV PYTHON /usr/bin/python3 +ENV JAVA_HOME /opt/jdk ENV MAVEN_HOME /usr/share/maven ENV M2_HOME ${MAVEN_HOME} ENV PATH /usr/local/go/bin:$PATH @@ -158,6 +159,7 @@ RUN sapmachine_install() { \ apt-get install -y sapmachine-$(echo ${SAPMACHINE_VERSION} | cut -d. -f1)-jdk=${SAPMACHINE_VERSION} --no-install-recommends; \ rm -rf "$GNUPGHOME" /var/lib/apt/lists/*; \ apt-get remove --purge --autoremove -y ca-certificates gnupg dirmngr; \ + ln -s /usr/lib/jvm/sapmachine-$(echo ${SAPMACHINE_VERSION} | cut -d. -f1) ${JAVA_HOME}; \ }; \ sapjvm_install() { \ ARCH=; \ @@ -175,6 +177,7 @@ RUN sapmachine_install() { \ bsdtar -xvf sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip -C /usr/local --strip-components=1; \ rm -f sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip; \ apt-get remove --purge --auto-remove -y ca-certificates curl libarchive-tools; \ + ln -s /usr/local ${JAVA_HOME}; \ } \ && set -ex \ && if [ $(echo ${SAPMACHINE_VERSION} | cut -d. -f1) -le 8 ]; then \ From 1b6820308c438616e914b3c89c2eaadfcd979a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 26 Nov 2022 06:42:43 +0100 Subject: [PATCH 3/5] Dockerfile_mbtci_template: Factor out SAP machine version handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- Dockerfile_mbtci_template | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile_mbtci_template b/Dockerfile_mbtci_template index afa828ec..d6aa2cc1 100644 --- a/Dockerfile_mbtci_template +++ b/Dockerfile_mbtci_template @@ -137,6 +137,7 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ # Install SAPMachine RUN sapmachine_install() { \ + SAPMACHINE_MAJOR_VERSION=$(echo ${SAPMACHINE_VERSION} | cut -d. -f1); \ ARCH=; \ dpkgArch="$(dpkg --print-architecture)"; \ case "${dpkgArch##*-}" in \ @@ -156,10 +157,10 @@ RUN sapmachine_install() { \ chmod 644 /etc/apt/trusted.gpg.d/sapmachine.gpg; \ echo "deb http://dist.sapmachine.io/debian/${ARCH}/ ./" | tee /etc/apt/sources.list.d/sapmachine.list; \ apt-get update; \ - apt-get install -y sapmachine-$(echo ${SAPMACHINE_VERSION} | cut -d. -f1)-jdk=${SAPMACHINE_VERSION} --no-install-recommends; \ + apt-get install -y sapmachine-${SAPMACHINE_MAJOR_VERSION}-jdk=${SAPMACHINE_VERSION} --no-install-recommends; \ rm -rf "$GNUPGHOME" /var/lib/apt/lists/*; \ apt-get remove --purge --autoremove -y ca-certificates gnupg dirmngr; \ - ln -s /usr/lib/jvm/sapmachine-$(echo ${SAPMACHINE_VERSION} | cut -d. -f1) ${JAVA_HOME}; \ + ln -s /usr/lib/jvm/sapmachine-${SAPMACHINE_MAJOR_VERSION} ${JAVA_HOME}; \ }; \ sapjvm_install() { \ ARCH=; \ From eb77e48c76b6adf6575f811a0fa9d0eb04b17aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 26 Nov 2022 11:22:59 +0100 Subject: [PATCH 4/5] Cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .circleci/config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b7639091..1d3a5e93 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -157,8 +157,8 @@ jobs: - run: name: build Java 8.1.091 & Node 14.21.1 image command: | - MBT_VERSION=$(cat ./VERSION) - sh $PWD/scripts/build_image 8.1.091 14.21.1 ${MBT_VERSION} + MBT_VERSION=$(cat ./VERSION) + sh $PWD/scripts/build_image 8.1.091 14.21.1 ${MBT_VERSION} - run: name: publish Java 8.1.091 & Node 14.21.1 image command: | @@ -189,8 +189,8 @@ jobs: - run: name: build Java 8.1.091 & Node 16.18.1 image command: | - MBT_VERSION=$(cat ./VERSION) - sh $PWD/scripts/build_image 8.1.091 16.18.1 ${MBT_VERSION} + MBT_VERSION=$(cat ./VERSION) + sh $PWD/scripts/build_image 8.1.091 16.18.1 ${MBT_VERSION} - run: name: publish Java 8.1.091 & Node 16.18.1 image command: | @@ -221,8 +221,8 @@ jobs: - run: name: build Java 8.1.091 & Node 18.12.1 image command: | - MBT_VERSION=$(cat ./VERSION) - sh $PWD/scripts/build_image 8.1.091 18.12.1 ${MBT_VERSION} + MBT_VERSION=$(cat ./VERSION) + sh $PWD/scripts/build_image 8.1.091 18.12.1 ${MBT_VERSION} - run: name: publish Java 8.1.091 & Node 18.12.1 image command: | From 1438f7f8175ef9bf121345663d694349d976f205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 1 Jan 2023 00:42:04 +0100 Subject: [PATCH 5/5] Do not keep the owner at unzip the SAP jvm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- Dockerfile_mbtci_template | 12 ++++++------ scripts/build_image | 3 ++- scripts/common_image | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile_mbtci_template b/Dockerfile_mbtci_template index aa491cde..098fdfaa 100644 --- a/Dockerfile_mbtci_template +++ b/Dockerfile_mbtci_template @@ -73,12 +73,12 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \ done \ - && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ - && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v${NODE_VERSION}/SHASUMS256.txt.asc" \ && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ - && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ - && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ - && rm -rf "$GNUPGHOME" "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ + && grep " node-v${NODE_VERSION}-linux-${ARCH}.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xJf "node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm -rf "$GNUPGHOME" "node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ && apt-mark auto '.*' > /dev/null \ && find /usr/local -type f -executable -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ @@ -183,7 +183,7 @@ RUN sapmachine_install() { \ rm -rf /var/lib/apt/lists/*; \ curl -fsSLO --compressed -b 'eula_3_1_agreed=tools.hana.ondemand.com/developer-license-3_1.txt' https://tools.hana.ondemand.com/additional/sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip; \ echo "583dedfeee0c119839a610ddc8c6768d0c044429 sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip" | sha1sum -c -; \ - bsdtar -xvf sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip -C /usr/local --strip-components=1; \ + bsdtar -xvf sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip -C /usr/local --strip-components=1 --no-same-owner; \ rm -f sapjvm-${SAPMACHINE_VERSION}-linux-${ARCH}.zip; \ apt-get remove --purge --auto-remove -y ca-certificates curl libarchive-tools; \ ln -s /usr/local ${JAVA_HOME}; \ diff --git a/scripts/build_image b/scripts/build_image index 46c78d8d..65382cb0 100644 --- a/scripts/build_image +++ b/scripts/build_image @@ -19,7 +19,8 @@ echo "Build mbtci${JAVA_VERSION}${NODE_VERSION}:${MBT_VERSION}" docker build -t mbtci${JAVA_VERSION}${NODE_VERSION}:${MBT_VERSION} . # test image -if [ "$JAVA_MAJOR_VERSION" = "8" ] || [ "$JAVA_MAJOR_VERSION" = "11" ] || [ "$JAVA_MAJOR_VERSION" = "17" ] || [ "$JAVA_MAJOR_VERSION" = "19" ]; then +if [ "$JAVA_MAJOR_VERSION" = "8" ] || [ "$JAVA_MAJOR_VERSION" = "11" ] || \ + [ "$JAVA_MAJOR_VERSION" = "17" ] || [ "$JAVA_MAJOR_VERSION" = "19" ]; then cp test/goss/goss_template.yaml test/goss/goss.yaml sed_i "s/NODE_VERSION_TEMPLATE/${NODE_VERSION_TEMPLATE}/" test/goss/goss.yaml sed_i "s/JAVA_VERSION_TEMPLATE/${JAVA_VERSION_TEMPLATE}/" test/goss/goss.yaml diff --git a/scripts/common_image b/scripts/common_image index 3a5509b6..a91a3948 100644 --- a/scripts/common_image +++ b/scripts/common_image @@ -11,7 +11,8 @@ export NODE_MAJOR_VERSION="$(echo ${NODE_VERSION_TEMPLATE}|awk -F. '{printf "%d" echo "Java major version: ${JAVA_MAJOR_VERSION}, Node major version: ${NODE_MAJOR_VERSION}" -if ([ "$JAVA_MAJOR_VERSION" -ne "8" ] && [ "$JAVA_MAJOR_VERSION" -ne "11" ] && [ "$JAVA_MAJOR_VERSION" -ne "17" ] && [ "$JAVA_MAJOR_VERSION" -ne "19" ]) || \ +if ([ "$JAVA_MAJOR_VERSION" -ne "8" ] && [ "$JAVA_MAJOR_VERSION" -ne "11" ] && \ + [ "$JAVA_MAJOR_VERSION" -ne "17" ] && [ "$JAVA_MAJOR_VERSION" -ne "19" ]) || \ ([ "$NODE_MAJOR_VERSION" -ne "14" ] && [ "$NODE_MAJOR_VERSION" -ne "16" ] && [ "$NODE_MAJOR_VERSION" -ne "18" ]) then echo "Java: ${JAVA_MAJOR_VERSION}, Node: ${NODE_MAJOR_VERSION} combination is not supported!"