From c820bbe1440c50b0fc74267143efa9f85cebdba1 Mon Sep 17 00:00:00 2001 From: Marcos Amorim Date: Mon, 6 Jan 2025 10:16:08 -0500 Subject: [PATCH 1/5] feat(ee-multicloud-public): add multi-platform support for execution environments - Updated `install_binaries.sh` to dynamically detect system architecture (`ARCH`) - Modified OpenShift CLI (`oc`) installation to use RHEL 8 version with architecture-specific tarballs. - Adjusted AWS CLI download URL to include architecture detection. - Added placeholder for Bitwarden CLI installation, as it does not support ARM64 yet. --- .../ee-multicloud-public/install_binaries.sh | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tools/execution_environments/ee-multicloud-public/install_binaries.sh b/tools/execution_environments/ee-multicloud-public/install_binaries.sh index 1afc1e32697..cab37d827bd 100755 --- a/tools/execution_environments/ee-multicloud-public/install_binaries.sh +++ b/tools/execution_environments/ee-multicloud-public/install_binaries.sh @@ -3,19 +3,32 @@ set -ue cd /tmp -# OC +# initArch discovers the architecture for this system. +ARCH=$(uname -m) +case $ARCH in + armv5*) ARCH="armv5";; + armv6*) ARCH="armv6";; + armv7*) ARCH="arm";; + aarch64) ARCH="arm64";; + x86) ARCH="386";; + x86_64) ARCH="amd64";; + i686) ARCH="386";; + i386) ARCH="386";; +esac +# OC +# Install rhel8 version of oc +# https://access.redhat.com/solutions/7077895 version=stable -arch=x86_64 -tarball=openshift-client-linux.tar.gz -url="https://mirror.openshift.com/pub/openshift-v4/${arch}/clients/ocp/${version}/${tarball}" +tarball=openshift-client-linux-${ARCH}-rhel8.tar.gz +url="https://mirror.openshift.com/pub/openshift-v4/${ARCH}/clients/ocp/${version}/${tarball}" curl -s -L "${url}" -o ${tarball} tar xzf ${tarball} install -t /usr/bin oc kubectl rm ${tarball} # Bitwarden - +# DISCLAIMER: BW doesn't support ARM64 yet, so this is just a placeholder url="https://vault.bitwarden.com/download/?app=cli&platform=linux" curl -s -L "${url}" -o bw.zip unzip bw.zip @@ -24,9 +37,8 @@ rm bw bw.zip # AWS CLI - aws_version=2.4.23 -curl -s -L "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${aws_version}.zip" \ +curl -s -L "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m)-${aws_version}.zip" \ -o "awscliv2.zip" unzip awscliv2.zip ./aws/install From 2de38d5918ea5625619a2826a26c5f8aeeeb7f7f Mon Sep 17 00:00:00 2001 From: Marcos Amorim Date: Mon, 6 Jan 2025 10:30:24 -0500 Subject: [PATCH 2/5] Update build-ee workflow adding support for multi arch --- .github/workflows/build-ee.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-ee.yml b/.github/workflows/build-ee.yml index dc680f0b8dc..4cbdbb35fe4 100644 --- a/.github/workflows/build-ee.yml +++ b/.github/workflows/build-ee.yml @@ -39,6 +39,7 @@ jobs: image: ee-multicloud tags: ${{inputs.tag}} ${{ github.sha }} labels: ${{ inputs.labels }} + platforms: linux/amd64,linux/arm64 context: tools/execution_environments/ee-multicloud-public containerfiles: |- tools/execution_environments/ee-multicloud-public/Containerfile From 72fd504fae3059726e9ea396230bf441bcaa5016 Mon Sep 17 00:00:00 2001 From: Marcos Amorim Date: Mon, 6 Jan 2025 11:05:10 -0500 Subject: [PATCH 3/5] Add QEMU setup for multi-platform builds in build-ee.yml - Added QEMU setup using `docker/setup-qemu-action@v2` to enable emulation for multiple architectures. - Installed `qemu` and `binfmt-support` as dependencies to ensure proper handling of multi-platform builds. --- .github/workflows/build-ee.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build-ee.yml b/.github/workflows/build-ee.yml index 4cbdbb35fe4..3ebefa094d0 100644 --- a/.github/workflows/build-ee.yml +++ b/.github/workflows/build-ee.yml @@ -32,6 +32,16 @@ jobs: - uses: actions/setup-python@v4 + - name: Setup QEMU for multi-platform builds + uses: docker/setup-qemu-action@v2 + with: + platforms: all + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y qemu binfmt-support + - name: Buildah Action uses: redhat-actions/buildah-build@v2 id: build-image From d42daf90ff289a88c98afc9db963bdc32d814a2e Mon Sep 17 00:00:00 2001 From: Marcos Amorim Date: Mon, 6 Jan 2025 11:10:17 -0500 Subject: [PATCH 4/5] fix(workflow): adjust QEMU setup order for multi-platform builds in build-ee.yml - Added a step to install `qemu` and `binfmt-support` before setting up QEMU. --- .github/workflows/build-ee.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-ee.yml b/.github/workflows/build-ee.yml index 3ebefa094d0..91d1daf46c1 100644 --- a/.github/workflows/build-ee.yml +++ b/.github/workflows/build-ee.yml @@ -32,16 +32,16 @@ jobs: - uses: actions/setup-python@v4 - - name: Setup QEMU for multi-platform builds - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y qemu binfmt-support + - name: Setup QEMU for multi-platform builds + uses: docker/setup-qemu-action@v2 + with: + platforms: all + - name: Buildah Action uses: redhat-actions/buildah-build@v2 id: build-image From 868f5294f69bf3a9cf9ada2bca52fdf1ef15b505 Mon Sep 17 00:00:00 2001 From: Marcos Amorim Date: Mon, 6 Jan 2025 12:35:43 -0500 Subject: [PATCH 5/5] add cache for Buildah layers in GitHub Actions - Configures cache for `/var/lib/containers/storage` using `actions/cache@v4`. - Implements keys to reuse layers from previous builds. - Enables layer reuse in Buildah with `layers: true`. --- .github/workflows/build-ee.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build-ee.yml b/.github/workflows/build-ee.yml index 91d1daf46c1..cabf1f501b8 100644 --- a/.github/workflows/build-ee.yml +++ b/.github/workflows/build-ee.yml @@ -42,6 +42,14 @@ jobs: with: platforms: all + - name: Cache Buildah layers + uses: actions/cache@v4 + with: + path: /var/lib/containers/storage + key: ${{ runner.os }}-buildah-cache-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildah-cache- + - name: Buildah Action uses: redhat-actions/buildah-build@v2 id: build-image @@ -53,6 +61,7 @@ jobs: context: tools/execution_environments/ee-multicloud-public containerfiles: |- tools/execution_environments/ee-multicloud-public/Containerfile + layers: true - name: Push To quay.io id: push-to-quay