Skip to content

Commit

Permalink
[ansible] Add Ubuntu 20.04 linux-riscv64 image (#3240)
Browse files Browse the repository at this point in the history
* Add Ubuntu 20.04 linux-riscv64 image

It will be used for cross-compilation and testing.

* Fix runs of QEMU playbook check

* Remove mercurial as it's not needed anymore and it's not available on RISC-V

* Remove check for QEMU-playbook-check for QEMU

* Revert part of Github Actions CI check for qemu playbooks

* Add openjdk-11-jdk and openjdk-17-jdk as boot JDK

* Install special JDK 19 for linux-riscv64

This special JDK 19 depends on older GLIBC which is available in Ubuntu
20.04. It's then usable inside a Ubuntu 20.04 container.

* Put back QEMU-playbook-check label check

* Update ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/adoptopenjdk_install/tasks/main.yml

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

* Update roles/docker/main.yml

* Update docker/ubuntu.yml

* Fix erroneous whitespace

* Bump to gcc-10 for riscv64

---------

Co-authored-by: Stewart X Addison <[email protected]>
  • Loading branch information
luhenry and sxa authored Nov 9, 2023
1 parent 2eed41c commit 1486076
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_qemu.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build QEMU
name: QEMU Playbook Checker

on:
pull_request:
Expand All @@ -16,7 +16,7 @@ jobs:
build_job:
if: ${{ github.event.label.name == 'QEMU-playbook-check' }}
# The host should always be linux
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
name: Build on ${{ matrix.distro }} ${{ matrix.arch }}

strategy:
Expand All @@ -30,8 +30,8 @@ jobs:
distro: ubuntu18.04
- arch: s390x
distro: ubuntu18.04
# - arch: riscv64
# distro: ubuntu22.04
- arch: riscv64
distro: ubuntu20.04
# - arch: armv7
# distro: jessie

Expand Down
1 change: 1 addition & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ have at the moment:
| [Centos7](./ansible/docker/Dockerfile.CentOS7) | [`adoptopenjdk/centos7_build_image`](https://hub.docker.com/r/adoptopenjdk/centos7_build_image) | linux on amd64, arm64, ppc64le | [Jenkins](https://ci.adoptium.net/job/centos7_docker_image_updater/) | Yes
| [Centos6](./ansible/docker/Dockerfile.CentOS6) | [`adoptopenjdk/centos6_build_image`](https://hub.docker.com/r/adoptopenjdk/centos6_build_image)| linux/amd64 | [GH Actions](.github/workflows/build.yml) | Yes
| [Alpine3](./ansible/docker/Dockerfile.Alpine3) | [`adoptopenjdk/alpine3_build_image`](https://hub.docker.com/r/adoptopenjdk/alpine3_build_image) | linux/x64 & linux/arm64 | [Jenkins](https://ci.adoptium.net/job/centos7_docker_image_updater/) | Yes
| [Ubuntu 20.04 (riscv64 only)](./ansible/docker/Dockerfile.Ubuntu2004-riscv64) | [`adoptopenjdk/ubuntu2004_build_image:linux-riscv64`](https://hub.docker.com/r/adoptopenjdk/ubuntu2004_build_image) | linux/riscv64 | [Jenkins](https://ci.adoptium.net/job/centos7_docker_image_updater/) | Yes

When a change lands into master, the relevant dockerfiles are built using
the appropriate CI system listed in the table above by configuring them with
Expand Down
8 changes: 8 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ pipeline {
dockerBuild('armv7l', 'ubuntu1604', 'Dockerfile.Ubuntu1604')
}
}
stage('Ubuntu20.04 riscv64') {
agent {
label "docker&&linux&&riscv64"
}
steps {
dockerBuild('riscv64', 'ubuntu2004', 'Dockerfile.Ubuntu2004-riscv64')
}
}
stage('Alpine3 x64') {
agent {
label "dockerBuild&&linux&&x64"
Expand Down
26 changes: 26 additions & 0 deletions ansible/docker/Dockerfile.Ubuntu2004-riscv64
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM riscv64/ubuntu:20.04

ARG user=jenkins

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y install git curl ansible gpg

COPY . /ansible

RUN echo "localhost ansible_connection=local" > /ansible/hosts

RUN set -eux; \
cd /ansible; \
ansible-playbook -i hosts ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml --skip-tags="debug,hosts_file,hostname,adoptopenjdk,jenkins,nagios,superuser,docker,swap_file,crontab,nvidia_cuda_toolkit,ntp_time"

RUN rm -rf /ansible

RUN groupadd -g 1000 ${user}
RUN useradd -c "Jenkins user" -d /home/${user} -u 1000 -g 1000 -m ${user}

ENV \
JDK11_BOOT_DIR="/usr/lib/jvm/java-11-openjdk-riscv64" \
JDK17_BOOT_DIR="/usr/lib/jvm/java-17-openjdk-riscv64" \
JDK19_BOOT_DIR="/usr/lib/jvm/jdk-19" \
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-riscv64"
1 change: 0 additions & 1 deletion ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
when:
- ansible_distribution != "Alpine"
- ansible_distribution != "Solaris"
- ansible_architecture != "riscv64"
tags: build_tools
- role: Nagios_Plugins # AdoptOpenJDK Infrastructure
tags: [nagios_plugins, adoptopenjdk]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@
- ansible_architecture == "aarch64"
tags: build_tools

- name: Install additional build tools for !riscv64
package: "name={{ item }} state=latest"
with_items: "{{ Additional_Build_Tools_not_riscv64 }}"
when:
- ansible_architecture != "riscv64"
tags: build_tools

- name: Install additional build tools for riscv64
package: "name={{ item }} state=latest"
with_items: "{{ Additional_Build_Tools_riscv64 }}"
when:
- ansible_architecture == "riscv64"
tags: build_tools

- name: Install additional build tools for Ubuntu 20 +
package: "name={{ item }} state=latest"
with_items: "{{ Additional_Build_Tools_Ubuntu20 }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Build_Tool_Packages:
- libxtst-dev
- make
- ntp
- openjdk-8-jdk
- pigz
- pkg-config
- systemtap-sdt-dev
Expand Down Expand Up @@ -94,13 +93,22 @@ Additional_Build_Tools_s390x:
Additional_Build_Tools_aarch64:
- libpng-dev

Additional_Build_Tools_not_riscv64:
- openjdk-8-jdk

Additional_Build_Tools_riscv64:
- gcc-10
- g++-10
- openjdk-11-jdk
- openjdk-17-jdk
- libatomic1

Additional_Build_Tools_Ubuntu20:
- cmake
- ccache

Test_Tool_Packages:
- acl
- mercurial
- perl
- xauth
- xvfb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@
- docker-ce
state: latest # TODO: Package installs should not use latest
use: auto # automatic select package manager to use yum, apt and so on
when: ((ansible_distribution == "RedHat" or ansible_distribution == "CentOS") and (ansible_distribution_major_version >= "7")) or (ansible_distribution == "Ubuntu" or ansible_distribution == "Debian")
when: ((ansible_distribution == "RedHat" or ansible_distribution == "CentOS") and (ansible_distribution_major_version >= "7")) or ((ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int < 20) or ansible_distribution == "Debian")

- name: Install default docker on Ubuntu 22+
package:
name:
- docker.io
state: latest # TODO: Package installs should not use latest
use: auto # automatic select package manager to use yum, apt and so on
when: ((ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int >= 20) or ansible_distribution == "Debian")

- name: Install for SLES15 # zypper does not support in package module
include_tasks: sles.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,39 @@
state: present
when:
- ansible_architecture == "x86_64"
- ansible_distribution_major_version | int < 20

- name: Add Docker Repo for Ubuntu s390x
apt_repository:
repo: "deb [arch=s390x] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
when:
- ansible_architecture == "s390x"
- ansible_distribution_major_version | int < 20

- name: Add Docker Repo for Ubuntu ppc64le
apt_repository:
repo: "deb [arch=ppc64el] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
when:
- ansible_architecture == "ppc64le"
- ansible_distribution_major_version | int < 20

- name: Add Docker Repo for Ubuntu aarch64
apt_repository:
repo: "deb [arch=arm64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
when:
- ansible_architecture == "aarch64"
- ansible_distribution_major_version | int < 20

- name: Add Docker Repo for Ubuntu armv7l
apt_repository:
repo: "deb [arch=armhf] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
when:
- ansible_architecture == "armv7l"
- ansible_distribution_major_version | int < 20

- name: Install Docker prerequisites for Ubuntu
apt:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
- ansible_distribution != "MacOSX"
- not ((ansible_distribution == "RedHat" or ansible_distribution == "CentOS") and ansible_distribution_major_version == "6")
- ansible_os_family != "Solaris"
- not (ansible_architecture == "riscv64" and jdk_version == 19) # Linux-riscv64 for JDK 19 is special cased
- adoptopenjdk_installed.rc != 0
tags: adoptopenjdk_install
# Api does not return release information for JDK10
Expand Down Expand Up @@ -172,6 +173,36 @@
path: /tmp/jdk{{ jdk_version }}.tar.gz
state: absent

# JDK 19 on Linux-riscv64 is a special-case because JDK 19 is the first version that supports
# RISC-V. There is also no JDK 19 or 20 available on Ubuntu 20.04 that we can use as boot JDK.
- name: Install JDK {{ jdk_version }} on Linux-riscv64
when:
- ansible_architecture == "riscv64" and jdk_version == 19
- adoptopenjdk_installed.rc != 0
tags: adoptopenjdk_install
# Api does not return release information for JDK10
block:
- name: Download jdk{{ jdk_version }} release (Linux-riscv64)
get_url:
url: https://ci.adoptium.net/userContent/riscv/jdk19u-riscv64-20231107.glib227.tar.gz
dest: /tmp/jdk19.tar.gz
mode: 0440
retries: 3
delay: 5
register: adoptopenjdk_download
until: adoptopenjdk_download is not failed

- name: Install latest jdk{{ jdk_version }} release if one not already installed (Linux-riscv64)
unarchive:
src: /tmp/jdk19.tar.gz
dest: /usr/lib/jvm
remote_src: yes

- name: Remove jdk19.tar.gz (Linux-riscv64)
file:
path: /tmp/jdk19.tar.gz
state: absent

# # CentOS6 needs it's own task so it can use a different python interpreter.
# # See: https://github.com/adoptium/infrastructure/issues/1877
- name: Install latest JDK {{ jdk_version }} release if not already installed (CentOS6)
Expand Down

0 comments on commit 1486076

Please sign in to comment.