Skip to content

Commit

Permalink
Support ppc64le (#247)
Browse files Browse the repository at this point in the history
* Support ppc64le builds

* Catch exceptions to try and avoid orphaned containers on gitlab runner

* Allow not defined versions and fix release YAML

* There is no ppc64le amazon 2023 container

* Can't support Ubuntu on ppc64le due to lack of NodeJS options that are new enough

* Update sync script to handle new architectures and also ensure compute gets updates

* Only run non-x86 via schedule
  • Loading branch information
treydock authored Jun 16, 2023
1 parent f507790 commit 29ca154
Show file tree
Hide file tree
Showing 16 changed files with 182 additions and 48 deletions.
39 changes: 36 additions & 3 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 4 * * *'

jobs:
buildbox:
Expand All @@ -21,6 +23,14 @@ jobs:
arch:
- x86_64
- aarch64
- ppc64le
exclude:
- dist: amzn2023
arch: ppc64le
- dist: ubuntu-20.04
arch: ppc64le
- dist: ubuntu-22.04
arch: ppc64le
runs-on: ${{ matrix.os }}
name: Buildbox tests
steps:
Expand Down Expand Up @@ -61,6 +71,7 @@ jobs:
arch:
- x86_64
- aarch64
- ppc64le
package:
- ondemand-release
- ondemand-release-latest
Expand Down Expand Up @@ -102,6 +113,12 @@ jobs:
package: ondemand-release-latest
- arch: aarch64
package: ondemand-compute
- arch: ppc64le
package: ondemand-release
- arch: ppc64le
package: ondemand-release-latest
- arch: ppc64le
package: ondemand-compute
# Times out because very slow
- dist: amzn2023
arch: aarch64
Expand All @@ -110,6 +127,8 @@ jobs:
- dist: amzn2023
arch: aarch64
package: turbovnc
- dist: amzn2023
arch: ppc64le
runs-on: ${{ matrix.os }}
name: Package test package=${{ matrix.package }} dist=${{ matrix.dist }} arch=${{ matrix.arch }}
steps:
Expand All @@ -134,11 +153,12 @@ jobs:
env:
OOD_PACKAGING_DEBUG: 'true'
- name: arch distro
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
run: |
DISTRO=$(echo "${{ matrix.os }}" | sed 's|\-||g')
echo "DISTRO=${DISTRO}" >> $GITHUB_ENV
- name: Build package
if: matrix.arch != 'x86_64'
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.arch }}
Expand Down Expand Up @@ -202,11 +222,12 @@ jobs:
env:
OOD_PACKAGING_DEBUG: 'true'
- name: arch distro
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
run: |
DISTRO=$(echo "${{ matrix.os }}" | sed 's|\-||g')
echo "DISTRO=${DISTRO}" >> $GITHUB_ENV
- name: Build package
if: matrix.arch != 'x86_64'
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.arch }}
Expand Down Expand Up @@ -241,6 +262,7 @@ jobs:
arch:
- x86_64
- aarch64
- ppc64le
package:
- ondemand
include:
Expand All @@ -256,6 +278,15 @@ jobs:
arch: x86_64
os: ubuntu-22.04
package: bc_osc_rstudio_server
exclude:
- dist: amzn2023
arch: aarch64
- dist: amzn2023
arch: ppc64le
- dist: ubuntu-20.04
arch: ppc64le
- dist: ubuntu-22.04
arch: ppc64le
runs-on: ${{ matrix.os }}
name: Package ${{ matrix.package }} dist=${{ matrix.dist }} arch=${{ matrix.arch }}
steps:
Expand All @@ -282,11 +313,12 @@ jobs:
if: matrix.arch == 'x86_64'
run: ./bin/ood_packaging -w ./tmp/work -o ./tmp/output -d ${{ matrix.dist }} -a ${{ matrix.arch }} -V v3.1.0 -T --debug $(pwd)/tmp/${{ matrix.package }}
- name: arch distro
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
run: |
DISTRO=$(echo "${{ matrix.os }}" | sed 's|\-||g')
echo "DISTRO=${DISTRO}" >> $GITHUB_ENV
- name: Build ${{ matrix.package }} package
if: matrix.arch != 'x86_64'
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.arch }}
Expand All @@ -302,6 +334,7 @@ jobs:
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
bundle install
git config --global --add safe.directory $GITHUB_WORKSPACE/tmp/${{ matrix.package }}
./bin/ood_packaging -w ./tmp/work -o ./tmp/output -d ${{ matrix.dist }} -a ${{ matrix.arch }} -V v3.1.0 -T --debug $(pwd)/tmp/${{ matrix.package }}
env: |
OOD_PACKAGING_DEBUG: 'true'
8 changes: 5 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
arch:
- x86_64
- aarch64
- ppc64le
name: Release buildbox
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -49,8 +50,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set version
id: version
run: echo ::set-output name=version::${GITHUB_REF#refs/*/v}
run: |
VERSION=${GITHUB_REF#refs/*/v}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: checkout
uses: actions/checkout@v3
- name: Setup Ruby using Bundler
Expand All @@ -71,4 +73,4 @@ jobs:
- name: Publish gem
run: |
bundle exec rake build
gem push pkg/ood_packaging-${{ steps.version.outputs.version }}.gem
gem push pkg/ood_packaging-${{ env.VERSION }}.gem
43 changes: 29 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ build-image:
parallel:
matrix:
- OOD_PACKAGING_DIST: [el7, el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9, amzn2023, ubuntu-20.04, ubuntu-22.04]
- OOD_PACKAGING_DIST: [el9]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
- OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
- OOD_PACKAGING_DIST: [amzn2023]
OOD_PACKAGING_ARCH: [x86_64, aarch64]

build-ondemand-release:
Expand Down Expand Up @@ -81,8 +85,10 @@ build-ondemand-runtime:
parallel:
matrix:
- OOD_PACKAGING_DIST: [el7, el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
- OOD_PACKAGING_DIST: [el9, amzn2023]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
artifacts:
Expand Down Expand Up @@ -120,9 +126,11 @@ build-passenger:
parallel:
matrix:
- OOD_PACKAGING_DIST: [el7, el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9, ubuntu-20.04, ubuntu-22.04]
- OOD_PACKAGING_DIST: [el9]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
- OOD_PACKAGING_DIST: [ubuntu-20.04, ubuntu-22.04]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
- OOD_PACKAGING_DIST: [amzn2023]
# Amazon aarch64 takes hours so build by hand for now
Expand All @@ -146,7 +154,7 @@ build-sqlite:
parallel:
matrix:
- OOD_PACKAGING_DIST: el7
OOD_PACKAGING_ARCH: [x86_64, aarch64]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
timeout: 2h
artifacts:
Expand All @@ -166,7 +174,7 @@ build-cjose:
parallel:
matrix:
- OOD_PACKAGING_DIST: [el7, el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [amzn2023]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
Expand All @@ -187,7 +195,7 @@ build-mod_auth_openidc:
parallel:
matrix:
- OOD_PACKAGING_DIST: [el7, el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [amzn2023]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
Expand All @@ -208,9 +216,11 @@ build-ondemand_exporter:
parallel:
matrix:
- OOD_PACKAGING_DIST: [el7, el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9, amzn2023]
- OOD_PACKAGING_DIST: [el9]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
- OOD_PACKAGING_DIST: [amzn2023]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
artifacts:
paths:
Expand All @@ -227,6 +237,7 @@ build-ondemand-compute:
script:
- bundle exec rake ood_packaging:package:ondemand-compute[$DIST]
- cp -r tmp/output/$OOD_PACKAGING_DIST-x86_64 tmp/output/$OOD_PACKAGING_DIST-aarch64
- cp -r tmp/output/$OOD_PACKAGING_DIST-x86_64 tmp/output/$OOD_PACKAGING_DIST-ppc64le
parallel:
matrix:
- OOD_PACKAGING_DIST: [el7, el8]
Expand All @@ -249,9 +260,11 @@ build-python-websockify:
parallel:
matrix:
- OOD_PACKAGING_DIST: [el7, el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9, amzn2023]
- OOD_PACKAGING_DIST: [el9]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
- OOD_PACKAGING_DIST: [amzn2023]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
artifacts:
paths:
Expand All @@ -270,9 +283,11 @@ build-turbovnc:
parallel:
matrix:
- OOD_PACKAGING_DIST: [el7, el8]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
OOD_PACKAGING_GPG_PRIVATE_KEY: /systems/osc_certs/gpg/ondemand/ondemand.sec
- OOD_PACKAGING_DIST: [el9, amzn2023]
- OOD_PACKAGING_DIST: [el9]
OOD_PACKAGING_ARCH: [x86_64, aarch64, ppc64le]
- OOD_PACKAGING_DIST: [amzn2023]
OOD_PACKAGING_ARCH: [x86_64, aarch64]
timeout: 3h
artifacts:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
ood_packaging (0.9.0)
ood_packaging (0.10.0)
rake (~> 13.0.1)

GEM
Expand Down
14 changes: 10 additions & 4 deletions lib/ood_packaging/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ def gpg_sign?
end

def version
ENV['VERSION']
ver = ENV['VERSION']
return nil if ver == ''

ver
end

def rpm_version
version.gsub(/^v/, '').split('-', 2)[0]
end

def rpm_release
return nil if version.nil?

v = version.split('-', 2)
return '1' if v.size < 2

Expand All @@ -64,9 +69,10 @@ def deb_chlog_version
end

def rpm_defines
defines = ["--define 'git_tag #{version}'"]
defines.concat ["--define 'package_version #{rpm_version}'"]
defines.concat ["--define 'package_release #{rpm_release}'"]
defines = []
defines.concat ["--define 'git_tag #{version}'"] unless version.nil?
defines.concat ["--define 'package_version #{rpm_version}'"] unless rpm_version.nil?
defines.concat ["--define 'package_release #{rpm_release}'"] unless rpm_release.nil?
defines.concat ["--define 'scl #{config[:scl]}'"] if config[:scl]
defines
end
Expand Down
5 changes: 3 additions & 2 deletions lib/ood_packaging/build_box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class OodPackaging::BuildBox

BASE_IMAGES = {
'el7' => 'centos:7',
'el8' => 'rockylinux/rockylinux:8',
'el8' => 'almalinux:8',
'el9' => 'almalinux:9',
'ubuntu-20.04' => 'ubuntu:20.04',
'ubuntu-22.04' => 'ubuntu:22.04',
Expand All @@ -25,7 +25,8 @@ class OodPackaging::BuildBox

ARCH_PLATFORMS = {
'x86_64' => 'linux/amd64',
'aarch64' => 'linux/arm64'
'aarch64' => 'linux/arm64',
'ppc64le' => 'linux/ppc64le'
}.freeze

def initialize(config = {})
Expand Down
4 changes: 3 additions & 1 deletion lib/ood_packaging/build_box/docker-image/Dockerfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN head -n 13 /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo >> /etc/yum.repos.d/Cent
RUN rm -f /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo /etc/yum.repos.d/CentOS-SCLo-scl.repo
<% elsif dnf? -%>
RUN dnf update -y && dnf clean all && rm -rf /var/cache/dnf/*
RUN dnf install -y dnf-utils <%= dist =~ /^el/ ? 'epel-release' : '' %> langpacks-en glibc-all-langpacks && dnf clean all && rm -rf /var/cache/dnf/*
RUN dnf install -y dnf-utils <%= dist =~ /^el/ ? 'epel-release' : '' %> langpacks-en glibc-langpack-en && dnf clean all && rm -rf /var/cache/dnf/*
<% if dist == 'el8' -%>
RUN dnf config-manager --set-enabled powertools && dnf clean all && rm -rf /var/cache/dnf/*
RUN dnf module enable -y ruby:<%= ruby_version %> nodejs:<%= nodejs_version %> && dnf clean all && rm -rf /var/cache/dnf/*
Expand All @@ -37,8 +37,10 @@ RUN apt update -y && apt install -y apt-transport-https ca-certificates \
init debhelper devscripts dh-make build-essential apt-cudf lintian equivs \
sudo rake wget curl ruby bundler && \
apt clean all -y
<% if arch != 'ppc64le' %>
RUN echo "deb https://deb.nodesource.com/node_<%= nodejs_version %>.x <%= codename %> main" > /etc/apt/sources.list.d/nodesource.list
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/nodesource.gpg
<% end %>
<% end -%>
COPY . /build
RUN /bin/bash /build/install.sh
18 changes: 18 additions & 0 deletions lib/ood_packaging/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,20 @@ def tar!
end
end

# Unused but left in case useful in future
# def handle_signals
# ['QUIT', 'TERM', 'INT'].each do |signal|
# Signal.trap(signal) do
# puts "Caught signal #{signal}, proceeding to kill container".red
# container_kill!
# exit 1
# end
# end
# end

# rubocop:disable Metrics/AbcSize
def run!
# handle_signals
if tar_only?
tar!
return
Expand All @@ -259,13 +272,18 @@ def run!
container_start!
container_exec!(exec_rake)
puts "Build SUCCESS: package=#{package} dist=#{build_box.dist}".green
rescue SignalException => e
puts "Caught signal #{e}, proceeding to kill container".red
container_kill!
exit 1
rescue RuntimeError
puts "Build FAILED package=#{package} dist=#{build_box.dist}".red
raise
ensure
container_attach! if attach?
container_kill! if container_running? && !attach?
end
# rubocop:enable Metrics/AbcSize

def container_running?
cmd = "#{container_runtime} inspect #{container_name} 2>/dev/null 1>/dev/null"
Expand Down
Loading

0 comments on commit 29ca154

Please sign in to comment.