diff --git a/.github/scripts/configure_versions_script.sh b/.github/scripts/configure_versions_script.sh index c4b8be770..d344582cb 100755 --- a/.github/scripts/configure_versions_script.sh +++ b/.github/scripts/configure_versions_script.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -eo pipefail + # Get current versions ORIG_ANAX_IMAGE_VERSION=$(sed -n 's/export VERSION ?= //p' Makefile | cut -d '$' -f 1 | sed 's/ *$//g') ORIG_CSS_IMAGE_VERSION=$(sed -n 's/CSS_IMAGE_VERSION ?= //p' Makefile | cut -d '$' -f 1 | sed 's/ *$//g') diff --git a/.github/scripts/docker_build_script.sh b/.github/scripts/docker_build_script.sh deleted file mode 100755 index f11b12bfc..000000000 --- a/.github/scripts/docker_build_script.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Makes and pushes arch_cloud-sync-service and arch_edge-sync-service images -if [[ ${arch} == 'amd64' || ${arch} == 'ppc64el' || ${arch} == 'arm64' || ${arch} == 's390x' ]]; then - make ess-docker-image - make css-docker-image -fi - -# Makes and pushes amd64_agbot image -if [[ ${arch} == 'amd64' ]]; then - make agbot-image -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' || ${arch} == 's390x' ]]; then - export USE_DOCKER_BUILDX=true -fi - -make anax-image # Makes and pushes arch_anax -make anax-k8s-image # Makes and pushes arch_anax_k8s -make auto-upgrade-cronjob-k8s-image # Makes and pushes arch_auto-upgrade-cronjob-k8s - -# Outputs created docker images for viewing -echo "**************" -docker images -echo "**************" \ No newline at end of file diff --git a/.github/scripts/docker_push_script.sh b/.github/scripts/docker_push_script.sh deleted file mode 100755 index 1e0320f9d..000000000 --- a/.github/scripts/docker_push_script.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Names of the images created for each architecture -if [[ ${arch} == 'amd64' ]]; then - images=('amd64_agbot' 'amd64_anax' 'amd64_anax_k8s' 'amd64_auto-upgrade-cronjob_k8s' 'amd64_cloud-sync-service' 'amd64_edge-sync-service') -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 -for image in "${images[@]}"; do - if [[ ${GITHUB_REF} == 'refs/heads/master' ]]; then - docker push ${IMAGE_REPO}/${image}:testing - docker tag ${IMAGE_REPO}/${image}:testing ${GITHUB_CONTAINER_REGISTRY}/${image}:testing - docker push ${GITHUB_CONTAINER_REGISTRY}/${image}:testing - else - # append the branch name to testing tags for when we're building older versions of anax for testing - docker tag ${IMAGE_REPO}/${image}:testing ${IMAGE_REPO}/${image}:testing_${GH_BRANCH} - docker push ${IMAGE_REPO}/${image}:testing_${GH_BRANCH} - fi - -done \ No newline at end of file diff --git a/.github/scripts/package_push.sh b/.github/scripts/package_push.sh index 6408bc132..1e46357aa 100755 --- a/.github/scripts/package_push.sh +++ b/.github/scripts/package_push.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -eo pipefail + # Deal with Debian Package First # Make the temp Dockerfile for the debs only tarball image ## Chose alpine:latest b/c of small size, tried FROM scratch but couldn't run container diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 262c2869a..0e617d6a1 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -289,18 +289,65 @@ jobs: # Build Docker Images - name: Build Docker Images + shell: bash if: (matrix.architecture == 'amd64' || matrix.architecture == 'ppc64el' || matrix.architecture == 'arm64' || matrix.architecture == 's390x') - run: | + run: | + # Makes and pushes arch_cloud-sync-service and arch_edge-sync-service images cd ${GOPATH}/src/github.com/${GITHUB_REPOSITORY} - ./.github/scripts/docker_build_script.sh + if [[ ${arch} == 'amd64' || ${arch} == 'ppc64el' || ${arch} == 'arm64' || ${arch} == 's390x' ]]; then + make ess-docker-image + make css-docker-image + fi + + # Makes and pushes amd64_agbot image + if [[ ${arch} == 'amd64' ]]; then + make agbot-image + 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' || ${arch} == 's390x' ]]; then + export USE_DOCKER_BUILDX=true + fi + + make anax-image # Makes and pushes arch_anax + make anax-k8s-image # Makes and pushes arch_anax_k8s + make auto-upgrade-cronjob-k8s-image # Makes and pushes arch_auto-upgrade-cronjob-k8s + + # Outputs created docker images for viewing + echo "**************" + docker images + echo "**************" # Push Docker Images to Dockerhub - name: Push Docker Images + shell: bash 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 + # Names of the images created for each architecture + if [[ ${arch} == 'amd64' ]]; then + images=('amd64_agbot' 'amd64_anax' 'amd64_anax_k8s' 'amd64_auto-upgrade-cronjob_k8s' 'amd64_cloud-sync-service' 'amd64_edge-sync-service') + 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 + for image in "${images[@]}"; do + if [[ ${GITHUB_REF} == 'refs/heads/master' ]]; then + docker push ${IMAGE_REPO}/${image}:testing + docker tag ${IMAGE_REPO}/${image}:testing ${GITHUB_CONTAINER_REGISTRY}/${image}:testing + docker push ${GITHUB_CONTAINER_REGISTRY}/${image}:testing + else + # append the branch name to testing tags for when we're building older versions of anax for testing + docker tag ${IMAGE_REPO}/${image}:testing ${IMAGE_REPO}/${image}:testing_${GH_BRANCH} + docker push ${IMAGE_REPO}/${image}:testing_${GH_BRANCH} + fi + + done # Build our mac packages on a macOS runner mac-build: diff --git a/anax-in-container/Dockerfile.ubi.ppc64el b/anax-in-container/Dockerfile.ubi.ppc64el index 4121fec73..df37a7b21 100644 --- a/anax-in-container/Dockerfile.ubi.ppc64el +++ b/anax-in-container/Dockerfile.ubi.ppc64el @@ -15,7 +15,9 @@ COPY EPEL.repo /etc/yum.repos.d # Install docker cli, which requires tar / gunzip to unpack, then remove tar / gzip packages # Create required directories ARG REQUIRED_RPMS="openssl ca-certificates shadow-utils jq iptables vim-minimal psmisc procps-ng tar gzip" -RUN microdnf update -y --nodocs --setopt=install_weak_deps=0 --disableplugin=subscription-manager \ +RUN microdnf clean all \ + && rm -rf /var/cache/dnf /var/cache/PackageKit \ + && microdnf update -y --nodocs --nobest --setopt=install_weak_deps=0 --disableplugin=subscription-manager \ && microdnf install -y --nodocs --setopt=install_weak_deps=0 --disableplugin=subscription-manager ${REQUIRED_RPMS} \ && curl -4fsSLO https://download.docker.com/linux/static/stable/ppc64le/docker-${DOCKER_VER}.tgz \ && tar xzvf docker-${DOCKER_VER}.tgz --strip 1 -C /usr/bin docker/docker \ diff --git a/anax-in-k8s/Dockerfile.ubi.auto-upgrade-cron.ppc64el b/anax-in-k8s/Dockerfile.ubi.auto-upgrade-cron.ppc64el index 6550d9788..0297c88ac 100644 --- a/anax-in-k8s/Dockerfile.ubi.auto-upgrade-cron.ppc64el +++ b/anax-in-k8s/Dockerfile.ubi.auto-upgrade-cron.ppc64el @@ -13,7 +13,9 @@ COPY EPEL.repo /etc/yum.repos.d # Create required directories # Create cronjobuser ARG REQUIRED_RPMS="shadow-utils jq" -RUN microdnf update -y --nodocs --setopt=install_weak_deps=0 --disableplugin=subscription-manager \ +RUN microdnf clean all \ + && rm -rf /var/cache/dnf /var/cache/PackageKit \ + && microdnf update -y --nodocs --nobest --setopt=install_weak_deps=0 --disableplugin=subscription-manager \ && microdnf install -y --nodocs --setopt=install_weak_deps=0 --disableplugin=subscription-manager ${REQUIRED_RPMS} \ && microdnf clean all --disableplugin=subscription-manager \ && rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* \ diff --git a/anax-in-k8s/Dockerfile.ubi.ppc64el b/anax-in-k8s/Dockerfile.ubi.ppc64el index 04e980555..e966ba966 100644 --- a/anax-in-k8s/Dockerfile.ubi.ppc64el +++ b/anax-in-k8s/Dockerfile.ubi.ppc64el @@ -12,7 +12,9 @@ COPY EPEL.repo /etc/yum.repos.d # anax does not use iptables directly but the github.com/coreos/go-iptables/iptables dependency needs the directory structure # Create required directories ARG REQUIRED_RPMS="openssl ca-certificates shadow-utils jq iptables vim-minimal psmisc procps-ng" -RUN microdnf update -y --nodocs --setopt=install_weak_deps=0 --disableplugin=subscription-manager \ +RUN microdnf clean all \ + && rm -rf /var/cache/dnf /var/cache/PackageKit \ + && microdnf update -y --nodocs --nobest --setopt=install_weak_deps=0 --disableplugin=subscription-manager \ && microdnf install -y --nodocs --setopt=install_weak_deps=0 --disableplugin=subscription-manager ${REQUIRED_RPMS} \ && microdnf clean all --disableplugin=subscription-manager \ && rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* \ diff --git a/ess/image/edge-sync-service-ppc64el/Dockerfile.ubi b/ess/image/edge-sync-service-ppc64el/Dockerfile.ubi index fcf012525..1ca256074 100644 --- a/ess/image/edge-sync-service-ppc64el/Dockerfile.ubi +++ b/ess/image/edge-sync-service-ppc64el/Dockerfile.ubi @@ -5,7 +5,9 @@ LABEL summary="Edge node Model Management System." LABEL description="Provides the edge node side of the Model Management System to be used by the CLI service test tools when also testing object models." # yum is not installed, use microdnf instead -RUN microdnf update -y --nodocs --setopt=install_weak_deps=0 --disableplugin=subscription-manager \ +RUN microdnf clean all \ + && rm -rf /var/cache/dnf /var/cache/PackageKit \ + && microdnf update -y --nodocs --nobest --setopt=install_weak_deps=0 --disableplugin=subscription-manager \ && microdnf install -y --nodocs openssl ca-certificates --setopt=install_weak_deps=0 --disableplugin=subscription-manager \ && microdnf clean all --disableplugin=subscription-manager \ && rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* \