Skip to content

Commit

Permalink
Installers Add riscv64 support (#847)
Browse files Browse the repository at this point in the history
* Add riscv support for jdk21 & jdk22

Fix rpm upload

Add housekeeping

Syntax fix

Add some houskeeping

Alpine jdk22 alignment

Add riscv support

Add Riscv support

Test upload

Fix node

syntax fix

Test unarchive

Test node switch jf-cli

Alpine fix

Fix distrolist property

test

Risc upload test

Test RISC

Syntax fix

Fix

Fix

Fix

Syntax

Riscv support

Risc tool removal

Test tools

Test tools

Fix debian rules

Fix typo

syntax fix

Riscv support

Bump ubuntu version for debian build

debian fix

Debian test

test

Test

Fix debian

fix logic

Fix logic

Add RISCV support

Add Debian RiscV Support

* Update checksums for JDK22

* Remove label for testing

* Add new tag for dockerinstaller

* Rationalise riscv upload

* Add missing s390x for releases > 20

* Fix missing risc for "All"

* Update linux/Jenkinsfile

Co-authored-by: Stewart X Addison <[email protected]>

* Correct RiscV Upload Function Name

* Fix RISCV Debian JDK22 Url & Alpine handling

---------

Co-authored-by: Stewart X Addison <[email protected]>
  • Loading branch information
steelhead31 and sxa authored Apr 11, 2024
1 parent 02d35b4 commit d5afd6a
Show file tree
Hide file tree
Showing 24 changed files with 327 additions and 37 deletions.
103 changes: 87 additions & 16 deletions linux/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ aarch64 aarch64 arm64 arm64
ppc64le ppc64le ppc64le
source src - only for SRPM and no need specify as option or target
s390x s390x s390x only for jdk8+
riscv64 riscv64 riscv64 only for JDK21+
*/

env.NODE_LABEL = 'dockerBuild&&linux&&x64' // Default node and also used for build RedHat + Suse + Debian x64
Expand Down Expand Up @@ -38,7 +39,7 @@ pipeline {
parameters {
choice(name: 'TYPE', choices: Types.ALL, description: 'Build JDK or JRE')
choice(name: 'VERSION', choices: ['8', '11', '17', '21', '22'], description: 'Build for specific JDK VERSION')
choice(name: 'ARCH', choices: ['x86_64', 'armv7hl', 'armv7l', 'aarch64', 'ppc64le', 's390x', 'all'], description: 'Build for specific platform\n s390x not for VERSION 8\n Use armv7l for DebARM32 armv7hl for RH/Suse')
choice(name: 'ARCH', choices: ['x86_64', 'armv7hl', 'armv7l', 'aarch64', 'ppc64le', 's390x', 'riscv64', 'all'], description: 'Build for specific platform\n s390x not for VERSION 8\n Use armv7l for DebARM32 armv7hl for RH/Suse')
choice(name: 'DISTRO', choices: ['all', 'Alpine', 'Debian', 'RedHat', 'Suse'], description: 'Build for specific Distro\n Select RPM builds for RedHat and Suse')
booleanParam(name: 'uploadPackage', defaultValue: false, description: 'Tick this box to upload the deb/rpm files (exclude src.rpm) to Artifactory for official release')
booleanParam(name: 'uploadSRCRPM', defaultValue: false, description: 'Tick this box to upload (src.rpm files) to Artifactory')
Expand Down Expand Up @@ -174,17 +175,33 @@ def CheckAndUpload(String Target, String Distro, String BuildArch, String Versio
echo "Target Doesnt Exist - Upload Files"
switch(Distro) {
case "Debian":
jf 'rt u **/build/ospackage/temurin-*${BUILDARCH}.deb deb/pool/main/t/temurin-${VERSION}/ --target-props=${DISTROLIST}deb.component=main;deb.architecture=${BUILDARCH} --flat=true'
// Not RISC Use JF CLI
if (BuildArch != "riscv64") {
jf 'rt u **/build/ospackage/temurin-*${BUILDARCH}.deb deb/pool/main/t/temurin-${VERSION}/ --target-props=${DISTROLIST}deb.component=main;deb.architecture=${BUILDARCH} --flat=true'
}
if (BuildArch == "riscv64") {
handleRISCVUpload("Debian")
}
break
case "Alpine":
jf 'rt u **/build/ospackage/${FILENAME} apk/alpine/main/${BUILDARCH}/ --flat=true'
break
case "RPMS":
jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true'
case "RPMS":
if (BuildArch != "riscv64") {
jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true'
}
if (BuildArch == "riscv64") {
handleRISCVUpload("RPMS")
}
break
default:
echo "Default Case"
jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true'
if (BuildArch != "riscv64") {
jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true'
}
if (BuildArch == "riscv64") {
handleRISCVUpload("RPMS")
}
break
}
}
Expand All @@ -193,6 +210,36 @@ def CheckAndUpload(String Target, String Distro, String BuildArch, String Versio
}
}

// RISC-V Upload Function
def handleRISCVUpload(String Distro) {
env.DISTRO = Distro
echo "Distro = ${DISTRO}"
node("dockerBuild&&linux&&x64") {
tool name: 'jfrog-cli', type: 'jfrog'
def copiedFiles = copyArtifacts(filter: '**/build/ospackage/*,**/build/reports/**,**/packageTest/dependencies/deb/*', projectName: env.JOB_NAME, selector: specific(env.BUILD_NUMBER))
switch(Distro) {
case "Debian":
echo "Debian Upload"
jf 'rt u **/build/ospackage/temurin-*${BUILDARCH}.deb deb/pool/main/t/temurin-${VERSION}/ --target-props=${DISTROLIST}deb.component=main;deb.architecture=${BUILDARCH} --flat=true'
break
case "RPMS":
echo "RPM Upload"
jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true'
break
default:
echo "Default Upload"
jf 'rt u **/build/ospackage/*.${VALUE}.rpm ${PACKAGEDIR}/${KEY}/Packages/ --flat=true'
break
}
// Remove copied artifacts
for (copiedFile in copiedFiles) {
fileToDelete = copiedFile.filePath
echo "Deleting file: ${fileToDelete}"
deleteDir(path: fileToDelete)
}
}
}

// function only handle debian as DISTRO
def jenkinsStepDeb() {
def temurinVersion = "${TYPE.toLowerCase()} ${VERSION} - ${ARCH}"
Expand All @@ -204,7 +251,7 @@ def jenkinsStepDeb() {
debArchAllList.add("${ARCH}")
// when ARCH = all, rewrite list
if ("${ARCH}" == 'all') {
debArchAllList = ['x86_64', 'armv7l', 'aarch64', 'ppc64le', 's390x']
debArchAllList = ['x86_64', 'armv7l', 'aarch64', 'ppc64le', 's390x', 'riscv64']
}
// remove s390x for JDK8 and JDK20
if ("${VERSION}" == '8' || "${VERSION}" == '20') {
Expand All @@ -214,6 +261,10 @@ def jenkinsStepDeb() {
if ("${VERSION}" >= '20') {
debArchAllList.remove('armv7l')
}
// remove riscv64 for earlier than jdk21
if ("${VERSION}" <= '20') {
debArchAllList.remove('riscv64')
}
debArchAllList.each { DebARCH ->
// special handle: no label x86_64 only x64 for debian agent
def debLabel = "${DebARCH}&&docker"
Expand All @@ -224,11 +275,15 @@ def jenkinsStepDeb() {
if ("${DebARCH}" == 'armv7l') {
debLabel = 'armv8&&build&&dockerBuild&&dockerhost'
}

if ("${DebARCH}" == 'riscv64') {
debLabel = 'riscv64&&dockerInstaller'
}
// reallocate jenkins agent per element in list
node("linux&&${debLabel}") {
setup('Debian', "${DebARCH}")
tool name: 'jfrog-cli', type: 'jfrog'
if ("${DebARCH}" != 'riscv64') {
tool name: 'jfrog-cli', type: 'jfrog'
}
unstash 'installercode'
buildAndTest('Debian', "${DebARCH}","${VERSION}")
if (params.uploadPackage.toBoolean()) {
Expand All @@ -255,17 +310,18 @@ def jenkinsStepAlpine() {
// remove aarch64 for JDK20 and below
def versionInt = VERSION as int // Parse Version As Integer
if (versionInt < 21) {
apkArchAllList.remove('aarch64')
apkArchAllList.remove('aarch64')
}

apkArchAllList.each { ApkARCH ->
// special handle: no label x86_64 only x64 for alpine agent
def apkLabel = "${ApkARCH}&&docker"

if ("${ApkARCH}" == 'x86_64') {
apkLabel = 'x64&&dockerBuild'
if ("${ApkARCH}" == 'x86_64') {
}
// reallocate jenkins agent per element in list
if (ApkARCH == 'x86_64' || ApkARCH == 'aarch64') {
node("linux&&${apkLabel}") {
setup('Alpine', "${ApkARCH}")
tool name: 'jfrog-cli', type: 'jfrog'
Expand All @@ -276,6 +332,7 @@ def jenkinsStepAlpine() {
uploadArtifacts('Alpine', "${ApkARCH}", "${VERSION}")
}
}
}
}
}

Expand Down Expand Up @@ -323,7 +380,8 @@ def buildAndTest(String DISTRO, String buildArch, String VERSION) {
'armv7l': 'armhf',
'aarch64': 'arm64',
'ppc64le': 'ppc64el',
's390x' : 's390x'
's390x' : 's390x',
'riscv64' : 'riscv64'
]
def buildCli = "./gradlew ${gBuildTask} --parallel -PPRODUCT=${env.PRODUCT} -PPRODUCT_VERSION=${VERSION} -PARCH=${debArchList[buildArch]}"
buildCli = params.enableDebug.toBoolean() ? buildCli + ' --stacktrace' : buildCli
Expand Down Expand Up @@ -364,7 +422,7 @@ def uploadArtifacts(String DISTRO, String buildArch, String Version) {
}

def uploadAlpineArtifacts(String buildArch) {
// currently only support x64 as buildArch
// currently only support x64 & aarch64 as buildArch
// set BUILDARCH environment variable for ${buildArch}
env.BUILDARCH = buildArch

Expand All @@ -390,16 +448,23 @@ def uploadDebArtifacts(String buildArch, String Version) {
'armv7l': 'armhf',
'aarch64': 'arm64',
'ppc64le': 'ppc64el',
's390x' : 's390x'
's390x' : 's390x',
'riscv64' : 'riscv64'
]
// if VERSION is 8 or 20 remove s390x from the list

if (VERSION == '8' || VERSION == '20') {
debArchList.remove('s390x')
}
// if VERSION is 20 remove armv7l from the list
if (VERSION >= '20') {
// if VERSION is 20 or later remove armv7l from the list
def versionInt = VERSION as int // Parse Version As Integer
if (versionInt >= 20) {
debArchList.remove('armv7l')
}
// if VERSION is < 21 remove riscv64 from the list
if (versionInt < 21) {
debArchList.remove('riscv64')
}

/*
Debian/Ubuntu 10.0 11.0 16.04 20.04 22.04 22.10
Expand Down Expand Up @@ -477,16 +542,22 @@ def uploadRpmArtifacts(String DISTRO, String rpmArch) {
'armv7hl': 'armv7hl',
'aarch64': 'aarch64',
'ppc64le': 'ppc64le',
's390x' : 's390x'
's390x' : 's390x',
'riscv64' : 'riscv64'
]
// if VERSION is 8 or 20 remove s390x from the list
if (VERSION == '8' || VERSION == '20') {
rpmArchList.remove('s390x')
}
// if VERSION is 20 remove armv7hl from the list

if (VERSION >= '20') {
rpmArchList.remove('armv7hl')
}
// If Version < 21 remove riscv64
if (VERSION < '21') {
rpmArchList.remove('riscv64')
}

if ("${rpmArch}" != 'all') {
// when only build and upload one arch, reset
Expand Down
15 changes: 14 additions & 1 deletion linux/jdk/debian/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,18 @@ if ("$arch" == "armhf") {
}
}

if ("$arch" != "armhf") {
if ("$arch" == "riscv64") {
project.exec {
workingDir "src/main/packaging"
commandLine "docker", "build", "--no-cache",
"--build-arg", "IMAGE=riscv64/ubuntu:jammy",
"-t", "adoptium-packages-linux-jdk-debian",
"-f", "Dockerfile",
getProjectDir().absolutePath + "/src/main/packaging"
}
}

if ("$arch" != "armhf" && "$arch" != "riscv64"){
project.exec {
workingDir "src/main/packaging"
commandLine "docker", "build", "--no-cache",
Expand All @@ -122,6 +133,8 @@ if ("$arch" != "armhf") {
}
}



project.exec {
workingDir getRootDir()
commandLine "docker", "run",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Maintainer: Eclipse Adoptium Package Maintainers <[email protected]>
Build-Depends: debhelper (>= 11), lsb-release

Package: temurin-21-jdk
Architecture: amd64 arm64 ppc64el s390x
Architecture: amd64 arm64 ppc64el s390x riscv64
Depends: adoptium-ca-certificates,
java-common,
libasound2,
Expand Down
2 changes: 2 additions & 0 deletions linux/jdk/debian/src/main/packaging/temurin/21/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ ppc64el_tarball_url = https://github.com/adoptium/temurin21-binaries/releases/do
ppc64el_checksum = d08de863499d8851811c893e8915828f2cd8eb67ed9e29432a6b4e222d80a12f
s390x_tarball_url = https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.2_13.tar.gz
s390x_checksum = 0d5676c50821e0d0b951bf3ffd717e7a13be2a89d8848a5c13b4aedc6f982c78
riscv64_tarball_url = https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_riscv64_linux_hotspot_21.0.2_13.tar.gz
riscv64_checksum = 791a37ddb040e1a02bbfc61abfbc7e7321431a28054c9ac59ba1738fd5320b02

d = debian/$(pkg_name)
jvm_home = usr/lib/jvm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ temurin-22-jdk (22.0.0.0.0+36) STABLE; urgency=medium

* Eclipse Temurin 22.0.0.0.0+36 release.

-- Eclipse Adoptium Package Maintainers <[email protected]> Wed, 20 Mar 2024 00:00:00 +0000
-- Eclipse Adoptium Package Maintainers <[email protected]> Wed, 20 Mar 2024 00:00:00 +0000
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Maintainer: Eclipse Adoptium Package Maintainers <[email protected]>
Build-Depends: debhelper (>= 11), lsb-release

Package: temurin-22-jdk
Architecture: amd64 arm64 ppc64el
Architecture: amd64 arm64 ppc64el s390x riscv64
Depends: adoptium-ca-certificates,
java-common,
libasound2,
Expand Down
5 changes: 4 additions & 1 deletion linux/jdk/debian/src/main/packaging/temurin/22/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
pkg_name = temurin-22-jdk
priority = 2211
jvm_tools = jar jarsigner java javac javadoc javap jcmd jconsole jdb jdeprscan jdeps jfr jhsdb jimage jinfo jlink jmap jmod jpackage jps jrunscript jshell jstack jstat jstatd jwebserver keytool rmiregistry serialver jexec jspawnhelper

amd64_tarball_url = https://github.com/adoptium/temurin22-binaries/releases/download/jdk-22%2B36/OpenJDK22U-jdk_x64_linux_hotspot_22_36.tar.gz
amd64_checksum = bc3d99e816d0c373f424cd7aa2b6d3e8081a7189fe55c1561616922200ec8e47
arm64_tarball_url = https://github.com/adoptium/temurin22-binaries/releases/download/jdk-22%2B36/OpenJDK22U-jdk_aarch64_linux_hotspot_22_36.tar.gz
arm64_checksum = 4b52670caea44848cee893e35c804380817b6eff166cf64ee70ca2bfaac3d1c7
ppc64el_tarball_url = https://github.com/adoptium/temurin22-binaries/releases/download/jdk-22%2B36/OpenJDK22U-jdk_ppc64le_linux_hotspot_22_36.tar.gz
ppc64el_checksum = 8c062e934d95c639f97b4e51b968eed694a6653248727c3db8bc5e0e55cfd7f4
s390x_tarball_url = https://github.com/adoptium/temurin22-binaries/releases/download/jdk-22.0.0%2B0/OpenJDK22U-jdk_s390x_linux_hotspot_22_36.tar.gz
s390x_checksum = fa77cfd9b79e98cc8078e42886098ac588e6adeda685771b98f32b9bdb8b5a57
riscv64_tarball_url = https://github.com/adoptium/temurin22-binaries/releases/download/jdk-22%2B36/OpenJDK22U-jdk_riscv64_linux_hotspot_22_36.tar.gz
riscv64_checksum = a190d6afbf93587f6095b2b41cebc3ab3c05f7d7d07fde8bea8fbed14cbe7d6a

d = debian/$(pkg_name)
jvm_home = usr/lib/jvm
Expand Down
2 changes: 1 addition & 1 deletion linux/jdk/redhat/src/main/packaging/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ echo "DEBUG: building RH arch ${buildArch} with jdk version ${buildVersion}"
if [ "${buildArch}" != "all" ]; then
targets=${buildArch}
elif [ ${buildVersion} -gt 20 ]; then
targets="x86_64 ppc64le aarch64"
targets="x86_64 ppc64le aarch64 s390x riscv64"
else
targets="x86_64 ppc64le aarch64 armv7hl s390x"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
%global vers_arch2 ppc64le
%global vers_arch3 aarch64
%global vers_arch4 s390x
%global vers_arch5 riscv64
%global src_num 0
%global sha_src_num 1
%endif
Expand All @@ -30,6 +31,7 @@
%global vers_arch2 ppc64le
%global vers_arch3 aarch64
%global vers_arch4 s390x
%global vers_arch5 riscv64
%global src_num 2
%global sha_src_num 3
%endif
Expand All @@ -38,6 +40,7 @@
%global vers_arch2 ppc64le
%global vers_arch3 aarch64
%global vers_arch4 s390x
%global vers_arch5 riscv64
%global src_num 4
%global sha_src_num 5
%endif
Expand All @@ -46,9 +49,19 @@
%global vers_arch2 ppc64le
%global vers_arch3 aarch64
%global vers_arch4 s390x
%global vers_arch5 riscv64
%global src_num 6
%global sha_src_num 7
%endif
%ifarch riscv64
%global vers_arch x64
%global vers_arch2 ppc64le
%global vers_arch3 aarch64
%global vers_arch4 s390x
%global vers_arch5 riscv64
%global src_num 8
%global sha_src_num 9
%endif
# Allow for noarch SRPM build
%ifarch noarch
%global src_num 0
Expand All @@ -69,7 +82,7 @@ Packager: Eclipse Adoptium Package Maintainers <[email protected]>
AutoReqProv: no
Prefix: /usr/lib/jvm/%{name}

ExclusiveArch: x86_64 ppc64le aarch64 s390x
ExclusiveArch: x86_64 ppc64le aarch64 s390x riscv64

BuildRequires: tar
BuildRequires: wget
Expand Down Expand Up @@ -119,6 +132,9 @@ Source5: %{source_url_base}/jdk-%{upstream_version_url}/OpenJDK21U-jdk_%{vers_ar
# Fourth architecture (s390x)
Source6: %{source_url_base}/jdk-%{upstream_version_url}/OpenJDK21U-jdk_%{vers_arch4}_linux_hotspot_%{upstream_version_no_plus}.tar.gz
Source7: %{source_url_base}/jdk-%{upstream_version_url}/OpenJDK21U-jdk_%{vers_arch4}_linux_hotspot_%{upstream_version_no_plus}.tar.gz.sha256.txt
# Fifth architecture (riscv64)
Source8: %{source_url_base}/jdk-%{upstream_version_url}/OpenJDK21U-jdk_%{vers_arch5}_linux_hotspot_%{upstream_version_no_plus}.tar.gz
Source9: %{source_url_base}/jdk-%{upstream_version_url}/OpenJDK21U-jdk_%{vers_arch5}_linux_hotspot_%{upstream_version_no_plus}.tar.gz.sha256.txt

# Set the compression format to xz to be compatible with more Red Hat flavours. Newer versions of Fedora use zstd which
# is not available on CentOS 7, for example. https://github.com/rpm-software-management/rpm/blob/master/macros.in#L353
Expand Down
Loading

0 comments on commit d5afd6a

Please sign in to comment.