Skip to content

Commit

Permalink
Issue #3828 - Feature Request: Add s390x support for Github CI action
Browse files Browse the repository at this point in the history
Signed-off-by: blakep7 <pearsonblake9@gmail.com>
  • Loading branch information
blakep7 committed Jul 27, 2023
1 parent 607cbd2 commit 1ed453c
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/docker_build_script.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Makes and pushes arch_cloud-sync-service and arch_edge-sync-service images
if [[ ${arch} == 'amd64' || ${arch} == 'ppc64el' || ${arch} == 'arm64' ]]; then
if [[ ${arch} == 'amd64' || ${arch} == 'ppc64el' || ${arch} == 'arm64' || ${arch} == 's390x' ]]; then
make ess-docker-image
make css-docker-image
fi
Expand All @@ -12,7 +12,7 @@ if [[ ${arch} == 'amd64' ]]; then
fi

# Specify if we should use buildx for multiarch, github runner is amd64 so we only need this for arm and ppc
if [[ ${arch} == 'arm64' || ${arch} == 'ppc64el' ]]; then
if [[ ${arch} == 'arm64' || ${arch} == 'ppc64el' || ${arch} == 's390x' ]]; then
export USE_DOCKER_BUILDX=true
fi

Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/docker_push_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ elif [[ ${arch} == 'ppc64el' ]]; then
images=('ppc64el_anax' 'ppc64el_anax_k8s' 'ppc64el_auto-upgrade-cronjob_k8s' 'ppc64el_edge-sync-service')
elif [[ ${arch} == 'arm64' ]]; then
images=('arm64_anax' 'arm64_anax_k8s' 'arm64_auto-upgrade-cronjob_k8s' 'arm64_edge-sync-service')
elif [[ ${arch} == 's390x' ]]; then
images=('s390x_anax' 's390x_anax_k8s' 's390x_auto-upgrade-cronjob_k8s' 's390x_edge-sync-service')
fi

# Push those images
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/package_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [[ "$GITHUB_REF" == 'refs/heads/master' ]]; then
fi

# Deal with RPM Package
if [[ ${arch} == 'amd64' || ${arch} == 'ppc64el' ]]; then
if [[ ${arch} == 'amd64' || ${arch} == 'ppc64el' || ${arch} == 's390x' ]]; then

# Make the temp Dockerfile for the RPM only tarball image
touch Dockerfile.rpm.tarball
Expand Down
52 changes: 49 additions & 3 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
# Strategy allows specifying matrix axis(es) that will run for the test
strategy:
matrix:
architecture: ['amd64', 'arm64', 'armhf', 'ppc64el']
architecture: ['amd64', 'arm64', 'armhf', 'ppc64el', 's390x']
platform: ['linux']

# Variables that are available to all steps in the job
Expand Down Expand Up @@ -229,6 +229,52 @@ jobs:
make rpmpkgs
mkdir /home/runner/work/anax/anax/RPMS
cp /root/rpmbuild/RPMS/ppc64le/*.rpm /home/runner/work/anax/anax/RPMS
# Make our s390x RPM packages in docker container to specify architecture
# Comes from open source action: https://github.com/uraimo/run-on-arch-action
## By default this action will bind our $GITHUB_WORKSPACE to $GITHUB_WORKSPACE in the docker container
- name: Make s390x RPM Packages
if: matrix.architecture == 's390x'
uses: uraimo/run-on-arch-action@v2
with:
# Specify container arch and distro
arch: s390x
distro: ubuntu20.04

# Pass necessary env. variables to the new docker container env.
env: |
VERSION: ${{ env.VERSION_NO_BUILD_NUMBER }}
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
GITHUB_REPOSITORY: ${{ github.repository }}
GO_VERSION: ${{ steps.get_go.outputs.GO_VERSION }}
# Specify which shell our commands will use (ubuntu distro so use bash)
shell : /bin/bash

# Install the necessary dependencies needed to make the rpm packages
# apt-get install golang, will get version 1.13 so we have to do it manually
install: |
apt-get update -q -y
apt-get install -q -y build-essential
apt-get install -q -y make
apt-get install -q -y rpm
apt-get install -q -y ca-certificates
apt-get install -q -y wget
apt-get install -q -y sudo
apt-get install -q -y gettext
# Commands that will be ran inside our docker container
run: |
cd /
wget https://go.dev/dl/${GO_VERSION}.linux-s390x.tar.gz
sudo tar -C /usr/local -xf ${GO_VERSION}.linux-s390x.tar.gz
export GOPATH=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
cp -R /home/runner/work/anax/anax/go/src/github.com /usr/local/go/src
cd /usr/local/go/src/github.com/${GITHUB_REPOSITORY}
make rpmpkgs
mkdir /home/runner/work/anax/anax/RPMS
cp /root/rpmbuild/RPMS/s390x/*.rpm /home/runner/work/anax/anax/RPMS
# Create Docker images with only Debs and RPM packages in tar.gz then push to Dockerhub
- name: Push RPM/DEB Packages to Dockerhub
Expand All @@ -238,14 +284,14 @@ jobs:
# Build Docker Images
- name: Build Docker Images
if: (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64')
if: (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64' || matrix.architecture == 's390x')
run: |
cd ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}
./.github/scripts/docker_build_script.sh
# Push Docker Images to Dockerhub
- name: Push Docker Images
if: (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64')
if: (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64' || matrix.architecture == 's390x')
run: |
cd ${GOPATH}/src/github.com/${GITHUB_REPOSITORY}
./.github/scripts/docker_push_script.sh
Expand Down

0 comments on commit 1ed453c

Please sign in to comment.