From 1f7f972e6c83686e66985ee65eea7769b11aee8d Mon Sep 17 00:00:00 2001 From: Scott Fryer Date: Fri, 20 Dec 2024 09:35:38 +0000 Subject: [PATCH 01/23] Initial Commit Of New Installer Automated Build Process. --- linux_new/Jenkinsfile | 814 ++++++++++++++++++ linux_new/LICENSE.txt | 202 +++++ linux_new/NOTES.txt | 160 ++++ linux_new/README.md | 245 ++++++ linux_new/azure-pipelines.yml | 71 ++ linux_new/build.gradle | 61 ++ linux_new/ca-certificates/build.gradle | 12 + linux_new/ca-certificates/debian/build.gradle | 132 +++ .../debian/src/main/packaging/Dockerfile | 19 + .../debian/src/main/packaging/build.sh | 15 + .../main/packaging/debian/adoptium-cacerts.sh | 26 + .../src/main/packaging/debian/changelog | 29 + .../debian/src/main/packaging/debian/compat | 1 + .../debian/src/main/packaging/debian/control | 13 + .../debian/src/main/packaging/debian/default | 5 + .../debian/src/main/packaging/debian/postinst | 18 + .../debian/src/main/packaging/debian/postrm | 18 + .../debian/src/main/packaging/debian/rules | 22 + .../debian/src/main/packaging/entrypoint.sh | 13 + .../cacertificates/AptOperationsTest.java | 231 +++++ .../ChangesVerificationTest.java | 54 ++ .../org/adoptium/cacertificates/DebFiles.java | 66 ++ .../cacertificates/DebianFlavours.java | 59 ++ .../cacertificates/DebianIntegrationTest.java | 242 ++++++ .../org/adoptium/cacertificates/IOUtil.java | 53 ++ .../cacertificates/TestContainersUtil.java | 53 ++ .../packageTest/resources/deb-contents.txt | 15 + .../resources/junit-platform.properties | 2 + linux_new/generate_spec.py | 114 +++ linux_new/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59821 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + linux_new/gradlew | 234 +++++ linux_new/gradlew.bat | 89 ++ linux_new/jdk/alpine/build.gradle | 154 ++++ .../jdk/alpine/src/main/packaging/Dockerfile | 43 + .../jdk/alpine/src/main/packaging/build.sh | 16 + .../alpine/src/main/packaging/entrypoint.sh | 19 + .../main/packaging/temurin/11/HelloWorld.java | 3 + .../packaging/temurin/11/TestCryptoLevel.java | 72 ++ .../main/packaging/temurin/11/TestECDSA.java | 49 ++ .../temurin/11/alpine.jdk11.template.j2 | 102 +++ .../main/packaging/temurin/17/HelloWorld.java | 3 + .../packaging/temurin/17/TestCryptoLevel.java | 72 ++ .../main/packaging/temurin/17/TestECDSA.java | 49 ++ .../temurin/17/alpine.jdk17.template.j2 | 102 +++ .../main/packaging/temurin/21/HelloWorld.java | 3 + .../packaging/temurin/21/TestCryptoLevel.java | 72 ++ .../main/packaging/temurin/21/TestECDSA.java | 49 ++ .../temurin/21/alpine.jdk21.template.j2 | 103 +++ .../main/packaging/temurin/23/HelloWorld.java | 3 + .../packaging/temurin/23/TestCryptoLevel.java | 72 ++ .../main/packaging/temurin/23/TestECDSA.java | 49 ++ .../temurin/23/alpine.jdk23.template.j2 | 102 +++ .../main/packaging/temurin/24/HelloWorld.java | 3 + .../packaging/temurin/24/TestCryptoLevel.java | 72 ++ .../main/packaging/temurin/24/TestECDSA.java | 49 ++ .../temurin/24/alpine.jdk24.template.j2 | 102 +++ .../main/packaging/temurin/8/HelloWorld.java | 3 + .../temurin/8/alpine.jdk8.template.j2 | 72 ++ .../java/packaging/AlpineFlavours.java | 53 ++ .../packageTest/java/packaging/ApkFiles.java | 52 ++ .../java/packaging/ApkOperationsTest.java | 63 ++ .../java/packaging/TestContainersUtil.java | 53 ++ .../resources/junit-platform.properties | 2 + linux_new/jdk/build.gradle | 12 + linux_new/jdk/debian/build.gradle | 205 +++++ .../jdk/debian/src/main/packaging/Dockerfile | 35 + .../jdk/debian/src/main/packaging/build.sh | 42 + .../debian/src/main/packaging/entrypoint.sh | 14 + .../temurin/11/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/11/debian/compat | 1 + .../temurin/11/debian/control.template.j2 | 62 ++ .../packaging/temurin/11/debian/copyright | 5 + .../main/packaging/temurin/11/debian/jinfo.in | 40 + .../packaging/temurin/11/debian/postinst.in | 42 + .../main/packaging/temurin/11/debian/prerm.in | 28 + .../temurin/11/debian/rules.template.j2 | 75 ++ .../temurin/17/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/17/debian/compat | 1 + .../temurin/17/debian/control.template.j2 | 86 ++ .../packaging/temurin/17/debian/copyright | 5 + .../main/packaging/temurin/17/debian/jinfo.in | 35 + .../packaging/temurin/17/debian/postinst.in | 42 + .../main/packaging/temurin/17/debian/prerm.in | 28 + .../temurin/17/debian/rules.template.j2 | 75 ++ .../temurin/21/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/21/debian/compat | 1 + .../temurin/21/debian/control.template.j2 | 99 +++ .../packaging/temurin/21/debian/copyright | 5 + .../main/packaging/temurin/21/debian/jinfo.in | 36 + .../packaging/temurin/21/debian/postinst.in | 42 + .../main/packaging/temurin/21/debian/prerm.in | 28 + .../temurin/21/debian/rules.template.j2 | 72 ++ .../temurin/23/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/23/debian/compat | 1 + .../temurin/23/debian/control.template.j2 | 105 +++ .../packaging/temurin/23/debian/copyright | 5 + .../main/packaging/temurin/23/debian/jinfo.in | 36 + .../packaging/temurin/23/debian/postinst.in | 42 + .../main/packaging/temurin/23/debian/prerm.in | 28 + .../temurin/23/debian/rules.template.j2 | 72 ++ .../temurin/24/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/24/debian/compat | 1 + .../temurin/24/debian/control.template.j2 | 108 +++ .../packaging/temurin/24/debian/copyright | 5 + .../main/packaging/temurin/24/debian/jinfo.in | 36 + .../packaging/temurin/24/debian/postinst.in | 42 + .../main/packaging/temurin/24/debian/prerm.in | 28 + .../temurin/24/debian/rules.template.j2 | 72 ++ .../temurin/8/debian/changelog.template.j2 | 6 + .../main/packaging/temurin/8/debian/compat | 1 + .../temurin/8/debian/control.template.j2 | 52 ++ .../main/packaging/temurin/8/debian/copyright | 5 + .../main/packaging/temurin/8/debian/jinfo.in | 49 ++ .../packaging/temurin/8/debian/postinst.in | 42 + .../main/packaging/temurin/8/debian/prerm.in | 28 + .../temurin/8/debian/rules.template.j2 | 77 ++ .../java/packaging/AptOperationsTest.java | 79 ++ .../packageTest/java/packaging/DebFiles.java | 52 ++ .../java/packaging/DebianFlavours.java | 60 ++ .../java/packaging/TestContainersUtil.java | 53 ++ .../adoptium-ca-certificates_1.0.0-1_all.deb | Bin 0 -> 2152 bytes .../resources/junit-platform.properties | 2 + linux_new/jdk/rhel/build.gradle | 180 ++++ .../jdk/rhel/src/main/packaging/Dockerfile | 40 + .../jdk/rhel/src/main/packaging/build.sh | 76 ++ .../jdk/rhel/src/main/packaging/entrypoint.sh | 16 + .../temurin/11/temurin-11-jdk.template.j2 | 217 +++++ .../temurin/17/temurin-17-jdk.template.j2 | 214 +++++ .../temurin/21/temurin-21-jdk.template.j2 | 205 +++++ .../temurin/23/temurin-23-jdk.template.j2 | 205 +++++ .../temurin/24/temurin-24-jdk.template.j2 | 205 +++++ .../temurin/8/temurin-8-jdk.template.j2 | 253 ++++++ .../java/packaging/DnfOperationsTest.java | 80 ++ .../java/packaging/RedHatFlavoursWithDnf.java | 67 ++ .../java/packaging/RedHatFlavoursWithYum.java | 75 ++ .../packageTest/java/packaging/RpmFiles.java | 60 ++ .../java/packaging/TestContainersUtil.java | 53 ++ .../java/packaging/YumOperationsTest.java | 81 ++ linux_new/jdk/suse/build.gradle | 150 ++++ .../jdk/suse/src/main/packaging/Dockerfile | 42 + .../jdk/suse/src/main/packaging/build.sh | 47 + .../jdk/suse/src/main/packaging/entrypoint.sh | 16 + .../temurin/11/temurin-11-jdk.template.j2 | 208 +++++ .../temurin/17/temurin-17-jdk.template.j2 | 204 +++++ .../temurin/21/temurin-21-jdk.template.j2 | 196 +++++ .../temurin/23/temurin-23-jdk.template.j2 | 195 +++++ .../temurin/24/temurin-24-jdk.template.j2 | 195 +++++ .../temurin/8/temurin-8-jdk.template.j2 | 252 ++++++ .../packageTest/java/packaging/RpmFiles.java | 60 ++ .../java/packaging/SuseFlavours.java | 58 ++ .../java/packaging/TestContainersUtil.java | 53 ++ .../java/packaging/ZypperOperationsTest.java | 83 ++ linux_new/jre/alpine/build.gradle | 155 ++++ .../jre/alpine/src/main/packaging/Dockerfile | 39 + .../jre/alpine/src/main/packaging/build.sh | 16 + .../alpine/src/main/packaging/entrypoint.sh | 19 + .../temurin/11/alpine.jre11.template.j2 | 76 ++ .../temurin/17/alpine.jre17.template.j2 | 75 ++ .../temurin/21/alpine.jre21.template.j2 | 74 ++ .../temurin/23/alpine.jre23.template.j2 | 74 ++ .../temurin/24/alpine.jre24.template.j2 | 74 ++ .../temurin/8/alpine.jre8.template.j2 | 64 ++ .../java/packaging/AlpineFlavours.java | 53 ++ .../packageTest/java/packaging/ApkFiles.java | 52 ++ .../java/packaging/ApkOperationsTest.java | 63 ++ .../java/packaging/TestContainersUtil.java | 53 ++ .../resources/junit-platform.properties | 2 + linux_new/jre/build.gradle | 12 + linux_new/jre/debian/build.gradle | 200 +++++ .../jre/debian/src/main/packaging/Dockerfile | 35 + .../jre/debian/src/main/packaging/build.sh | 42 + .../debian/src/main/packaging/entrypoint.sh | 14 + .../temurin/11/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/11/debian/compat | 1 + .../temurin/11/debian/control.template.j2 | 43 + .../packaging/temurin/11/debian/copyright | 5 + .../main/packaging/temurin/11/debian/jinfo.in | 15 + .../packaging/temurin/11/debian/postinst.in | 42 + .../main/packaging/temurin/11/debian/prerm.in | 28 + .../temurin/11/debian/rules.template.j2 | 63 ++ .../temurin/17/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/17/debian/compat | 1 + .../temurin/17/debian/control.template.j2 | 55 ++ .../packaging/temurin/17/debian/copyright | 5 + .../main/packaging/temurin/17/debian/jinfo.in | 10 + .../packaging/temurin/17/debian/postinst.in | 42 + .../main/packaging/temurin/17/debian/prerm.in | 28 + .../temurin/17/debian/rules.template.j2 | 63 ++ .../temurin/21/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/21/debian/compat | 1 + .../temurin/21/debian/control.template.j2 | 63 ++ .../packaging/temurin/21/debian/copyright | 5 + .../main/packaging/temurin/21/debian/jinfo.in | 11 + .../packaging/temurin/21/debian/postinst.in | 42 + .../main/packaging/temurin/21/debian/prerm.in | 28 + .../temurin/21/debian/rules.template.j2 | 63 ++ .../temurin/23/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/23/debian/compat | 1 + .../temurin/23/debian/control.template.j2 | 67 ++ .../packaging/temurin/23/debian/copyright | 5 + .../main/packaging/temurin/23/debian/jinfo.in | 11 + .../packaging/temurin/23/debian/postinst.in | 42 + .../main/packaging/temurin/23/debian/prerm.in | 28 + .../temurin/23/debian/rules.template.j2 | 63 ++ .../temurin/24/debian/changelog.template.j2 | 5 + .../main/packaging/temurin/24/debian/compat | 1 + .../temurin/24/debian/control.template.j2 | 69 ++ .../packaging/temurin/24/debian/copyright | 5 + .../main/packaging/temurin/24/debian/jinfo.in | 11 + .../packaging/temurin/24/debian/postinst.in | 42 + .../main/packaging/temurin/24/debian/prerm.in | 28 + .../temurin/24/debian/rules.template.j2 | 63 ++ .../temurin/8/debian/changelog.template.j2 | 6 + .../main/packaging/temurin/8/debian/compat | 1 + .../temurin/8/debian/control.template.j2 | 39 + .../main/packaging/temurin/8/debian/copyright | 5 + .../main/packaging/temurin/8/debian/jinfo.in | 16 + .../packaging/temurin/8/debian/postinst.in | 42 + .../main/packaging/temurin/8/debian/prerm.in | 28 + .../temurin/8/debian/rules.template.j2 | 64 ++ .../java/packaging/AptOperationsTest.java | 79 ++ .../packageTest/java/packaging/DebFiles.java | 52 ++ .../java/packaging/DebianFlavours.java | 60 ++ .../java/packaging/TestContainersUtil.java | 53 ++ .../adoptium-ca-certificates_1.0.0-1_all.deb | Bin 0 -> 2152 bytes .../resources/junit-platform.properties | 2 + linux_new/jre/rhel/build.gradle | 173 ++++ .../jre/rhel/src/main/packaging/Dockerfile | 40 + .../jre/rhel/src/main/packaging/build.sh | 73 ++ .../jre/rhel/src/main/packaging/entrypoint.sh | 16 + .../temurin/11/temurin-11-jre.template.j2 | 152 ++++ .../temurin/17/temurin-17-jre.template.j2 | 139 +++ .../temurin/21/temurin-21-jre.template.j2 | 140 +++ .../temurin/23/temurin-23-jre.template.j2 | 140 +++ .../temurin/24/temurin-24-jre.template.j2 | 140 +++ .../temurin/8/temurin-8-jre.template.j2 | 165 ++++ .../java/packaging/DnfOperationsTest.java | 80 ++ .../java/packaging/RedHatFlavoursWithDnf.java | 67 ++ .../java/packaging/RedHatFlavoursWithYum.java | 75 ++ .../packageTest/java/packaging/RpmFiles.java | 60 ++ .../java/packaging/TestContainersUtil.java | 53 ++ .../java/packaging/YumOperationsTest.java | 81 ++ linux_new/jre/suse/build.gradle | 150 ++++ .../jre/suse/src/main/packaging/Dockerfile | 42 + .../jre/suse/src/main/packaging/build.sh | 46 + .../jre/suse/src/main/packaging/entrypoint.sh | 16 + .../temurin/11/temurin-11-jre.template.j2 | 142 +++ .../temurin/17/temurin-17-jre.template.j2 | 129 +++ .../temurin/21/temurin-21-jre.template.j2 | 130 +++ .../temurin/23/temurin-23-jre.template.j2 | 130 +++ .../temurin/24/temurin-24-jre.template.j2 | 130 +++ .../temurin/8/temurin-8-jre.template.j2 | 163 ++++ .../packageTest/java/packaging/RpmFiles.java | 60 ++ .../java/packaging/SuseFlavours.java | 57 ++ .../java/packaging/TestContainersUtil.java | 53 ++ .../java/packaging/ZypperOperationsTest.java | 83 ++ linux_new/settings.gradle | 16 + linux_new/working_v3.groovy | 795 +++++++++++++++++ 259 files changed, 17218 insertions(+) create mode 100644 linux_new/Jenkinsfile create mode 100644 linux_new/LICENSE.txt create mode 100644 linux_new/NOTES.txt create mode 100644 linux_new/README.md create mode 100644 linux_new/azure-pipelines.yml create mode 100644 linux_new/build.gradle create mode 100644 linux_new/ca-certificates/build.gradle create mode 100644 linux_new/ca-certificates/debian/build.gradle create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/Dockerfile create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/build.sh create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/debian/adoptium-cacerts.sh create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/debian/changelog create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/debian/compat create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/debian/control create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/debian/default create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/debian/postinst create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/debian/postrm create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/debian/rules create mode 100644 linux_new/ca-certificates/debian/src/main/packaging/entrypoint.sh create mode 100644 linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/AptOperationsTest.java create mode 100644 linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/ChangesVerificationTest.java create mode 100644 linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebFiles.java create mode 100644 linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebianFlavours.java create mode 100644 linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebianIntegrationTest.java create mode 100644 linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/IOUtil.java create mode 100644 linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/TestContainersUtil.java create mode 100644 linux_new/ca-certificates/debian/src/packageTest/resources/deb-contents.txt create mode 100644 linux_new/ca-certificates/debian/src/packageTest/resources/junit-platform.properties create mode 100644 linux_new/generate_spec.py create mode 100644 linux_new/gradle/wrapper/gradle-wrapper.jar create mode 100644 linux_new/gradle/wrapper/gradle-wrapper.properties create mode 100755 linux_new/gradlew create mode 100644 linux_new/gradlew.bat create mode 100644 linux_new/jdk/alpine/build.gradle create mode 100644 linux_new/jdk/alpine/src/main/packaging/Dockerfile create mode 100644 linux_new/jdk/alpine/src/main/packaging/build.sh create mode 100644 linux_new/jdk/alpine/src/main/packaging/entrypoint.sh create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/11/HelloWorld.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/11/TestCryptoLevel.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/11/TestECDSA.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/11/alpine.jdk11.template.j2 create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/17/HelloWorld.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/17/TestCryptoLevel.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/17/TestECDSA.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/17/alpine.jdk17.template.j2 create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/21/HelloWorld.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/21/TestCryptoLevel.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/21/TestECDSA.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/21/alpine.jdk21.template.j2 create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/23/HelloWorld.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/23/TestCryptoLevel.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/23/TestECDSA.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/23/alpine.jdk23.template.j2 create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/24/HelloWorld.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/24/TestCryptoLevel.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/24/TestECDSA.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/24/alpine.jdk24.template.j2 create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/8/HelloWorld.java create mode 100644 linux_new/jdk/alpine/src/main/packaging/temurin/8/alpine.jdk8.template.j2 create mode 100644 linux_new/jdk/alpine/src/packageTest/java/packaging/AlpineFlavours.java create mode 100644 linux_new/jdk/alpine/src/packageTest/java/packaging/ApkFiles.java create mode 100644 linux_new/jdk/alpine/src/packageTest/java/packaging/ApkOperationsTest.java create mode 100644 linux_new/jdk/alpine/src/packageTest/java/packaging/TestContainersUtil.java create mode 100644 linux_new/jdk/alpine/src/packageTest/resources/junit-platform.properties create mode 100644 linux_new/jdk/build.gradle create mode 100644 linux_new/jdk/debian/build.gradle create mode 100644 linux_new/jdk/debian/src/main/packaging/Dockerfile create mode 100644 linux_new/jdk/debian/src/main/packaging/build.sh create mode 100644 linux_new/jdk/debian/src/main/packaging/entrypoint.sh create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/11/debian/changelog.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/11/debian/compat create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/11/debian/control.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/11/debian/copyright create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/11/debian/jinfo.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/11/debian/postinst.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/11/debian/prerm.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/11/debian/rules.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/17/debian/changelog.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/17/debian/compat create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/17/debian/control.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/17/debian/copyright create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/17/debian/jinfo.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/17/debian/postinst.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/17/debian/prerm.in create mode 100755 linux_new/jdk/debian/src/main/packaging/temurin/17/debian/rules.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/21/debian/changelog.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/21/debian/compat create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/21/debian/control.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/21/debian/copyright create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/21/debian/jinfo.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/21/debian/postinst.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/21/debian/prerm.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/21/debian/rules.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/23/debian/changelog.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/23/debian/compat create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/23/debian/control.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/23/debian/copyright create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/23/debian/jinfo.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/23/debian/postinst.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/23/debian/prerm.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/23/debian/rules.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/24/debian/changelog.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/24/debian/compat create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/24/debian/control.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/24/debian/copyright create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/24/debian/jinfo.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/24/debian/postinst.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/24/debian/prerm.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/24/debian/rules.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/8/debian/changelog.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/8/debian/compat create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/8/debian/control.template.j2 create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/8/debian/copyright create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/8/debian/jinfo.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/8/debian/postinst.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/8/debian/prerm.in create mode 100644 linux_new/jdk/debian/src/main/packaging/temurin/8/debian/rules.template.j2 create mode 100644 linux_new/jdk/debian/src/packageTest/java/packaging/AptOperationsTest.java create mode 100644 linux_new/jdk/debian/src/packageTest/java/packaging/DebFiles.java create mode 100644 linux_new/jdk/debian/src/packageTest/java/packaging/DebianFlavours.java create mode 100644 linux_new/jdk/debian/src/packageTest/java/packaging/TestContainersUtil.java create mode 100644 linux_new/jdk/debian/src/packageTest/resources/dependencies/deb/adoptium-ca-certificates_1.0.0-1_all.deb create mode 100644 linux_new/jdk/debian/src/packageTest/resources/junit-platform.properties create mode 100644 linux_new/jdk/rhel/build.gradle create mode 100644 linux_new/jdk/rhel/src/main/packaging/Dockerfile create mode 100644 linux_new/jdk/rhel/src/main/packaging/build.sh create mode 100644 linux_new/jdk/rhel/src/main/packaging/entrypoint.sh create mode 100644 linux_new/jdk/rhel/src/main/packaging/temurin/11/temurin-11-jdk.template.j2 create mode 100644 linux_new/jdk/rhel/src/main/packaging/temurin/17/temurin-17-jdk.template.j2 create mode 100644 linux_new/jdk/rhel/src/main/packaging/temurin/21/temurin-21-jdk.template.j2 create mode 100644 linux_new/jdk/rhel/src/main/packaging/temurin/23/temurin-23-jdk.template.j2 create mode 100644 linux_new/jdk/rhel/src/main/packaging/temurin/24/temurin-24-jdk.template.j2 create mode 100644 linux_new/jdk/rhel/src/main/packaging/temurin/8/temurin-8-jdk.template.j2 create mode 100644 linux_new/jdk/rhel/src/packageTest/java/packaging/DnfOperationsTest.java create mode 100644 linux_new/jdk/rhel/src/packageTest/java/packaging/RedHatFlavoursWithDnf.java create mode 100644 linux_new/jdk/rhel/src/packageTest/java/packaging/RedHatFlavoursWithYum.java create mode 100644 linux_new/jdk/rhel/src/packageTest/java/packaging/RpmFiles.java create mode 100644 linux_new/jdk/rhel/src/packageTest/java/packaging/TestContainersUtil.java create mode 100644 linux_new/jdk/rhel/src/packageTest/java/packaging/YumOperationsTest.java create mode 100644 linux_new/jdk/suse/build.gradle create mode 100644 linux_new/jdk/suse/src/main/packaging/Dockerfile create mode 100644 linux_new/jdk/suse/src/main/packaging/build.sh create mode 100644 linux_new/jdk/suse/src/main/packaging/entrypoint.sh create mode 100644 linux_new/jdk/suse/src/main/packaging/temurin/11/temurin-11-jdk.template.j2 create mode 100644 linux_new/jdk/suse/src/main/packaging/temurin/17/temurin-17-jdk.template.j2 create mode 100644 linux_new/jdk/suse/src/main/packaging/temurin/21/temurin-21-jdk.template.j2 create mode 100644 linux_new/jdk/suse/src/main/packaging/temurin/23/temurin-23-jdk.template.j2 create mode 100644 linux_new/jdk/suse/src/main/packaging/temurin/24/temurin-24-jdk.template.j2 create mode 100644 linux_new/jdk/suse/src/main/packaging/temurin/8/temurin-8-jdk.template.j2 create mode 100644 linux_new/jdk/suse/src/packageTest/java/packaging/RpmFiles.java create mode 100644 linux_new/jdk/suse/src/packageTest/java/packaging/SuseFlavours.java create mode 100644 linux_new/jdk/suse/src/packageTest/java/packaging/TestContainersUtil.java create mode 100644 linux_new/jdk/suse/src/packageTest/java/packaging/ZypperOperationsTest.java create mode 100644 linux_new/jre/alpine/build.gradle create mode 100644 linux_new/jre/alpine/src/main/packaging/Dockerfile create mode 100644 linux_new/jre/alpine/src/main/packaging/build.sh create mode 100644 linux_new/jre/alpine/src/main/packaging/entrypoint.sh create mode 100644 linux_new/jre/alpine/src/main/packaging/temurin/11/alpine.jre11.template.j2 create mode 100644 linux_new/jre/alpine/src/main/packaging/temurin/17/alpine.jre17.template.j2 create mode 100644 linux_new/jre/alpine/src/main/packaging/temurin/21/alpine.jre21.template.j2 create mode 100644 linux_new/jre/alpine/src/main/packaging/temurin/23/alpine.jre23.template.j2 create mode 100644 linux_new/jre/alpine/src/main/packaging/temurin/24/alpine.jre24.template.j2 create mode 100644 linux_new/jre/alpine/src/main/packaging/temurin/8/alpine.jre8.template.j2 create mode 100644 linux_new/jre/alpine/src/packageTest/java/packaging/AlpineFlavours.java create mode 100644 linux_new/jre/alpine/src/packageTest/java/packaging/ApkFiles.java create mode 100644 linux_new/jre/alpine/src/packageTest/java/packaging/ApkOperationsTest.java create mode 100644 linux_new/jre/alpine/src/packageTest/java/packaging/TestContainersUtil.java create mode 100644 linux_new/jre/alpine/src/packageTest/resources/junit-platform.properties create mode 100644 linux_new/jre/build.gradle create mode 100644 linux_new/jre/debian/build.gradle create mode 100644 linux_new/jre/debian/src/main/packaging/Dockerfile create mode 100644 linux_new/jre/debian/src/main/packaging/build.sh create mode 100644 linux_new/jre/debian/src/main/packaging/entrypoint.sh create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/11/debian/changelog.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/11/debian/compat create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/11/debian/control.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/11/debian/copyright create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/11/debian/jinfo.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/11/debian/postinst.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/11/debian/prerm.in create mode 100755 linux_new/jre/debian/src/main/packaging/temurin/11/debian/rules.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/17/debian/changelog.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/17/debian/compat create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/17/debian/control.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/17/debian/copyright create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/17/debian/jinfo.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/17/debian/postinst.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/17/debian/prerm.in create mode 100755 linux_new/jre/debian/src/main/packaging/temurin/17/debian/rules.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/21/debian/changelog.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/21/debian/compat create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/21/debian/control.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/21/debian/copyright create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/21/debian/jinfo.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/21/debian/postinst.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/21/debian/prerm.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/21/debian/rules.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/23/debian/changelog.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/23/debian/compat create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/23/debian/control.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/23/debian/copyright create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/23/debian/jinfo.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/23/debian/postinst.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/23/debian/prerm.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/23/debian/rules.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/24/debian/changelog.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/24/debian/compat create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/24/debian/control.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/24/debian/copyright create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/24/debian/jinfo.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/24/debian/postinst.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/24/debian/prerm.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/24/debian/rules.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/8/debian/changelog.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/8/debian/compat create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/8/debian/control.template.j2 create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/8/debian/copyright create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/8/debian/jinfo.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/8/debian/postinst.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/8/debian/prerm.in create mode 100644 linux_new/jre/debian/src/main/packaging/temurin/8/debian/rules.template.j2 create mode 100644 linux_new/jre/debian/src/packageTest/java/packaging/AptOperationsTest.java create mode 100644 linux_new/jre/debian/src/packageTest/java/packaging/DebFiles.java create mode 100644 linux_new/jre/debian/src/packageTest/java/packaging/DebianFlavours.java create mode 100644 linux_new/jre/debian/src/packageTest/java/packaging/TestContainersUtil.java create mode 100644 linux_new/jre/debian/src/packageTest/resources/dependencies/deb/adoptium-ca-certificates_1.0.0-1_all.deb create mode 100644 linux_new/jre/debian/src/packageTest/resources/junit-platform.properties create mode 100644 linux_new/jre/rhel/build.gradle create mode 100644 linux_new/jre/rhel/src/main/packaging/Dockerfile create mode 100644 linux_new/jre/rhel/src/main/packaging/build.sh create mode 100644 linux_new/jre/rhel/src/main/packaging/entrypoint.sh create mode 100644 linux_new/jre/rhel/src/main/packaging/temurin/11/temurin-11-jre.template.j2 create mode 100644 linux_new/jre/rhel/src/main/packaging/temurin/17/temurin-17-jre.template.j2 create mode 100644 linux_new/jre/rhel/src/main/packaging/temurin/21/temurin-21-jre.template.j2 create mode 100644 linux_new/jre/rhel/src/main/packaging/temurin/23/temurin-23-jre.template.j2 create mode 100644 linux_new/jre/rhel/src/main/packaging/temurin/24/temurin-24-jre.template.j2 create mode 100644 linux_new/jre/rhel/src/main/packaging/temurin/8/temurin-8-jre.template.j2 create mode 100644 linux_new/jre/rhel/src/packageTest/java/packaging/DnfOperationsTest.java create mode 100644 linux_new/jre/rhel/src/packageTest/java/packaging/RedHatFlavoursWithDnf.java create mode 100644 linux_new/jre/rhel/src/packageTest/java/packaging/RedHatFlavoursWithYum.java create mode 100644 linux_new/jre/rhel/src/packageTest/java/packaging/RpmFiles.java create mode 100644 linux_new/jre/rhel/src/packageTest/java/packaging/TestContainersUtil.java create mode 100644 linux_new/jre/rhel/src/packageTest/java/packaging/YumOperationsTest.java create mode 100644 linux_new/jre/suse/build.gradle create mode 100644 linux_new/jre/suse/src/main/packaging/Dockerfile create mode 100644 linux_new/jre/suse/src/main/packaging/build.sh create mode 100644 linux_new/jre/suse/src/main/packaging/entrypoint.sh create mode 100644 linux_new/jre/suse/src/main/packaging/temurin/11/temurin-11-jre.template.j2 create mode 100644 linux_new/jre/suse/src/main/packaging/temurin/17/temurin-17-jre.template.j2 create mode 100644 linux_new/jre/suse/src/main/packaging/temurin/21/temurin-21-jre.template.j2 create mode 100644 linux_new/jre/suse/src/main/packaging/temurin/23/temurin-23-jre.template.j2 create mode 100644 linux_new/jre/suse/src/main/packaging/temurin/24/temurin-24-jre.template.j2 create mode 100644 linux_new/jre/suse/src/main/packaging/temurin/8/temurin-8-jre.template.j2 create mode 100644 linux_new/jre/suse/src/packageTest/java/packaging/RpmFiles.java create mode 100644 linux_new/jre/suse/src/packageTest/java/packaging/SuseFlavours.java create mode 100644 linux_new/jre/suse/src/packageTest/java/packaging/TestContainersUtil.java create mode 100644 linux_new/jre/suse/src/packageTest/java/packaging/ZypperOperationsTest.java create mode 100644 linux_new/settings.gradle create mode 100644 linux_new/working_v3.groovy diff --git a/linux_new/Jenkinsfile b/linux_new/Jenkinsfile new file mode 100644 index 000000000..dc1c09707 --- /dev/null +++ b/linux_new/Jenkinsfile @@ -0,0 +1,814 @@ +/* Used By Jenkins Job sfr-build-linux-package-modular */ + +/* Constant Declarations */ + +def NODE_LABEL = 'build&&linux&&x64&&dockerBuild&&dynamicAzure' // Default node +def PRODUCT = 'temurin' +def JVM = 'hotspot' +def baseURL = "https://github.com/adoptium/" +def binaryRepo = "${params.VERSION.replace('jdk', 'temurin')}-binaries/releases/tag/${params.TAG}" +def binaryDLRepo = "${params.VERSION.replace('jdk', 'temurin')}-binaries/releases/download/${params.TAG}" +def fullURL = "${baseURL}/${binaryRepo}" +def dlURL = "${baseURL}/${binaryDLRepo}" +def PKGBUILDLABEL="" + +/* Supported Distro Arrays */ +// Remember If Adding An Deb Distro to update the cacerts package // +def deb_distros = [ + "trixie", // Debian/13 + "bookworm", // Debian/12 + "bullseye", // Debian/11 + "buster", // Debian/10 + "oracular", // Ubuntu/24.10 (STS) + "noble", // Ubuntu/24.04 (LTS) + "jammy", // Ubuntu/22.04 (LTS) + "focal", // Ubuntu/20.04 (LTS) + "bionic" // Ubuntu/18.04 (LTS) + ] + +def rhel_distros = [ + 'rpm/centos/7', + 'rpm/rocky/8', + 'rpm/rhel/7', + 'rpm/rhel/8', + 'rpm/rhel/9', + 'rpm/fedora/35', + 'rpm/fedora/36', + 'rpm/fedora/37', + 'rpm/fedora/38', + 'rpm/fedora/39', + 'rpm/fedora/40', + 'rpm/fedora/41', + 'rpm/fedora/42', + 'rpm/fedora/rawhide', + 'rpm/oraclelinux/7', + 'rpm/oraclelinux/8', + 'rpm/amazonlinux/2' + ] + +def suse_distros = [ + 'rpm/opensuse/15.3', + 'rpm/opensuse/15.4', + 'rpm/opensuse/15.5', + 'rpm/sles/12', + 'rpm/sles/15' + ] + +/* End Of Distro Definitions*/ + +// Global Variables +def DLfilenames = [] +def JDKArray = [] +def ModifiedJDKArray = [] +def DISTS_TO_BUILD = [] +def distro = "" +def distro_list = '' +def arch = "" +def ReleaseVersion = "" +def Release = "" +def Version = "" +def Build = "" +def packagearch = "" +def packagearchDeb = "" +def packagearchRhel = "" +def PackageReleaseVersion = "0" +def upstreamversion = "" +def upstreamversionARM32 = "" +/* Have Some Default Node Labels */ +def PKGBUILDLABELAPK = 'build&&linux&&x64&&dockerBuild&&dynamicAzure' +def PKGBUILDLABELDEB = 'build&&linux&&x64&&dockerBuild&&dynamicAzure' +def PKGBUILDLABELRHEL = 'build&&linux&&x64&&dockerBuild&&dynamicAzure' + +// Function Definitions Begin + +// Helper function to download and validate files +def validateAndDownloadArtifact(url, file) { + echo "Downloading: ${url}" + def result = sh(script: "curl -sSL -O ${url}", returnStatus: true) + if (result != 0) { + error("Failed to download ${file}. File not found or an error occurred.") + } + echo "Downloaded: ${file}" +} + +// Helper function to validate checksum +def validateChecksum(file, checksumFile) { + def expectedChecksum = sh(script: "awk '{print \$1}' ${checksumFile}", returnStdout: true).trim() + def calculatedChecksum = sh(script: "sha256sum ${file} | awk '{print \$1}'", returnStdout: true).trim() + if (expectedChecksum != calculatedChecksum) { + error("Checksum mismatch for ${file}. Expected: ${expectedChecksum}, but found: ${calculatedChecksum}.") + } + echo "Checksum validation successful for ${file}." + return calculatedChecksum +} + +// Helper function to extract upstream version from tar file +def extractUpstreamVersionFromTar(file) { + def version = sh(script: "tar xvfz \"${file}\" | head -n 1 | cut -d/ -f1", returnStdout: true).trim() + sh "rm -rf \"${version}\"" + echo "Extracted upstream version: ${version}" + return version +} + +// Helper function to cleanup files +def cleanupFiles(files) { + files.each { file -> + sh "rm -rf ${file}" + } +} + +// Helper function to Set Node Labels +def getPackageBuildLabel(String arch, String distro) { + switch (distro) { + case 'APK': + return (arch == 'x64') ? 'build&&linux&&x64&&dockerBuild&&dynamicAzure' : + (arch == 'aarch64') ? 'docker&&linux&&aarch64&&alpineInstaller' : + 'build&&linux&&x64&&dockerBuild&&dynamicAzure' + + case 'DEB': + return (arch == 'x64') ? 'build&&linux&&x64&&dockerBuild&&dynamicAzure' : + (arch == 'arm') ? 'docker&&linux&&aarch64' : + (arch == 'aarch64') ? 'docker&&linux&&aarch64' : + (arch == 'ppc64le') ? 'build&&docker&&ppc64le' : + (arch == 's390x') ? 'docker&&s390x&&dockerBuild' : + (arch == 'riscv64') ? 'dockerBuild&&linux&&riscv64&&dockerInstaller' : + + 'build&&linux&&x64&&dockerBuild&&dynamicAzure' + + case 'RHEL': + return 'build&&linux&&x64&&dockerBuild&&dynamicAzure' + + default: + error("Unsupported distro: ${distro}") + } +} + +// Helper function to check and upload files +def CheckAndUpload(String Target, String Distro, String BuildArch, String Version, String DistroList, String Value, String PackageDir, String Key, String FileName) { + echo "Entering Check & Upload" + // Received From Alpine CheckAndUpload(Target, UpDistro, buildArch, '', '', '', '', '' , FileName) + // Received From Deb CheckAndUpload(DebTarget, DebDistro, arch, Release, distro_list, '', '', '', DebFileName) + + echo "Debug 1001" + echo "Target = ${Target}" + echo "Distro = ${Distro}" + echo "Arch = ${BuildArch}" + echo "Version = ${Version}" + echo "DList = ${DistroList}" + echo "Value = ${Value}" + echo "PackageDir = ${PackageDir}" + echo "Key = ${Key}" + echo "Filename = ${FileName}" +} + +// Function Definitions End + + +/* Pipeline Declaration */ +pipeline { + agent none // No Default Agent + options { + timeout(time: 2, unit: 'HOURS') + } + + parameters { + string(name: 'TAG', defaultValue: 'jdk-23+37', description: 'Release Tag') + string(name: 'VERSION', defaultValue: 'jdk23', description: 'Release Version') + string(name: 'ARTIFACTS_TO_COPY', defaultValue: '**/alpine-linux/aarch64/temurin/*.tar.gz,**/alpine-linux/aarch64/temurin/*.zip,**/alpine-linux/aarch64/temurin/*.sha256.txt,**/alpine-linux/aarch64/temurin/*.msi,**/alpine-linux/aarch64/temurin/*.pkg,**/alpine-linux/aarch64/temurin/*.json,**/alpine-linux/aarch64/temurin/*.sig', description: 'Artifacts String') + booleanParam(name: 'RELEASE', defaultValue: false, description: 'Release Flag' ) + booleanParam(name: 'DRY_RUN', defaultValue: false, description: 'Release Dry Run') + booleanParam(name: 'ENABLEGPGSIGNING', defaultValue: true, description: 'Require GPG Signing') + booleanParam(name: 'ENABLEDEBUG', defaultValue: false, description: 'Tick to enable --stacktrace for gradle build') + booleanParam(name: 'REPACKAGE', defaultValue: false, description: 'Tick if this is a republish of an existing package, ie xx.xxx.2 , rather than the base release of a package (1)') + string(name: 'PACKAGE_INCREMENT', defaultValue: '1', description: 'This is the incremental number used for re-releases of package versions - Should be set appropriately if RePackage is True') + } +// Stage Definition - Start + stages { +// Print Parameters Stage - Start + stage('Print Parameters') { + agent { label NODE_LABEL } + steps { + script { + echo "Tag : ${params.TAG}" + echo "Version : ${params.VERSION}" + echo "Artifacts : ${params.ARTIFACTS_TO_COPY}" + echo "Release : ${params.RELEASE}" + echo "Dry Run : ${params.DRY_RUN}" + } + } + } +// Print Parameters Stage - End +// Process Parameters Stage - Start + stage('Process Parameters') { + agent { label NODE_LABEL } + // when { + // expression { return params.Release } + // } + steps { + script{ + + // Figure Out Which Dist This Run Is For + + if (params.ARTIFACTS_TO_COPY.contains('alpine-linux')) { + distro = "alpine-linux" + } else if (params.ARTIFACTS_TO_COPY.contains('linux')) { + distro = "linux" + } else { + error("The Artifacts Are For Neither Linux OR Alpine") + } + + // Figure Out Which Arch This Run Is For + if (params.ARTIFACTS_TO_COPY.contains('aarch64')) { + arch = "aarch64" + } else if (params.ARTIFACTS_TO_COPY.contains('x64')) { + arch = "x64" + } else if (params.ARTIFACTS_TO_COPY.contains('s390x')) { + arch = "s390x" + } else if (params.ARTIFACTS_TO_COPY.contains('arm')) { + arch = "arm" + } else if (params.ARTIFACTS_TO_COPY.contains('ppc64le')) { + arch = "ppc64le" + } else if (params.ARTIFACTS_TO_COPY.contains('riscv64')) { + arch = "riscv64" + } else { + error("The Artifacts Are For An Unsupported Architecture") + } + + echo "DEBUG 00 - arch = ${arch}" + + // Derive Node To Build Packages On + + PKGBUILDLABELAPK = getPackageBuildLabel(arch, 'APK') + PKGBUILDLABELDEB = getPackageBuildLabel(arch, 'DEB') + PKGBUILDLABELRHEL = getPackageBuildLabel(arch, 'RHEL') + + // Map Architectures From Source To Dist Suitable Values + + packagearchDeb = (arch == 'x64') ? 'amd64' : + (arch == 'arm') ? 'armhf' : + (arch == 'aarch64') ? 'arm64' : + (arch == 'ppc64le') ? 'ppc64el' : + (arch == 's390x') ? 's390x' : + (arch == 'riscv64') ? 'riscv64' : + 'unknown' + + packagearchRhel = (arch == 'x64') ? 'x86_64' : + (arch == 'arm') ? 'armv7hl' : + (arch == 'aarch64') ? 'aarch64' : + (arch == 'ppc64le') ? 'ppc64le' : + (arch == 's390x') ? 's390x' : + (arch == 'riscv64') ? 'riscv64' : + 'unknown' + + + // Version Number Parsing + + def vername = '' + def verversion = '' + def verbuild = '' + + // Add Special Handling For JDK8 Version Number + // jdk8u432-b06 + + if (params.TAG?.startsWith("jdk8")) { + echo "JDK 8" + def split = (params.TAG =~ /(jdk)(\d+u\d+)-(b\d+)/) + if (split.find()) { + // println("Full Match: ${split[0][0]}") + vername = split[0][1] // "jdk" + verversion = split[0][2] // "8u432" + verbuild = split[0][3] // "06" + } else { + error("The version string format does not match the expected pattern.") + } + } else { + echo "Not JDK8" + // Parse The Version Tag, Into Usable Components + + def split = (params.TAG =~ /(jdk)-(\d[\d.]*)([+_]\d+)?/) + + if (split.find()) { + vername = split.group(1) + verversion = split.group(2) + verbuild = split.group(3)?.replaceAll("[+_]", "") + } else { + error("The version string format does not match the expected pattern.") + } + + } + + // Construct the Filename + def filennameFinal ="" + def filenamePrefix = "Open" + def filenameSuffix = "tar.gz" + def filenameVersion = params.VERSION.toUpperCase() + "U" + def packageTypes = ['jdk', 'jre'] + + packageTypes.each { packageType -> + if (params.TAG?.startsWith("jdk8")) { + filenameFinal = "${filenamePrefix}${filenameVersion}-${packageType}_${arch}_${distro}_${JVM}_${verversion}${verbuild ?: 'N/A'}" + ReleaseVersion = "${verversion}${verbuild ?: 'N/A'}" + } else { + filenameFinal = "${filenamePrefix}${filenameVersion}-${packageType}_${arch}_${distro}_${JVM}_${verversion}_${verbuild ?: 'N/A'}" + ReleaseVersion = "${verversion}_${verbuild ?: 'N/A'}" + } + + def JDKFinal = "${filenameFinal}.${filenameSuffix}" + def SHAFinal = "${JDKFinal}.sha256.txt" + + echo "JDK File Name : ${JDKFinal}" + echo "SHA File Name : ${SHAFinal}" + DLfilenames << JDKFinal + DLfilenames << SHAFinal + + JDKArray << [ "${packageType}" , "${JDKFinal}", "${SHAFinal}" , "${distro}" , "${arch}" , "${ReleaseVersion}" ] + } + + // Set Package Release Version If Repackage + if (params.REPACKAGE) { + PackageReleaseVersion = params.PACKAGE_INCREMENT + } + } + } + } +// Process Parameters Stage - End +// Validate Artifacts Stage - Start +stage('Validate Artifacts') { + agent { label NODE_LABEL } + // when { + // expression { return params.RELEASE } + // } + steps { + script { + echo "Validating Artifacts" + echo "Tuples:" + echo "${JDKArray}" + + JDKArray.each { ArrayElement -> + def (PTYPE, PFILE, PSIGN, PDIST, PARCH, PVERS) = ArrayElement + def Binurl = "${dlURL}/${PFILE}" + def SHAurl = "${dlURL}/${PSIGN}" + + // Download binary and checksum + validateAndDownloadArtifact(Binurl, PFILE) + validateAndDownloadArtifact(SHAurl, PSIGN) + + // Validate checksum + def calculatedChecksum = validateChecksum(PFILE, PSIGN) + + if (PARCH == "arm") { + upstreamversionARM32 = extractUpstreamVersionFromTar(PFILE) + } + + // Cleanup temporary files + cleanupFiles([PFILE, PSIGN]) + + // Update array with the validated information + ModifiedJDKArray << [PTYPE, PFILE, PSIGN, PDIST, PARCH, PVERS, calculatedChecksum, Binurl] + } + + JDKArray = ModifiedJDKArray + } + } +} +// Generate Spec File Stage - Start + stage('Generate Spec File') { + agent { label NODE_LABEL } + // when { + // expression { return params.RELEASE } + // } + steps { + script { + echo "Validating Required Parameters For Generate Spec File Program" + echo "Debug 02" + JDKArray.each { ArrayElement -> + echo "${ArrayElement}" + // Assign Tuple Values To Vars + def PTYPE = ArrayElement[0] + def PFILE = ArrayElement[1] + def PSIGN = ArrayElement[2] + def PDIST = ArrayElement[3] + def PARCH = ArrayElement[4] + def PVERS = ArrayElement[5] + def PCSUM = ArrayElement[6] + def PKURL = ArrayElement[7] + + + // Generate Date For Use In Various Places + def getDate = new Date(currentBuild.startTimeInMillis) + // Format The Date + def currentDate = getDate.format("EEE, dd MMM yyyy HH:mm:ss Z", TimeZone.getTimeZone('UTC')) + def currentDateRHEL = getDate.format("EEE MMM d yyyy", TimeZone.getTimeZone('UTC')) + echo "Current Date: ${currentDate}" + echo "Current Date RHEL: ${currentDateRHEL}" + + // Setup List Of Packages To Build + if (PDIST == 'alpine-linux') { + DISTS_TO_BUILD = ['alpine'] + } else if (PDIST == 'linux') { + DISTS_TO_BUILD = ['rhel', 'suse', 'debian'] + } else { + error("Unsupported dist: ${PDIST}") + } + DISTS_TO_BUILD.each { DistArrayElement -> + + echo "Debug 03" + if (params.TAG?.startsWith("jdk8")) { + echo "Debug 04" + echo "PVERS : ${PVERS}" + + def versionPattern = /(\d+)(u\d+)(b\d+)/ + def versparser = (PVERS =~ versionPattern) + println("Full Match: ${versparser[0][0]}") + if (versparser.matches()) { + println("Full Match: ${versparser[0][0]}") + Release = versparser[0][1] + Version = versparser[0][2] + Build = versparser[0][3] + } else { + error("The version string format does not match the expected pattern.") + } + } else { + def versionPattern = /^(\d+)(?:\.(.*))?_(.+)$/ + def versparser = (PVERS =~ versionPattern) + if (versparser.matches()) { + Release = versparser[0][1].toInteger() + Version = versparser[0][2] ? versparser[0][2] : "null" + Build = versparser[0][3] + } else { + error("Version string format is invalid: ${PVERS}") + } + } + + def TemplateType = ArrayElement[0] + def packagever + packagearch = PARCH + def templatebase + def outputfile + def changelogversion + + + + // Reformat Any Variables For Distribution Specific Oddities + + if (DistArrayElement == 'alpine') { + + echo "Debug 04" + echo "Release = ${Release}" + echo "Build = ${Build}" + + if (Version == "null") { + packagever = "${Release}_p${Build}" + } else { + packagever = "${Release}.${Version}_p${Build}" + } + + // Upstream Version Is Not Required For Alpine + upstreamversion = "" + + if (Release == "8" ) { + // Regular expression to split around 'u' and 'b' + def versionPattern = /(\d+)(u)(\d+)(b)(\d+)/ + def versparser = (PVERS =~ versionPattern) + if (versparser.matches()) { + Release = versparser[0][1] // Capture before 'u', e.g., "8" + Version = versparser[0][3] // Capture between 'u' and 'b', e.g., "432" + Build = versparser[0][5] // Capture after 'b', e.g., "06" + } else { + error("The version string format does not match the expected pattern.") + } + packagever = "${Release}.${Version}.${Build}" + } + // Reformat x64 For Alpine + if (PARCH == 'x64') { + packagearch = "x86_64" + } + outputfile = "APKBUILD" + + // echo "Debug 05 Python Parameters For Alpine" + // echo "Python 1 : Template Path = : ${templatebase}" + // echo "Python 2 : Package Version = : ${packagever}" + // echo "Python 3 : Package Arch = : ${packagearch}" + // echo "Python 4 : Package URL = : ${PKURL}" + // echo "Python 5 : Package Checksum = : ${PCSUM}" + // echo "Python 6 : Package Name = : ${PFILE}" + // echo "Python 7 : Output File Name = : ${outputfile}" + // echo "Python 8 : Current Date = : ${currentDate}" + // echo "Python 9 : Package Release Version = : ${PackageReleaseVersion}" + // echo "Python 10: JDK Upstream Version = : ${upstreamversion}" + // echo "Python 11 : Changelog Version = :${packagever}" + // echo "Python 12: ARM32 Version = ${upstreamversion}" + + // Figure Out Template name + templatebase = "./linux_new/${PTYPE}/${DistArrayElement}/src/main/packaging/${PRODUCT}/${Release}/${DistArrayElement}.${PTYPE}${Release}.template.j2" + + // Check If Template Exists + if (!fileExists(templatebase)) { + error("Template File Not Found At : ${templatebase}") + } + + def speccmd = "python3 linux_new/generate_spec.py \"${templatebase}\" \"${packagever}\" \"${packagearch}\" \"${PKURL}\" \"${PCSUM}\" \"${PFILE}\" \"${outputfile}\" \"${currentDate}\" \"${PackageReleaseVersion}\" \"${upstreamversion}\" \"${packagever}\" \"${upstreamversion}\"" + echo "Spec Command : ${speccmd}" + def genresult = sh(script: speccmd, returnStatus: true) + echo "Result : ${genresult}" + } + + if (DistArrayElement == 'debian') { + + echo "Processing Debian Files" + + // Debian Requires 3 Files To Be Generated + def debianFiles = ['changelog', 'control', 'rules'] + + if (Release == "8" ) { + echo "Debian JDK8" + // Extract components from original format + def major = PVERS[0] // Extract major version '8' + def versparser = (PVERS =~ /(\d+)u(\d+)b(\d+)/) + def minor = versparser[0][2] // Extract '432' + def build = versparser[0][3].replaceAll(/^0+/, '') // Extract '6' + // Construct the new format + packagever = "${major}.0.${minor}.0.0+${build}" + } else { + echo "Debian Not JDK8" + if (Version == "null") { + packagever = "${Release}.0.0.0.0+${Build}" + } else { + packagever = "${Release}.${Version}.0+${Build}" + } + echo "Debian PackageVer = ${packagever}" + } + + echo "Debug 07" + echo "PVERS : ${PVERS}" + echo "Release = ${Release}" + echo "Version = ${Version}" + echo "Build = ${Build}" + echo "PackageVer = ${packagever}" + echo "PackageArch = ${packagearch}" + + debianFiles.each { debianFilesArrayElement -> + + echo "Processing Debian ${debianFilesArrayElement} File" + outputfile = debianFilesArrayElement + + // Figure Out Template name + templatebase = "./linux_new/${PTYPE}/${DistArrayElement}/src/main/packaging/${PRODUCT}/${Release}/${DistArrayElement}/${debianFilesArrayElement}.template.j2" + + // Check If Template Exists + if (!fileExists(templatebase)) { + error("Template File Not Found At : ${templatebase}") + } + + def speccmd = "python3 linux_new/generate_spec.py \"${templatebase}\" \"${packagever}\" \"${packagearchDeb}\" \"${PKURL}\" \"${PCSUM}\" \"${PFILE}\" \"${outputfile}\" \"${currentDate}\" \"${PackageReleaseVersion}\" \"${upstreamversion}\" \"${packagever}\" \"${upstreamversion}\"" + echo "Spec Command : ${speccmd}" + def genresult = sh(script: speccmd, returnStatus: true) + echo "Result : ${genresult}" + + } + + } + + if (DistArrayElement == "rhel" || DistArrayElement == "suse") { + echo "Debug 09 - Rhel & Suse" + echo "PVERS : ${PVERS}" + echo "Release = ${Release}" + echo "Version = ${Version}" + echo "Build = ${Build}" + echo "PackageVer = ${packagever}" + echo "PackageArch = ${packagearch}" + + if (Release == "8" ) { + echo "RHEL/SUSE JDK8" + upstreamversion = params.TAG.replaceFirst("^jdk", "") + // Extract components from original format + def major = PVERS[0] // Extract major version '8' + def versparser = (PVERS =~ /(\d+)u(\d+)b(\d+)/) + def minor = versparser[0][2] // Extract '432' + def build = versparser[0][3].replaceAll(/^0+/, '') // Extract '6' + def formattedBuild = build.toString()padLeft(2, '0') + // Construct the new format + packagever = "${major}.0.${minor}.0.0.${build}" + changelogversion = "${major}.0.${minor}-b${formattedBuild}" + } else { + echo "RHEL/SUSE Not JDK8" + echo "Deubg 09A - ${PVERS}" + upstreamversion = params.TAG.replaceFirst("^jdk-", "") + + if (Version == "null") { + packagever = "${Release}.0.0.0.0.${Build}" + changelogversion = "${Release}.0.${Version}+${Build}" + } else { + packagever = "${Release}.${Version}.0.${Build}" + changelogversion = "${Release}.0.${Version}+${Build}" + } + } + + if (PARCH == 'arm') { + // If JDK8 ARM32, Then Need To Deduce Correct Upstream + echo "DEBUG00A - Get ARM32 Upstream Version #" + echo "PARCH = ${PARCH}" + upstreamversionARM32 = upstreamversionARM32.replaceFirst("^jdk", "") + upstreamversionARM32 = upstreamversionARM32.replaceAll(/-(jre|jdk)$/, "") + echo "Upstream ARM32 : ${upstreamversionARM32}" + echo "upstreamVersion : ${upstreamversion}" + // DONE + } + + // Figure Out Template name + templatebase = "./linux_new/${PTYPE}/${DistArrayElement}/src/main/packaging/${PRODUCT}/${Release}/${PRODUCT}-${Release}-${PTYPE}.template.j2" + // Output File Name Only ( defaults to outputting in same location as template ) + outputfile = "${PRODUCT}-${Release}-${PTYPE}.spec" + + // Check If Template Exists + if (!fileExists(templatebase)) { + error("Template File Not Found At : ${templatebase}") + } + + def speccmd = "python3 linux_new/generate_spec.py \"${templatebase}\" \"${packagever}\" \"${packagearchRhel}\" \"${PKURL}\" \"${PCSUM}\" \"${PFILE}\" \"${outputfile}\" \"${currentDateRHEL}\" \"${PackageReleaseVersion}\" \"${upstreamversion}\" \"${changelogversion}\" \"${upstreamversionARM32}\"" + echo "Spec Command : ${speccmd}" + def genresult = sh(script: speccmd, returnStatus: true) + echo "Result : ${genresult}" + + // End Of RHEL SUSE CODE + } + + } + + } + + // Tar And Publish The Generated Build Files + // May Need Rework + sh "tar -czf ./package_build_files.tar.gz ./linux_new/*" + sh "pwd" + sh "ls -ltr" + // Publish the tarball + archiveArtifacts artifacts: "package_build_files.tar.gz", allowEmptyArchive: false + // Stash The Generated Build Files + dir('linux_new') { + stash name: 'installercode', includes: '**' + + + } + } + } + } +// Generate Spec File Stage - End +// Build And Archive Packages Stage - Start +stage('Build & Archive Package') { + // when { + // expression { return params.RELEASE } + // } + steps { + script { + DISTS_TO_BUILD.each { DistArrayElement -> + def nodeLabel = '' + if (DistArrayElement == 'alpine') { + nodeLabel = PKGBUILDLABELAPK + } else if (DistArrayElement == 'debian') { + nodeLabel = PKGBUILDLABELDEB + } else if (DistArrayElement in ['rhel', 'suse']) { + nodeLabel = PKGBUILDLABELRHEL + } else { + error "Unknown DistArrayElement: ${DistArrayElement}" + } + + node(label: nodeLabel) { // Assign node dynamically based on distribution type + echo "Build Packages For Arch: ${arch}" + echo "Build Packages For PARCH: ${packagearch}" + echo "Building For Dist: ${DistArrayElement}" + echo "Build Product: ${PRODUCT}" + echo "Build Version : ${Release}" + + // Docker --mount option requires BuildKit + env.DOCKER_BUILDKIT = 1 + env.COMPOSE_DOCKER_CLI_BUILD = 1 + + // Prepare Workspace + cleanWs() + unstash 'installercode' + + try { + def PackagesToBuild = ['jdk', 'jre'] + def buildCli + PackagesToBuild.each { PackageArrayElement -> + echo "Building Package: ${PackageArrayElement} for ${DistArrayElement}" + def gBuildTask = (packagearch in ['x86_64', 'amd64']) ? + "package${PackageArrayElement}${DistArrayElement} check${PackageArrayElement}${DistArrayElement}" : + "package${PackageArrayElement}${DistArrayElement}" + + // Override Package Arch To Be Dist Specific + + if (DistArrayElement == "rhel" || DistArrayElement == "suse") { + echo "Using build CLI for RHEL/SUSE: ${buildCli}" + buildCli = "./gradlew ${gBuildTask} --parallel -PPRODUCT=${PRODUCT} -PPRODUCT_VERSION=${Release} -PARCH=${packagearchRhel}" + } else if (DistArrayElement == "debian") { + echo "Using build CLI for Debian: ${buildCli}" + buildCli = "./gradlew ${gBuildTask} --parallel -PPRODUCT=${PRODUCT} -PPRODUCT_VERSION=${Release} -PARCH=${packagearchDeb}" + } else { + echo "Using default build CLI: ${buildCli}" + buildCli = "./gradlew ${gBuildTask} --parallel -PPRODUCT=${PRODUCT} -PPRODUCT_VERSION=${Release} -PARCH=${packagearch}" + } + + if (params.ENABLEGPGSIGNING) { + def privateKey = 'adoptium-artifactory-rsa-key' + withCredentials([file(credentialsId: privateKey, variable: 'GPG_KEY')]) { + buildCli += " -PGPG_KEY_PATH=${GPG_KEY}" + } + } + + buildCli = params.ENABLEDEBUG.toBoolean() ? buildCli + ' --stacktrace' : buildCli + echo "Build CLI : ${buildCli}" + sh("$buildCli") + } + } catch (Exception ex) { + echo "Exception in build for ${DistArrayElement}: ${ex}" + currentBuild.result = 'FAILURE' + } finally { + archiveArtifacts artifacts: '**/build/ospackage/*,**/build/reports/**,**/packageTest/dependencies/deb/*', + onlyIfSuccessful: false, allowEmptyArchive: false + } + } + } + } + } +} +// Build And Archive Packages Stage - End +// Publish Packages Stage - Start + stage('Publish Packages') { + agent { label NODE_LABEL } + tools { + jfrog 'jfrog-cli' + } + when { + expression { return params.DRY_RUN == false } + } + steps { + script { + echo "This Isnt A Dry Run So Publish Packages" + echo "Publishing Packages For : ${distro}" + echo "Arch : ${arch}" + echo "Publishing For Version : ${Release}" + echo "" + echo "Retrieving Files" + echo "" + copyArtifacts projectName: "${env.JOB_NAME}", + selector: specific("${env.BUILD_NUMBER}"), + filter: '**/build/ospackage/*,**/build/reports/**,**/packageTest/dependencies/deb/*' + + // Verify files are retrieved + // sh 'find .' + echo "Done Retrieving Files" + + // Distro Specific Uploads + if (distro == 'alpine-linux') { + echo "ALPINE UPLOAD" + def AlpDistro = "Alpine" + def PackFiles = findFiles(glob: '**/build/ospackage/temurin-*j*.apk') // List All Packages To Upload + def SrcFiles = findFiles(glob: '**/build/ospackage/temurin-*src*.apk') // List All Sources To Upload + def AllFiles = PackFiles + SrcFiles + for (PackFile in AllFiles) { + def AlpFileName = PackFile.name + def Target = "https://adoptium.jfrog.io/artifactory/apk/alpine/main/${arch}/${AlpFileName}" + echo "Debug 1000 - Alpine Upload Debugging" + echo "Target = ${Target}" + echo "Distro = ${AlpDistro}" + echo "buildArch = ${arch}" + echo "FileName = ${AlpFileName}" + CheckAndUpload(Target, AlpDistro, arch, '', '', '', '', '' , AlpFileName) + } + } + if (distro == 'linux') { + echo "Linux Upload" + echo "Preparing For Debian Upload" + def DebFileName = '' + def DebTarget = '' + // Creates list like deb.distribution=stretch;deb.distribution=buster; + deb_distros.each { deb_version -> + distro_list += "deb.distribution=${deb_version};" + } + def DebDistro = "Debian" + def PackFilesDeb = findFiles(glob: "**/build/ospackage/temurin-*.deb") // List All Packages To Upload + for (DebPackFile in PackFilesDeb) { + DebFileName = DebPackFile.name + DebTarget = "https://adoptium.jfrog.io/artifactory/deb/pool/main/t/temurin-${Release}/${DebFileName}" + + echo "Debug 1000 - Debian Upload Debugging" + echo "Target = ${DebTarget}" + echo "Distro = ${DebDistro}" + echo "buildArch = ${arch}" + echo "Release = ${Release}" + echo "FileName = ${DebFileName}" + echo "DistroList = ${distro_list}" + CheckAndUpload(DebTarget, DebDistro, arch, '', distro_list, '', '', '' , DebFileName) + } + } + } + // End OF Script + } + // Publish Packages Stage - End + } +// Stage Definition - End + } +} +// Pipeline Definition - End diff --git a/linux_new/LICENSE.txt b/linux_new/LICENSE.txt new file mode 100644 index 000000000..ff7737963 --- /dev/null +++ b/linux_new/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/linux_new/NOTES.txt b/linux_new/NOTES.txt new file mode 100644 index 000000000..7e3332adc --- /dev/null +++ b/linux_new/NOTES.txt @@ -0,0 +1,160 @@ +x64 +=== + +Job adoptium-ca-certificates/Debian: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean :ca-certificates:package --parallel + +Job Temurin JDK 11/Debian: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkDebian checkJdkDebian --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=11 + +Job Temurin JDK 11/RedHat: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=11 + +Job Temurin JDK 11/SUSE: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkSuse checkJdkSuse --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=11 + +Job Dragonwell JDK 11/Debian: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkDebian checkJdkDebian --parallel -PPRODUCT=dragonwell -PPRODUCT_VERSION=11 + +Job Dragonwell JDK 11/RedHat: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT=dragonwell -PPRODUCT_VERSION=11 + +Job Dragonwell JDK 11/SUSE: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkSuse checkJdkSuse --parallel -PPRODUCT=dragonwell -PPRODUCT_VERSION=11 + +Job Temurin JDK 16/Debian: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkDebian checkJdkDebian --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=16 + +Job Temurin JDK 16/RedHat: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=16 + +Job Temurin JDK 16/SUSE: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkSuse checkJdkSuse --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=16 + +Job Temurin JDK 17/Debian: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkDebian checkJdkDebian --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=17 + +Job Temurin JDK 17/RedHat: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=17 + +Job Temurin JDK 17/SUSE: + +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkSuse checkJdkSuse --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=17 + +aarch64 +======= + +Job Temurin JDK 11/Debian: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkDebian checkJdkDebian --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=11 + +Job Temurin JDK 11/RedHat: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=11 + +Job Temurin JDK 11/SUSE: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkSuse checkJdkSuse --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=11 + +Job Dragonwell JDK 11/Debian: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkDebian checkJdkDebian --parallel -PPRODUCT=dragonwell -PPRODUCT_VERSION=11 + +Job Dragonwell JDK 11/RedHat: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT=dragonwell -PPRODUCT_VERSION=11 + +Job Dragonwell JDK 11/SUSE: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkSuse checkJdkSuse --parallel -PPRODUCT=dragonwell -PPRODUCT_VERSION=11 + +Job Temurin JDK 16/Debian: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkDebian checkJdkDebian --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=16 + +Job Temurin JDK 16/RedHat: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=16 + +Job Temurin JDK 16/SUSE: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkSuse checkJdkSuse --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=16 + +Job Temurin JDK 17/Debian: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkDebian checkJdkDebian --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=17 + +Job Temurin JDK 17/RedHat: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=17 + +Job Temurin JDK 17/SUSE: + +export _JAVA_OPTIONS="-Xmx4g" +export TESTCONTAINERS_RYUK_DISABLED=true +export TESTCONTAINERS_CHECKS_DISABLE=true +./gradlew clean packageJdkSuse checkJdkSuse --parallel -PPRODUCT=temurin -PPRODUCT_VERSION=17 + +Notes: + +* For regular testing `./gradlew clean package checkPackage -PPRODUCT=temurin -PPRODUCT_VERSION=11` and `./gradlew clean package checkPackage -PPRODUCT=temurin -PPRODUCT_VERSION=16` do all we need. Each command can replace 3 of the jobs listed above. +* Collect */*/build/ospackage/* (that's we have to upload somewhere later), and ideally */*/build/reports/** (test reports to investigate if something goes wrong). +* Expect dozens of additional jobs (additional platforms like arm32, s390x), JREs (not all versions), additional JDKs like Dragonwell (not all versions or platforms), more products (JMC, jtreg, ...). diff --git a/linux_new/README.md b/linux_new/README.md new file mode 100644 index 000000000..1797e31ff --- /dev/null +++ b/linux_new/README.md @@ -0,0 +1,245 @@ +# Linux Packages of Eclipse Adoptium + +We package for Debian, Red Hat, SUSE (e.g. DEB and RPM based) Linux distributions. + +The current implementation to build the packages involves using Gradle to call a small Java program. +That Java program spins up a Docker container, installing the base O/S and its packaging tools, +and then looping over configuration to create the various packages and signing them as appropriate +with the (Eclipse Foundation as a default) signing service. + +TODO You can then optionally upload those packages to a package repository of your choice. +The default Adoptium package repository is https://packages.adoptium.net/ui/packages. The packages are built and uploaded by Jenkins pipeline job defined by [Jenkinsfile](https://github.com/adoptium/installer/blob/master/linux/Jenkinsfile) + +## Prerequisites + +To run this locally + +* You will need to have Docker 20.10+ installed and running. +* You will need to have Java 8+ installed. +* You will need to have a minimum of 8GB of RAM on your system (the build required 4GB). + +## Building the Packages + +Builds take at least ~5-15 minutes to complete on a modern machine. Please ensure that you have Docker installed and running. + +You'll want to make sure you've set the exact versions of the binaries you want package in the: + +* **Alpine Based** - _{jdk,jre}/alpine/src/main/packaging/\\/\\/AKKBUILD_ files. +* **Debian Based** - _{jdk,jre,ca-certificates}/debian/src/main/packaging/\\/\\/debian/rules_ files. +* **Red Hat Based** - _{jdk,jre}/redhat/src/main/packaging/\/\/\/\-\-jdk.spec_ files. +* **SUSE Based** - _{jdk,jre}/suse/src/main/packaging/\/\/\/\-\-jdk.spec_ files. + +In all the examples below you'll need to replace the following variables: + +* Replace `` with `8|11|17|19` +* Replace `` with `temurin|dragonwell` +* Replace `` with `Alpine|Debian|RedHat|Suse` +* Replace `` with `Jdk|Jre` (or `CaCertificates` for the `Debian` platform) + +**Notes:** +* Not all combinations are possible, i.e., for some vendors we might only provide certain versions, or types. +* For `Debian` we provide a separate package with _Certification Authority_ certificates. + +### Build all packages for a version + +```shell +export DOCKER_BUILDKIT=1 +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean package checkPackage -PPRODUCT= -PPRODUCT_VERSION= +``` + +The scripts roughly work as follows: + +* **Gradle Kickoff** - The various `package` tasks in subdirectories under the _jdk_ (or _jre_) directory all have a dependency on the `packageJDK` (`packageJRE`) task, +which in turn has a dependency on the `package` task (this is how Gradle knows to trigger each of those in turn). +* **package<platform> Tasks** - These tasks are responsible for building the various packages for the given platform. They fire up the Docker container +(A _Dockerfile_ is included in each subdirectory), mount some file locations (so you can get to the output) and then run packaging commands in that container. +* **check<platform> Tasks** - Test containers are used to install the package and run the tests in +_src/packageTest/java/packaging_ on them. + +- [task package](build.gradle) --> [task package\](/build.gradle) --> [task package\\](/\/build.gradle ) +- [task checkPackage](build.gradle) --> [task check\Package](/build.gradle) --> [task check\\](/\/build.gradle ) + +### Build a Debian specific package for a version + +- replace `` with `8|11|17|19` +- replace `` with `temurin|dragonwell` +- Replace `` with `Jdk|Jre` + +```shell +export DOCKER_BUILDKIT=1 +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageDebian checkDebian --parallel -PPRODUCT= -PPRODUCT_VERSION= +``` + +### Build a Red Hat specific package for a version + +- replace `` with `8|11|17|19` +- replace `` with `temurin|dragonwell` + +```shell +export DOCKER_BUILDKIT=1 +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT= -PPRODUCT_VERSION= +``` + +### Build a SUSE specific package for a version + +- replace `` with `8|11|17|19` +- replace `` with `temurin|dragonwell` + +```shell +export DOCKER_BUILDKIT=1 +export _JAVA_OPTIONS="-Xmx4g" +./gradlew clean packageJdkSuse checkJdkSuse --parallel -PPRODUCT= -PPRODUCT_VERSION= +``` + +## GPG Signing RPMs/APKs + +In order to GPG sign the generated RPMs/APKs you must add the following argument to the gradlew command: +- replace `` with `Alpine|RedHat|Suse` +- replace `` with `8|11|17|19` +- replace `` with `temurin|dragonwell` + +```shell +./gradlew packageJdk --parallel -PPRODUCT= -PPRODUCT_VERSION= -PGPG_KEY= +``` + +## Building from local files + +In order to build a jdk/jre package for RPM or DEB from local `tar.gz` file(s), put both the `tar.gz` and the `sha256.txt` files in an empty input directory. If the vendor supports building locally, then one can specify this directory when running `./gradlew clean` using the `-PINPUT_DIR` flag + +Example: +```shell +./gradlew clean packageJdkRedHat checkJdkRedHat --parallel -PPRODUCT= -PPRODUCT_VERSION= -PARCH= -PINPUT_DIR= +``` + +**NOTE if building an RPM**: +Make sure to update global variables `upstream_version` and `spec_version` in the corresponding spec-file to match the version number of the jdk/jre RPM that you are building. (This is how RPM determines the version number of the resulting package) + +**Note if building an DEB**: +Make sure to update the `changelog` file in the corresponding vendor's debian folder so the most recent entry is about the version number of the jdk/jre DEB that you are building. (This is how DEB determines the version number of the resulting package) + +## Building SRPMs and RPMs Directly + +If you do not require testing or advanced build support, it is perfectly fine to eschew the Gradle-based build and to +directly build SRPMs and RPMs using the spec files in the repository. + +In this example, we are using the existing spec files for the Temurin 11 JDK to create an SRPM and then rebuild that +SRPM into a binary RPM. It supports building it for the current target architecture or for a different one than the host +system by specifying `vers_arch`. + +Prerequisites: `rpm-build` and `rpmdevtools` packages are installed. For example: + +``` +$ rpm -q rpmdevtools rpm-build +rpmdevtools-9.3-3.fc33.noarch +rpm-build-4.16.1.3-1.fc33.x86_64 +``` + +### Produce a Source/Binary RPM for x86_64 + +Consider this RPM build where x86_64 is the build hosts' architecture. +Download the release blobs and associated sources. +Suppose build rpm for jdk11 for target architecture `x86_64` + +```shell +cd linux/jdk/redhat/src/main/packaging/temurin/11 +mkdir temurin_x86_64 +pushd temurin_x86_64 +spec=$(pwd)/temurin-11-jdk.spec +spectool --gf ${spec} +sha256sum -c *.sha256.txt +``` + +Create a SRPM: + +```shell +rpmbuild --define "_sourcedir $(pwd)" --define "_specdir $(pwd)" \ + --define "_builddir $(pwd)" --define "_srcrpmdir $(pwd)" \ + --define "_rpmdir $(pwd)" --nodeps -bs ${spec} +``` + +Build the binary from the SRPM: + +```shell +rpmbuild --define "_sourcedir $(pwd)" --define "_specdir $(pwd)" \ + --define "_builddir $(pwd)" --define "_srcrpmdir $(pwd)" \ + --define "_rpmdir $(pwd)" --rebuild *.src.rpm +``` + +### Building for a different architecture + +In order to produce RPMs on an x86_64 build host for the s390x target architecture, use the `--target` switch to `rpm-build` to build for a different +architecture. Suppose the host architecture is `x86_64` and we want to build for target architecture `s390x`: + +```shell +rpmbuild --define "_sourcedir $(pwd)" --define "_specdir $(pwd)" \ + --define "_builddir $(pwd)" --define "_srcrpmdir $(pwd)" \ + --define "_rpmdir $(pwd)" --target s390x --rebuild *.src.rpm +``` + +## Supported packages + +### APK (Alpine) +- Supported JDK version 8,11,17,19 +- Supported JRE version 8,11,17,19 + +Supported platform amd64 + +| Distro | Test enabled platforms | Note | +|--------------|:----------------------:|:----:| +| alpine/3.x.x | x86_64 | | + +### DEB +- Supported JDK version 8,11,17,19 +- Supported JRE version 8,11,17,19 + +Supported platform amd64, arm64, armhf, ppc64le, s390x (s390x is only available for jdk > 8) + +| Distro | Test enabled platforms | Note | +|------------------------------|:----------------------:|:----:| +| debian/13 (trixie/testing) | x86_64 | | +| debian/12 (bookworm/testing) | x86_64 | | +| debian/11 (bullseye/stable) | x86_64 | | +| debian/10 (buster/oldstable) | x86_64 | | +| ubuntu/24.10 (oracular) | x86_64 | | +| ubuntu/24.04 (noble) | x86_64 | | +| ubuntu/22.04 (jammy) | x86_64 | | +| ubuntu/20.04 (focal) | x86_64 | | +| ubuntu/18.04 (bionic) | x86_64 | | + +- Debian Releases: https://www.debian.org/releases/index.en.html +- Ubuntu Releases: https://ubuntu.com/about/release-cycle + +### RPM (RedHat and Suse) +- Supported JDK version 8,11,17,19 +- Supported JRE version 8,11,17,19 + +Supported platform x86_64, aarch64, armv7hl, ppc64le, s390x (s390x is only available for jdk > 8) +SRPM also available. + +| Distro | Test enabled platforms | Note | +|---------------|:----------------------:|:-------------------------------------------:| +| amazonlinux/2 | x86_64 | | +| centos/7 | x86_64 | | +| rpm/fedora/35 | x86_64 | | +| rpm/fedora/36 | x86_64 | | +| rpm/fedora/37 | x86_64 | | +| rpm/fedora/38 | x86_64 | | +| rpm/fedora/39 | x86_64 | | +| oraclelinux/7 | x86_64 | | +| oraclelinux/8 | x86_64 | | +| opensuse/15.3 | x86_64 | | +| opensuse/15.4 | x86_64 | | +| opensuse/15.5 | x86_64 | | +| rocky/8 | x86_64 | | +| rpm/rhel/7 | x86_64 | | +| rpm/rhel/8 | x86_64 | | +| rpm/rhel/9 | x86_64 | | +| sles/12 | Null | Need subscription to even run zypper update | +| sles/15 | x86_64 | | + +## Install the packages + +See [Eclipse Temurin Linux (RPM/DEB) installer packages](https://adoptium.net/installation/linux/) diff --git a/linux_new/azure-pipelines.yml b/linux_new/azure-pipelines.yml new file mode 100644 index 000000000..0926f1349 --- /dev/null +++ b/linux_new/azure-pipelines.yml @@ -0,0 +1,71 @@ +trigger: + branches: + include: + - "*" + tags: + include: + - "v*" # Only consider tags like v1.0.0. + +pr: + branches: + include: + - "*" + +schedules: + - cron: "2 4 * * Tue" # Every Tuesday on 04:02 UTC + displayName: "Weekly Build" + branches: + include: + - main + +pool: + vmImage: "ubuntu-latest" + +variables: + isTag: $[startsWith(variables['Build.SourceBranch'], 'refs/tags/')] + +steps: + - task: CmdLine@2 + displayName: 'Lint Bash scripts' + inputs: + script: | + shellcheck *.sh + shellcheck packaging/debian/adoptium-cacerts.sh + shellcheck packaging/debian/postinst + shellcheck packaging/debian/prerm + + - task: Gradle@2 + displayName: "Build and run tests" + inputs: + workingDirectory: "" + gradleWrapperFile: "gradlew" + gradleOptions: "-Xmx3072m" + javaHomeOption: "JDKVersion" + jdkVersionOption: "1.8" + jdkArchitectureOption: "x64" + publishJUnitResults: true + testResultsFiles: "**/TEST-*.xml" + tasks: "check packageTest" + + - task: CopyFiles@2 + displayName: "Collect debian packages" + inputs: + sourceFolder: "$(Build.SourcesDirectory)/build/deb" + contents: "*.deb" + targetFolder: "$(Build.ArtifactStagingDirectory)" + + - task: PublishBuildArtifacts@1 + displayName: "Publish artifacts" + inputs: + pathToPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: artifacts + + - task: GitHubRelease@0 + displayName: "Push to GitHub Releases" + condition: and(succeeded(), eq(variables.isTag, true)) + inputs: + gitHubConnection: github/aahlenst + repositoryName: "$(Build.Repository.Name)" + action: "create" + target: "$(Build.SourceVersion)" + tagSource: "auto" diff --git a/linux_new/build.gradle b/linux_new/build.gradle new file mode 100644 index 000000000..fd6b68930 --- /dev/null +++ b/linux_new/build.gradle @@ -0,0 +1,61 @@ +plugins { + id "java" +} + +ext { + junitVersion = "5.7.0" + testcontainersVersion = "1.15.1" + assertjCoreVersion = "3.18.1" +} + +repositories { + mavenCentral() +} + +group "org.adoptium" +version "1.0.0-SNAPSHOT" + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +tasks.register("package") { + group = "packaging" + description = "Creates Linux packages." +} + +tasks.register("checkPackage") { + description = "Tests the generated packages." + group = "verification" +} + +check.dependsOn(checkPackage) + +def getProduct() { + return hasProperty("PRODUCT") ? PRODUCT.toString().toLowerCase(Locale.US) : null +} + +def getProductVersion() { + return hasProperty("PRODUCT_VERSION") ? Integer.parseInt(PRODUCT_VERSION) : null +} + +def getGPGKey() { + return hasProperty("GPG_KEY") ? GPG_KEY.toString() : null +} + +def getArch() { + return hasProperty("ARCH") ? ARCH.toString() : "all" +} + +def getInputDir() { + return hasProperty("INPUT_DIR") ? INPUT_DIR.toString() : null +} + +def getLocalBuildStatus() { + return hasProperty("INPUT_DIR") ? "true" : "false" +} + +def getContainerRegistry() { + return hasProperty("CONTAINER_REGISTRY") ? CONTAINER_REGISTRY.toString() : "" +} \ No newline at end of file diff --git a/linux_new/ca-certificates/build.gradle b/linux_new/ca-certificates/build.gradle new file mode 100644 index 000000000..46a7073f4 --- /dev/null +++ b/linux_new/ca-certificates/build.gradle @@ -0,0 +1,12 @@ +tasks.register("packageCaCertificates") { + group = "packaging" + description = "Creates Linux packages of Adoptium CA Certificates." +} + +tasks.register("checkCaCertificatesPackage") { + description = "Tests the generated Linux Adoptium CA Certificates package." + group = "verification" +} + +rootProject.package.dependsOn(project.packageCaCertificates) +rootProject.checkPackage.dependsOn(project.checkCaCertificatesPackage) diff --git a/linux_new/ca-certificates/debian/build.gradle b/linux_new/ca-certificates/debian/build.gradle new file mode 100644 index 000000000..f9e2dccc5 --- /dev/null +++ b/linux_new/ca-certificates/debian/build.gradle @@ -0,0 +1,132 @@ +plugins { + id "java" +} + +ext { + junitVersion = "5.11.4" + testcontainersVersion = "1.20.4" + assertjCoreVersion = "3.26.3" +} + +repositories { + mavenCentral() +} + +group "org.adoptium" +version "1.0.0-SNAPSHOT" + +/* + * The versions list defines the Debian and Ubuntu versions that this package is uploaded to. + * + * If a version like sid is missing here, the package won't be included in the sid repository and therefore not + * installable via apt. Never use suite names like testing or unstable. This list is usually bigger than the list + * of versions we test with as defined by the class DebianFlavours in the source set packageTest. + * + * **Attention**: If you alter the list, check if the class DebianFlavours needs to be updated, too. + */ +def deb_versions = [ + "trixie", // Debian/13 + "bookworm", // Debian/12 + "bullseye", // Debian/11 + "buster", // Debian/10 + "oracular", // Ubuntu/24.10 (STS) + "noble", // Ubuntu/24.04 (LTS) + "jammy", // Ubuntu/22.04 (LTS) + "focal", // Ubuntu/20.04 (LTS) + "bionic", // Ubuntu/18.04 (LTS) +] + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +sourceSets { + packageTest { + compileClasspath += sourceSets.main.output + runtimeClasspath += sourceSets.main.output + } +} + +configurations { + packageTestImplementation.extendsFrom implementation + packageTestRuntimeOnly.extendsFrom runtimeOnly +} + +dependencies { + packageTestImplementation "org.junit.jupiter:junit-jupiter:$junitVersion" + packageTestImplementation "org.testcontainers:testcontainers:$testcontainersVersion" + packageTestImplementation "org.testcontainers:junit-jupiter:$testcontainersVersion" + packageTestImplementation "org.assertj:assertj-core:$assertjCoreVersion" +} + +test { + useJUnitPlatform() + testLogging { + events "passed", "skipped", "failed" + } +} + +task packageCaCertificatesDebian { + dependsOn "assemble" + + group = "packaging" + description = "Creates ca-certificate deb package for Debian flavours." + + def outputDir = new File(project.buildDir.absolutePath, "ospackage") + outputs.dir(outputDir) + + // Get container registry property. If not set, return empty string that is equivalent to dockerhub + def containerRegistry = getContainerRegistry() + + doLast { + project.copy { + from("src/main/packaging/") + into("${buildDir}/generated/packaging") + } + project.exec { + workingDir "src/main/packaging" + commandLine "docker", "build", "--no-cache", + "-t", "adoptium-packages-linux-cacerts-debian", + "--build-arg=CONTAINER_REGISTRY=${containerRegistry}", + "-f", "Dockerfile", + getProjectDir().absolutePath + "/src/main/packaging" + } + + project.exec { + workingDir getRootDir() + commandLine "docker", "run", "--rm", + "--mount", "type=bind,source=${buildDir},target=/home/builder/build", + "--mount", "type=bind,source=${outputDir.absolutePath},target=/home/builder/out", + "-e", "VERSIONS=${String.join(" ", deb_versions)}", + "adoptium-packages-linux-cacerts-debian:latest" + } + } +} + +task checkCaCertificatesDebian(type: Test) { + dependsOn packageCaCertificatesDebian + + description = 'Tests the generated ca-certificate Debian packages.' + group = 'verification' + + testClassesDirs = sourceSets.packageTest.output.classesDirs + classpath = sourceSets.packageTest.runtimeClasspath + + def containerRegistry = getContainerRegistry() + + environment "PACKAGE", "adoptium-ca-certificates" + + if (containerRegistry != null && containerRegistry != "") { + environment "containerRegistry", "$containerRegistry" + println "Container registry set to $containerRegistry" + } + + useJUnitPlatform() + testLogging { + events "passed", "skipped", "failed" + } +} + +parent.packageCaCertificates.dependsOn(packageCaCertificatesDebian) +parent.checkCaCertificatesPackage.dependsOn(checkCaCertificatesDebian) diff --git a/linux_new/ca-certificates/debian/src/main/packaging/Dockerfile b/linux_new/ca-certificates/debian/src/main/packaging/Dockerfile new file mode 100644 index 000000000..8e18b038c --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/Dockerfile @@ -0,0 +1,19 @@ +ARG CONTAINER_REGISTRY="" + +FROM ${CONTAINER_REGISTRY}debian:bullseye + +# Combine apt-get update with apt-get install to prevent stale package indexes. +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential \ + debhelper lsb-release reprepro gosu tini + +# Create unprivileged user for building, see +# https://github.com/hexops/dockerfile#use-a-static-uid-and-gid +RUN groupadd -g 10001 builder \ + && useradd -m -d /home/builder -u 10000 -g 10001 builder + +# Prepare entrypoint and build scripts +ADD entrypoint.sh /entrypoint.sh +ADD build.sh /home/builder/build.sh +RUN chmod +x /home/builder/build.sh + +ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/entrypoint.sh" ] diff --git a/linux_new/ca-certificates/debian/src/main/packaging/build.sh b/linux_new/ca-certificates/debian/src/main/packaging/build.sh new file mode 100644 index 000000000..125f8ec31 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/build.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euxo pipefail + +# Copy build scripts into a directory within the container. Avoids polluting the mounted +# directory and permission errors +mkdir /home/builder/workspace +cp -R /home/builder/build/generated/packaging /home/builder/workspace + +# Build package and set distributions it supports +cd /home/builder/workspace/packaging +dpkg-buildpackage -us -uc -b +changestool /home/builder/workspace/*.changes setdistribution $VERSIONS + +# Copy resulting files into mounted directory where artifacts should be placed. +mv /home/builder/workspace/*.{deb,changes,buildinfo} /home/builder/out diff --git a/linux_new/ca-certificates/debian/src/main/packaging/debian/adoptium-cacerts.sh b/linux_new/ca-certificates/debian/src/main/packaging/debian/adoptium-cacerts.sh new file mode 100644 index 000000000..55d3df2ce --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/debian/adoptium-cacerts.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env sh +set -eu + +cacerts_updates=yes + +if [ -f /etc/default/adoptium-ca-certificates ]; then + # shellcheck disable=SC1091 + . /etc/default/adoptium-ca-certificates +fi + +# We need to leave the update-ca-certificates hook in place until the package +# is purged. Therefore we have to check whether trust is a known command. +if [ "$cacerts_updates" != yes ] || ! command -v trust >/dev/null 2>&1 ; then + echo "Updates of adoptium-ca-certificates' keystore disabled." + exit 0 +fi + +# Trust does not overwrite existing files, therefore we need to remove it +# beforehand. +if [ -e "/etc/ssl/certs/adoptium/cacerts" ]; then + rm -f /etc/ssl/certs/adoptium/cacerts +fi + +trust extract --format=java-cacerts /etc/ssl/certs/adoptium/cacerts + +echo "/etc/ssl/certs/adoptium/cacerts successfully populated." diff --git a/linux_new/ca-certificates/debian/src/main/packaging/debian/changelog b/linux_new/ca-certificates/debian/src/main/packaging/debian/changelog new file mode 100644 index 000000000..d4d87204c --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/debian/changelog @@ -0,0 +1,29 @@ +adoptium-ca-certificates (1.0.4-1) STABLE; urgency=medium + + * Add Ubuntu Oracular Oriole to the list of supported releases. + + -- Eclipse Adoptium Package Maintainers Thu, 16 December 2024 12:00:00 +0000 + +adoptium-ca-certificates (1.0.3-1) STABLE; urgency=medium + + * Add Debian Trixie & Ubuntu Noble to the list of supported releases. + + -- Eclipse Adoptium Package Maintainers Thu, 25 April 2024 10:30:30 +0000 + +adoptium-ca-certificates (1.0.2-1) STABLE; urgency=medium + + * Add Debian Bookworm to the list of supported releases. + + -- Eclipse Adoptium Package Maintainers Tue, 13 Jun 2023 13:08:30 +0000 + +adoptium-ca-certificates (1.0.1-1) STABLE; urgency=medium + + * Add Ubuntu Kinetic (22.10) to the list of supported Ubuntu releases. + + -- Eclipse Adoptium Package Maintainers Tue, 06 Dec 2022 15:42:00 +0000 + +adoptium-ca-certificates (1.0.0-1) UNRELEASED; urgency=medium + + * Create package. + + -- Andreas Ahlenstorf Wed, 29 Jul 2020 13:35:00 +0000 diff --git a/linux_new/ca-certificates/debian/src/main/packaging/debian/compat b/linux_new/ca-certificates/debian/src/main/packaging/debian/compat new file mode 100644 index 000000000..b4de39476 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/debian/compat @@ -0,0 +1 @@ +11 diff --git a/linux_new/ca-certificates/debian/src/main/packaging/debian/control b/linux_new/ca-certificates/debian/src/main/packaging/debian/control new file mode 100644 index 000000000..c219b0373 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/debian/control @@ -0,0 +1,13 @@ +Source: adoptium-ca-certificates +Section: java +Priority: optional +Maintainer: Eclipse Adoptium Package Maintainers +Build-Depends: debhelper (>= 11), lsb-release + +Package: adoptium-ca-certificates +Architecture: all +Depends: ca-certificates, p11-kit +Description: CA certificates for OpenJDK, Adoptium and compatible runtimes + Provides a Java keystore with CA certificates for OpenJDK, Eclipse Adoptium + and compatible runtimes. The keystore is automatically synchronized with the + operating system's certificate store. diff --git a/linux_new/ca-certificates/debian/src/main/packaging/debian/default b/linux_new/ca-certificates/debian/src/main/packaging/debian/default new file mode 100644 index 000000000..1e09261ef --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/debian/default @@ -0,0 +1,5 @@ +# Defaults for adoptium-ca-certificates + +# Enable/disable updates of the keystore /etc/ssl/certs/adoptium/cacerts. +# Any value other than yes disables it. +cacerts_updates=yes diff --git a/linux_new/ca-certificates/debian/src/main/packaging/debian/postinst b/linux_new/ca-certificates/debian/src/main/packaging/debian/postinst new file mode 100644 index 000000000..59cca3127 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/debian/postinst @@ -0,0 +1,18 @@ +#!/usr/bin/env sh +set -eu + +case "$1" in +configure) + /etc/ca-certificates/update.d/adoptium-cacerts + ;; + +abort-upgrade | abort-remove | abort-deconfigure) + # Nothing to do + ;; +*) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/linux_new/ca-certificates/debian/src/main/packaging/debian/postrm b/linux_new/ca-certificates/debian/src/main/packaging/debian/postrm new file mode 100644 index 000000000..b8dde8db2 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/debian/postrm @@ -0,0 +1,18 @@ +#!/bin/sh +set -eu + +case "$1" in +purge) + rm -rf /etc/ssl/certs/adoptium + rmdir /etc/ssl/certs 2>/dev/null || true + ;; +remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear) + # Nothing to do + ;; +*) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/linux_new/ca-certificates/debian/src/main/packaging/debian/rules b/linux_new/ca-certificates/debian/src/main/packaging/debian/rules new file mode 100644 index 000000000..e2434f838 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/debian/rules @@ -0,0 +1,22 @@ +#!/usr/bin/make -f + +d = debian/adoptium-ca-certificates + +%: + dh $@ + +override_dh_auto_clean: +override_dh_auto_test: +override_dh_auto_build: +override_dh_auto_install: + dh_installdirs \ + etc/ca-certificates/update.d \ + etc/default \ + etc/ssl/certs/adoptium + install -m600 debian/default \ + $(d)/etc/default/adoptium-ca-certificates + install -m755 debian/adoptium-cacerts.sh \ + $(d)/etc/ca-certificates/update.d/adoptium-cacerts + +override_dh_gencontrol: + dh_gencontrol -- diff --git a/linux_new/ca-certificates/debian/src/main/packaging/entrypoint.sh b/linux_new/ca-certificates/debian/src/main/packaging/entrypoint.sh new file mode 100644 index 000000000..2485fefe0 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/main/packaging/entrypoint.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euox pipefail + +# The directory mounted into the container has the UID/GID of the host user. In order to allow the user builder to write +# into it without changing its ownership (which could render the folder or its contents inaccessible to the host user), +# add the user builder to the group with the same GID as the host user. +HOST_USER_GID=$(stat -c "%g" /home/builder/out) +getent group "$HOST_USER_GID" || groupadd -g "$HOST_USER_GID" hostusrg +usermod -a -G "$HOST_USER_GID" builder +chmod g+w /home/builder/out + +# Drop root privileges and build the package. +gosu builder /home/builder/build.sh diff --git a/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/AptOperationsTest.java b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/AptOperationsTest.java new file mode 100644 index 000000000..e953fbc4d --- /dev/null +++ b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/AptOperationsTest.java @@ -0,0 +1,231 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.adoptium.cacertificates; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ArgumentsSource; +import org.testcontainers.containers.Container; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.utility.MountableFile; + +import java.io.File; +import java.nio.file.Path; + +import static org.adoptium.cacertificates.TestContainersUtil.runShell; +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Andreas Ahlenstorf + */ +class AptOperationsTest { + + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void packageSuccessfullyInstalled(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get update"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "apt-cache show adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + assertThat(result.getStdout()) + .contains("Package: adoptium-ca-certificates") + .contains("Version: 1.0.4-1") + .contains("Priority: optional") + .contains("Architecture: all") + .contains("Status: install ok installed"); + } + } + + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void packageContentsMatchExpectations(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + String packageContents = IOUtil.resourceAsString("/deb-contents.txt"); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + // Remove the size and date_time columns from the comparison + result = runShell(container, "dpkg --contents " + containerDeb + " | awk '{$3=$4=$5=\"\"; print $0}'"); + assertThat(result.getExitCode()).isEqualTo(0); + + String dpkgContents = result.getStdout(); + dpkgContents = dpkgContents.replaceAll("(\\r|\\n|\\r\\n|\\n\\n)+", "\n"); + assertThat(dpkgContents).isEqualTo(packageContents); + } + } + + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void uninstallRemovesPackage(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get update"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "test -f /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + result = runShell(container, "test -f /etc/default/adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + result = runShell(container, "test -x /etc/ca-certificates/update.d/adoptium-cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get remove -y adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "dpkg --list | grep adoptium-ca-certificates"); + assertThat(result.getStdout()).startsWith("rc"); + + // Files must still exist because we haven't yet purged the package + result = runShell(container, "test -f /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + result = runShell(container, "test -f /etc/default/adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + result = runShell(container, "test -x /etc/ca-certificates/update.d/adoptium-cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + + // The hook is still there, so we must ensure that it still works. + result = runShell(container, "update-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + assertThat(result.getStdout()).contains("/etc/ssl/certs/adoptium/cacerts successfully populated."); + + // Ensure that removal of `trust` can be handled. + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get remove -y p11-kit"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "update-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + assertThat(result.getStdout()).contains("Updates of adoptium-ca-certificates' keystore disabled."); + + } + } + + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void purgeRemovesPackageContents(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get update"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "test -f /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + result = runShell(container, "test -f /etc/default/adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + result = runShell(container, "test -x /etc/ca-certificates/update.d/adoptium-cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get purge -y adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + + // No results because package was installed from file, not repository. If it was installed from repository, + // it would show up and we had to check the installation status. + result = runShell(container, "dpkg --list | grep adoptium-ca-certificates | wc -l"); + assertThat(result.getStdout()).isEqualToIgnoringNewLines("0"); + + // Files must still exist because we haven't yet purged the package + result = runShell(container, "test -e /etc/ssl/certs/adoptium"); + assertThat(result.getExitCode()).isEqualTo(1); + result = runShell(container, "test -e /etc/default/adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(1); + result = runShell(container, "test -e /etc/ca-certificates/update.d/adoptium-cacerts"); + assertThat(result.getExitCode()).isEqualTo(1); + } + } + + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void reinstallationIsSuccessful(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get update"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get remove -y adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "test -f /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + result = runShell(container, "test -f /etc/default/adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + result = runShell(container, "test -x /etc/ca-certificates/update.d/adoptium-cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + } + } +} diff --git a/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/ChangesVerificationTest.java b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/ChangesVerificationTest.java new file mode 100644 index 000000000..43346b268 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/ChangesVerificationTest.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.adoptium.cacertificates; + +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Andreas Ahlenstorf + */ +class ChangesVerificationTest { + + private static String[] versionsList = { + "trixie", // Debian/13 + "bookworm", // Debian/12 + "bullseye", // Debian/11 + "buster", // Debian/10 + "oracular", // Ubuntu/24.10 (STS) + "noble", // Ubuntu/24.04 (LTS) + "jammy", // Ubuntu/22.04 (LTS) + "focal", // Ubuntu/20.04 (LTS) + "bionic", // Ubuntu/18.04 (LTS) + }; + + @Test + void allDistributionsListedInChangesFile() throws IOException { + Path changesFile = DebFiles.hostChangesPath(); + assertThat(changesFile).exists(); + + List lines = Files.readAllLines(changesFile, StandardCharsets.UTF_8); + assertThat(lines).contains("Distribution: " + String.join(" ", versionsList)); + } +} diff --git a/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebFiles.java b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebFiles.java new file mode 100644 index 000000000..02e6ff0d5 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebFiles.java @@ -0,0 +1,66 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.adoptium.cacertificates; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * Utility methods to interact with deb files. + * + * @author Andreas Ahlenstorf + */ +final class DebFiles { + private DebFiles() { + // no instances + } + + static Path hostDebPath() { + return findBuildOutputOnHost(System.getenv("PACKAGE") + "*.deb"); + } + + private static Path findBuildOutputOnHost(String pattern) { + Path outputDirectory = Paths.get("build", "ospackage"); + try (DirectoryStream stream = Files.newDirectoryStream(outputDirectory, pattern)) { + for (Path candidateFile : stream) { + return candidateFile; + } + } catch (IOException x) { + throw new UncheckedIOException(x); + } + + throw new RuntimeException("Could not find file with pattern " + pattern + " in " + outputDirectory.toString()); + } + + static Path hostChangesPath() { + Path outputDirectory = Paths.get("build", "ospackage"); + String changesFilePattern = "adoptium-ca-certificates*.changes"; + try (DirectoryStream stream = Files.newDirectoryStream(outputDirectory, changesFilePattern)) { + for (Path candidateFile : stream) { + return candidateFile; + } + } catch (IOException x) { + throw new UncheckedIOException(x); + } + + throw new RuntimeException("Could not find changes file in " + outputDirectory.toString()); + } +} diff --git a/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebianFlavours.java b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebianFlavours.java new file mode 100644 index 000000000..7c5efaa7b --- /dev/null +++ b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebianFlavours.java @@ -0,0 +1,59 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.adoptium.cacertificates; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.ArgumentsProvider; + +import java.util.stream.Stream; + +/** + * @author Andreas Ahlenstorf + */ +public class DebianFlavours implements ArgumentsProvider { + @Override + public Stream provideArguments(ExtensionContext context) { + /* + * Debian policy: oldstable, stable and testing version. + * (https://www.debian.org/releases/) + * Ubuntu policy: Current LTS versions, and development version. + * (https://wiki.ubuntu.com/Releases) + */ + + String containerRegistry = ""; + + if (System.getenv("containerRegistry") == null) { + System.out.println("Using docker.io as the default container registry"); + } else { + containerRegistry = System.getenv("containerRegistry"); + System.out.println("Using container registry: " + containerRegistry); + } + + return Stream.of( + Arguments.of(containerRegistry + "debian", "trixie"), // Debian/13 (testing) + Arguments.of(containerRegistry + "debian", "bookworm"), // Debian/12 (testing) + Arguments.of(containerRegistry + "debian", "bullseye"), // Debian/11 (stable) + Arguments.of(containerRegistry + "debian", "buster"), // Debian/10 (oldstable) + Arguments.of(containerRegistry + "ubuntu", "oracular"), // Ubuntu/24.10 (STS) + Arguments.of(containerRegistry + "ubuntu", "noble"), // Ubuntu/24.04 (LTS) + Arguments.of(containerRegistry + "ubuntu", "jammy"), // Ubuntu/22.04 (LTS) + Arguments.of(containerRegistry + "ubuntu", "focal"), // Ubuntu/20.04 (LTS) + Arguments.of(containerRegistry + "ubuntu", "bionic") // Ubuntu/18.04 (LTS) + ); + } +} diff --git a/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebianIntegrationTest.java b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebianIntegrationTest.java new file mode 100644 index 000000000..0c3df46ca --- /dev/null +++ b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/DebianIntegrationTest.java @@ -0,0 +1,242 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.adoptium.cacertificates; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ArgumentsSource; +import org.testcontainers.containers.Container; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.utility.MountableFile; + +import java.io.File; +import java.nio.file.Path; + +import static org.adoptium.cacertificates.TestContainersUtil.runShell; +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Andreas Ahlenstorf + */ +class DebianIntegrationTest { + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void keystoreIsUsable(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get update"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y default-jre"); + assertThat(result.getExitCode()).isEqualTo(0); + + // Certificate fingerprint it SwissSign Gold G2 (https://www.swisssign.com/support/ca-prod.html) + result = runShell( + container, "keytool -list -keystore /etc/ssl/certs/adoptium/cacerts -storepass changeit" + ); + assertThat(result.getExitCode()).isEqualTo(0); + assertThat(result.getStdout()) + .containsIgnoringCase("Keystore type: jks") + .containsIgnoringCase("Keystore provider: SUN") + .contains("swisssigngoldca-g2"); + } + } + + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void keystoreCanBeUpdated(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get update"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y default-jre"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell( + container, "keytool -list -keystore /etc/ssl/certs/adoptium/cacerts -storepass changeit" + ); + assertThat(result.getExitCode()).isEqualTo(0); + assertThat(result.getStdout()) + .containsIgnoringCase("Keystore type: jks") + .containsIgnoringCase("Keystore provider: SUN") + .contains("swisssigngoldca-g2"); + + result = runShell(container, "update-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell( + container, "keytool -list -keystore /etc/ssl/certs/adoptium/cacerts -storepass changeit" + ); + assertThat(result.getExitCode()).isEqualTo(0); + assertThat(result.getStdout()) + .containsIgnoringCase("Keystore type: jks") + .containsIgnoringCase("Keystore provider: SUN") + .contains("swisssigngoldca-g2"); + } + } + + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void deletedKeystoreIsRecreatedOnCaUpdate(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get update"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "test -f /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "rm -f /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "test -e /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(1); + + result = runShell(container, "update-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "test -f /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + } + } + + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void keystoreNotRecreatedWhenUpdatesDisabled(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get update"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "test -f /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "rm -f /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "test -e /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(1); + + result = runShell(container, "echo \"cacerts_updates=no\" > /etc/default/adoptium-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "update-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "test -e /etc/ssl/certs/adoptium/cacerts"); + assertThat(result.getExitCode()).isEqualTo(1); + } + } + + @ParameterizedTest(name = "{0}:{1}") + @ArgumentsSource(DebianFlavours.class) + void newlyCreatedCertificateAddedToKeystore(String distribution, String codename) { + Path hostDeb = DebFiles.hostDebPath(); + assertThat(hostDeb).exists(); + File containerDeb = new File("", hostDeb.toFile().getName()); + + try (GenericContainer container = new GenericContainer<>(String.format("%s:%s", distribution, codename))) { + container.withCommand("/bin/bash", "-c", "while true; do sleep 10; done") + .withCopyFileToContainer(MountableFile.forHostPath(hostDeb), containerDeb.toString()) + .start(); + + Container.ExecResult result; + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get update"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y " + containerDeb); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "DEBIAN_FRONTEND=noninteractive apt-get install -y default-jre"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell( + container, "keytool -list -keystore /etc/ssl/certs/adoptium/cacerts -storepass changeit" + ); + assertThat(result.getExitCode()).isEqualTo(0); + assertThat(result.getStdout()) + .containsIgnoringCase("Keystore type: jks") + .containsIgnoringCase("Keystore provider: SUN") + .doesNotContain("adoptiumdummyca"); + + result = runShell(container, "openssl req -x509 -newkey rsa:2048 -keyout key.pem -out " + + "/usr/local/share/ca-certificates/cert.crt -days 365 -nodes -subj '/CN=Adoptium Dummy CA'"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell(container, "update-ca-certificates"); + assertThat(result.getExitCode()).isEqualTo(0); + + result = runShell( + container, "keytool -list -keystore /etc/ssl/certs/adoptium/cacerts -storepass changeit" + ); + assertThat(result.getExitCode()).isEqualTo(0); + assertThat(result.getStdout()) + .containsIgnoringCase("Keystore type: jks") + .containsIgnoringCase("Keystore provider: SUN") + .contains("adoptiumdummyca"); + } + } +} diff --git a/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/IOUtil.java b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/IOUtil.java new file mode 100644 index 000000000..f63f590f6 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/IOUtil.java @@ -0,0 +1,53 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.adoptium.cacertificates; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; + +/** + * @author Andreas Ahlenstorf + */ +public final class IOUtil { + private IOUtil() { + // no instances + } + + public static String toString(InputStream stream) { + try (ByteArrayOutputStream result = new ByteArrayOutputStream()) { + byte[] buffer = new byte[1024]; + int length; + while ((length = stream.read(buffer)) != -1) { + result.write(buffer, 0, length); + } + return result.toString(StandardCharsets.UTF_8.name()); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + public static String resourceAsString(String name) { + try (InputStream stream = IOUtil.class.getResourceAsStream(name)) { + return IOUtil.toString(stream); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } +} diff --git a/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/TestContainersUtil.java b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/TestContainersUtil.java new file mode 100644 index 000000000..1db1b3d3e --- /dev/null +++ b/linux_new/ca-certificates/debian/src/packageTest/java/org/adoptium/cacertificates/TestContainersUtil.java @@ -0,0 +1,53 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.adoptium.cacertificates; + +import org.testcontainers.containers.Container; + +import java.io.IOException; + +/** + * @author Andreas Ahlenstorf + */ +public final class TestContainersUtil { + private TestContainersUtil() { + // no instances + } + + public static Container.ExecResult runCmd(Container container, String... command) { + try { + Container.ExecResult result = container.execInContainer(command); + System.out.print(result.getStdout()); + System.err.print(result.getStderr()); + return result; + } catch (InterruptedException | IOException e) { + throw new RuntimeException("Could not run command: " + String.join(" ", command), e); + } + } + + public static Container.ExecResult runShell(Container container, String command) { + String[] shellCmd = new String[]{"/bin/bash", "-c", command}; + try { + Container.ExecResult result = container.execInContainer(shellCmd); + System.out.print(result.getStdout()); + System.err.print(result.getStderr()); + return result; + } catch (InterruptedException | IOException e) { + throw new RuntimeException("Could not run command: " + String.join(" ", shellCmd), e); + } + } +} diff --git a/linux_new/ca-certificates/debian/src/packageTest/resources/deb-contents.txt b/linux_new/ca-certificates/debian/src/packageTest/resources/deb-contents.txt new file mode 100644 index 000000000..8381e4be2 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/packageTest/resources/deb-contents.txt @@ -0,0 +1,15 @@ +drwxr-xr-x root/root ./ +drwxr-xr-x root/root ./etc/ +drwxr-xr-x root/root ./etc/ca-certificates/ +drwxr-xr-x root/root ./etc/ca-certificates/update.d/ +-rwxr-xr-x root/root ./etc/ca-certificates/update.d/adoptium-cacerts +drwxr-xr-x root/root ./etc/default/ +-rw-r--r-- root/root ./etc/default/adoptium-ca-certificates +drwxr-xr-x root/root ./etc/ssl/ +drwxr-xr-x root/root ./etc/ssl/certs/ +drwxr-xr-x root/root ./etc/ssl/certs/adoptium/ +drwxr-xr-x root/root ./usr/ +drwxr-xr-x root/root ./usr/share/ +drwxr-xr-x root/root ./usr/share/doc/ +drwxr-xr-x root/root ./usr/share/doc/adoptium-ca-certificates/ +-rw-r--r-- root/root ./usr/share/doc/adoptium-ca-certificates/changelog.Debian.gz diff --git a/linux_new/ca-certificates/debian/src/packageTest/resources/junit-platform.properties b/linux_new/ca-certificates/debian/src/packageTest/resources/junit-platform.properties new file mode 100644 index 000000000..317c292e3 --- /dev/null +++ b/linux_new/ca-certificates/debian/src/packageTest/resources/junit-platform.properties @@ -0,0 +1,2 @@ +junit.jupiter.execution.parallel.enabled = true +junit.jupiter.execution.parallel.mode.default = concurrent diff --git a/linux_new/generate_spec.py b/linux_new/generate_spec.py new file mode 100644 index 000000000..f3915442a --- /dev/null +++ b/linux_new/generate_spec.py @@ -0,0 +1,114 @@ +import sys +import os +from jinja2 import Environment, FileSystemLoader + +def print_parameters(template_path, package_version, hardware_architecture, package_url, package_checksum, package_name, output_file_name, current_date, package_release_version, upstream_version, changelog_version, upstreamarm32_version): + """ + Print the received parameters in a formatted manner. + """ + print("Parameters received:") + print(f" Template Path : {template_path}") + print(f" Package Version : {package_version}") + print(f" Hardware Architecture : {hardware_architecture}") + print(f" Package URL : {package_url}") + print(f" Package Checksum : {package_checksum}") + print(f" Package Name : {package_name}") + print(f" Output File Name : {output_file_name}") + print(f" Current Date : {current_date}") + print(f" Pack Rel Version : {package_release_version}") + print(f" Upstream Version : {upstream_version}") + print(f" Changelog Version : {changelog_version}") + print(f" Upstream ARM32 Version : {upstreamarm32_version}") + +def render_template(template_path, package_version, hardware_architecture, package_url, package_checksum, package_name, output_file_name, current_date, package_release_version, upstream_version, changelog_version, upstreamarm32_version): + """ + Render a Jinja2 template file using provided parameters and save the result to an output file specified by the user. + + Args: + template_path (str): Path to the J2 template file. + package_version (str): The JDK version for the package being built. + hardware_architecture (str): The hardware architecture for the package. + package_url (str): The URL of the GitHub binary file for this release. + package_checksum (str): The validated SHA256 checksum of the binary specified in the URL. + package_name (str): The filename of the package binary. + output_file_name (str): The name of the output file to save the rendered content. + current_date (str): The date to be used for changelogs etc. + package_release_version (str): The package release version. + upstream_version (str): The upstream release version. + changelog_version (str): The version to be used in the changelog version + upstreamarm32_version (str): The upstream version to be used for ARM32 on JDK8 + """ + # Get the directory of the template file and set the output file path in the same directory + template_dir = os.path.dirname(template_path) + output_path = os.path.join(template_dir, output_file_name) + + # Load the template environment and template file + env = Environment(loader=FileSystemLoader(template_dir)) + template = env.get_template(os.path.basename(template_path)) + + # Render the template with provided parameters + rendered_content = template.render( + package_version=package_version, + hardware_architecture=hardware_architecture, + package_url=package_url, + package_checksum=package_checksum, + package_name=package_name, + current_date=current_date, + package_release_version=package_release_version, + upstream_version=upstream_version, + changelog_version=changelog_version, + upstreamarm32_version=upstreamarm32_version + ) + + # Write the rendered content to the output file + with open(output_path, "w") as output_file: + output_file.write(rendered_content) + + print(f"Template rendered and saved to {output_path}") + +def main(): + # Define the expected parameter count (9 parameters + script name) + expected_params = 12 + + # Check if the correct number of arguments was provided ( add 1 for script name/system param) + if len(sys.argv) != expected_params + 1: + print("Error: Eleven parameters are required.") + print("\nUsage:") + print(" python3 script.py