Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ubuntu16.04 build dockerfile #2201

Merged
merged 6 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,36 @@ pipeline {
stages {
stage('Docker Build') {
parallel {
stage('Linux x64') {
stage('CentOS7 x64') {
agent {
label "dockerBuild&&linux&&x64"
}
steps {
dockerBuild('amd64')
dockerBuild('amd64', 'centos7', 'Dockerfile.CentOS7')
}
}
stage('Linux aarch64') {
stage('CentOS7 aarch64') {
agent {
label "dockerBuild&&linux&&aarch64"
}
steps {
dockerBuild('arm64')
dockerBuild('arm64', 'centos7', 'Dockerfile.CentOS7')
}
}
stage('Linux ppc64le') {
stage('CentOS7 ppc64le') {
agent {
label "dockerBuild&&linux&&ppc64le"
}
steps {
dockerBuild('ppc64le')
dockerBuild('ppc64le', 'centos7', 'Dockerfile.CentOS7')
}
}
stage('Ubuntu16.04 armv7l') {
agent {
label "docker&&linux&&armv7l"
}
steps {
dockerBuild('armv7l', 'ubuntu1604', 'Dockerfile.Ubuntu1604')
}
}
}
Expand All @@ -43,12 +51,12 @@ pipeline {
}
}

def dockerBuild(architecture) {
def dockerBuild(architecture, distro, dockerfile) {
git poll: false, url: 'https://github.com/adoptium/infrastructure.git'
sh label: '', script: "docker build -t adoptopenjdk/centos7_build_image:linux-$architecture -f ansible/Dockerfile.CentOS7 ."
sh label: '', script: "docker build -t adoptopenjdk/$distro_build_image:linux-$architecture -f ansible/docker/$dockerfile ."
// dockerhub is the ID of the credentials stored in Jenkins
docker.withRegistry('https://index.docker.io/v1/', 'dockerhub') {
sh label: '', script: "docker push adoptopenjdk/centos7_build_image:linux-$architecture"
sh label: '', script: "docker push adoptopenjdk/$distro_build_image:linux-$architecture"
}
}

Expand All @@ -57,6 +65,7 @@ def dockerManifest() {
docker.withRegistry('https://index.docker.io/v1/', 'dockerhub') {
git poll: false, url: 'https://github.com/adoptium/infrastructure.git'
sh '''
# Centos7
export TARGET="adoptopenjdk/centos7_build_image"
AMD64=$TARGET:linux-amd64
ARM64=$TARGET:linux-arm64
Expand All @@ -66,6 +75,12 @@ def dockerManifest() {
docker manifest annotate $TARGET $ARM64 --arch arm64 --os linux
docker manifest annotate $TARGET $PPC64LE --arch ppc64le --os linux
docker manifest push $TARGET
# Ubuntu1604
export TARGET="adoptopenjdk/ubuntu1604_build_image"
ARMV7L=$TARGET:linux-armv7l
docker manifest create $TARGET $ARMV7L
docker manifest annotate $TARGET $ARMV7L --arch armv7l --os linux
docker manifest push $TARGET
'''
}
}
}
40 changes: 40 additions & 0 deletions ansible/docker/Dockerfile.Ubuntu1604
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM ubuntu:16.04

ARG user=jenkins

RUN apt-get update
RUN apt-get -y install python git curl
RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
RUN python2 get-pip.py

# Prereqs for cryptography module. Ubuntu 16 has cryptography
# 1.2.3 in its repos. v3 won't build with ssl102
RUN apt-get -y install python-dev libffi-dev libssl-dev
RUN apt-get -y install gcc
RUN pip install cryptography==2.9.2

RUN pip install ansible

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}
RUN mv /bin/uname /bin/uname.real && echo "/bin/uname.real \$@ | sed 's/aarch64/armv7l/g'" > /bin/uname && chmod 755 /bin/uname

ENV \
JDK7_BOOT_DIR="/usr/lib/jvm/jdk8" \
JDK8_BOOT_DIR="/usr/lib/jvm/jdk8" \
JDK10_BOOT_DIR="/usr/lib/jvm/jdk-10" \
JDK11_BOOT_DIR="/usr/lib/jvm/jdk-11" \
JDK13_BOOT_DIR="/usr/lib/jvm/jdk-13" \
JDK14_BOOT_DIR="/usr/lib/jvm/jdk-14" \
JDKLATEST_BOOT_DIR="/usr/lib/jvm/jdk-14" \
JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk"
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@
- ansible_architecture == "aarch64"
tags: build_tools

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

#########################
# Additional Test Tools #
#########################
Expand All @@ -133,6 +140,13 @@
when:
- ansible_distribution_major_version == "16"

- name: Install additional Packages specific to Ubuntu 16 (Not armv7l)
package: "name={{ item }} state=latest"
with_items: openjdk-7-jdk
when:
- ansible_distribution_major_version == "16"
- ansible_architecture != "armv7l"

- name: Install additional Packages specific to Ubuntu 18
package: "name={{ item }} state=latest"
with_items: "{{ Additional_Packages_Ubuntu18 }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ Additional_Build_Tools_s390x:
Additional_Build_Tools_aarch64:
- libpng-dev

Additional_Build_Tools_armv7l:
- gcc-7 # Needed as pre-built version causes crashes
- g++-7 # Needed as pre-built version causes crashes

Test_Tool_Packages:
- acl
- mercurial
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,51 @@
# gcc_7 #
#########

- name: Check if gcc 7.5 is installed on RHEL/CentOS
- name: Check if gcc 7.5 is installed on RHEL/CentOS/Ubuntu16
shell: /usr/local/gcc/bin/gcc-7.5 --version 2>&1 > /dev/null
ignore_errors: yes
register: gcc7_installed
when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_distribution == "Debian" and ansible_architecture == "armv7l")
when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_architecture == "armv7l" and ((ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16") or ansible_distribution == "Debian"))
tags: gcc_7

- name: Configure gcc75 tarball extension on non-armv7l
set_fact: gccsuffix=.xz
tags: gcc_7
when: ansible_architecture != "armv7l"

- name: Configure gcc75 tarball extension on armv7l
set_fact: gccsuffix=.gz
tags: gcc_7
when: ansible_architecture == "armv7l"

# Unable to check the checksum of the binary as it'll be different for each architecture's tar.xz file
- name: Download AdoptOpenJDK gcc-7.5.0 binary
get_url:
url: https://ci.adoptopenjdk.net/userContent/gcc/gcc750+ccache.{{ ansible_architecture }}.tar.xz
dest: '/tmp/ansible-adoptopenjdk-gcc-7.tar.xz'
url: https://ci.adoptopenjdk.net/userContent/gcc/gcc750+ccache.{{ ansible_architecture }}.tar{{ gccsuffix }}
dest: '/tmp/ansible-adoptopenjdk-gcc-7.tar{{ gccsuffix }}'
force: no
mode: 0644
when:
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_distribution == "Debian" and ansible_architecture == "armv7l")
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_architecture == "armv7l" and ((ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16") or ansible_distribution == "Debian"))
- gcc7_installed.rc != 0
tags: gcc_7

- name: Extract AdoptOpenJDK gcc-7 binary to /usr/local/gcc
unarchive:
src: /tmp/ansible-adoptopenjdk-gcc-7.tar.xz
src: /tmp/ansible-adoptopenjdk-gcc-7.tar{{ gccsuffix }}
dest: /usr/local/
copy: False
when:
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_distribution == "Debian" and ansible_architecture == "armv7l")
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_architecture == "armv7l" and ((ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16") or ansible_distribution == "Debian"))
- gcc7_installed.rc != 0
tags: gcc_7

- name: Remove downloaded gcc 7 binary tarball
file:
path: '/tmp/ansible-adoptopenjdk-gcc-7.tar.xz'
path: '/tmp/ansible-adoptopenjdk-gcc-7.tar{{ gccsuffix }}'
state: absent
when:
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_distribution == "Debian" and ansible_architecture == "armv7l")
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_architecture == "armv7l" and ((ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16") or ansible_distribution == "Debian"))
- gcc7_installed.rc != 0
tags: gcc_7

Expand All @@ -48,7 +58,7 @@
path: /usr/local/bin/ccache
register: ccache_symlink
when:
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_distribution == "Debian" and ansible_architecture == "armv7l")
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_architecture == "armv7l" and ((ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16") or ansible_distribution == "Debian"))
tags: gcc_7

- name: Create symlink for ccache
Expand All @@ -57,6 +67,6 @@
dest: /usr/local/bin/ccache
state: link
when:
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_distribution == "Debian" and ansible_architecture == "armv7l")
- ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "openSUSE" or (ansible_architecture == "armv7l" and ((ansible_distribution == "Ubuntu" and ansible_distribution_major_version == "16") or ansible_distribution == "Debian"))
- not ccache_symlink.stat.exists
tags: gcc_7