diff --git a/.github/scripts/docker_build_script.sh b/.github/scripts/docker_build_script.sh index b7cb9ef85..f11b12bfc 100755 --- a/.github/scripts/docker_build_script.sh +++ b/.github/scripts/docker_build_script.sh @@ -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 @@ -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 diff --git a/.github/scripts/docker_push_script.sh b/.github/scripts/docker_push_script.sh index 5ca9b2d04..f3f6718d4 100755 --- a/.github/scripts/docker_push_script.sh +++ b/.github/scripts/docker_push_script.sh @@ -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 diff --git a/.github/scripts/package_push.sh b/.github/scripts/package_push.sh index e6d10446d..3c3ec5c2a 100755 --- a/.github/scripts/package_push.sh +++ b/.github/scripts/package_push.sh @@ -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 diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 78100a519..f2c89f717 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -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 @@ -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 @@ -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