Skip to content

Commit

Permalink
OCPBUGS-19853: improve the multiarch ppc64le support
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Cho <jason.cho2@ibm.com>
Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
  • Loading branch information
jcho02 authored and prb112 committed Mar 18, 2024
1 parent 4d60a64 commit 015b08b
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 26 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ARG DNF_LIST="\
libassuan-devel \
wget \
pigz \
procps-ng \
"

#################################################################################
Expand Down
Binary file added test/e2e/artifacts/oc-mirror-ppc64le-dev.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions test/e2e/configs/imageset-config-oci-mirror-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ mirror:
type: okd
graph: false
operators:
- catalog: oci://DATA_TMP/mirror_oci/oc-mirror-dev
- catalog: oci://DATA_TMP/mirror_oci/OCI_CTLG
packages:
- name: baz
minVersion: 1.0.1
maxVersion: 1.0.1
additionalImages:
- name: quay.io/redhatgov/oc-mirror-dev:bar-v0.1.0
- name: quay.io/OCI_REGISTRY_NAMESPACE/oc-mirror-dev:bar-v0.1.0
4 changes: 2 additions & 2 deletions test/e2e/configs/imageset-config-oci-mirror.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ storageConfig:
path: DATA_TMP
mirror:
operators:
- catalog: oci://DATA_TMP/mirror_oci/oc-mirror-dev
targetCatalog: redhatgov/oc-mirror-dev:test-catalog-latest
- catalog: oci://DATA_TMP/mirror_oci/OCI_CTLG
targetCatalog: OCI_REGISTRY_NAMESPACE/oc-mirror-dev:test-catalog-latest
packages:
- name: baz
minVersion: 1.0.1
Expand Down
20 changes: 17 additions & 3 deletions test/e2e/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,25 @@ PUBLISH_DIFF_DIR="${DATA_TMP}/publish_diff"
REGISTRY_CONN_DIR="${DATA_TMP}/conn"
REGISTRY_DISCONN_DIR="${DATA_TMP}/disconn"
MIRROR_OCI_DIR="${DATA_TMP}/mirror_oci"
OCI_CTLG_PATH="oc-mirror-dev.tgz"
WORKSPACE="oc-mirror-workspace"
CATALOGREGISTRY="quay.io"

# Enables overriding for specific architecture payloads (arm64,ppc64le,s390x,x86_64)
CATALOGORG="${ENV_CATALOGORG:-skhoury}"
CATALOGNAMESPACE="${ENV_CATALOGNAMESPACE:-skhoury/oc-mirror-dev}"
# The default is the amd64 catalog, otherwise. Architecture specific tests can pass in the correct value.
CATALOG_ID="${ENV_CATALOG_ID:-86fa1b12}"
OCI_REGISTRY_NAMESPACE="${ENV_OCI_REGISTRY_NAMESPACE:-redhatgov}"
# CATALOG_ARCH is used in subsequent tests to check architecture specific images.
CATALOG_ARCH="$(arch | sed 's|aarch64|arm64|g')"
if [ "${CATALOG_ARCH}" == "x86_64" ]
then
OCI_CTLG_PATH="oc-mirror-dev"
else
OCI_CTLG="oc-mirror-${CATALOG_ARCH}-dev"
OCI_CTLG_PATH="oc-mirror-${CATALOG_ARCH}-dev.tgz"
fi

WORKSPACE="oc-mirror-workspace"
CATALOGREGISTRY="quay.io"
REGISTRY_CONN_PORT=5000
REGISTRY_DISCONN_PORT=5001
METADATA_REGISTRY="localhost.localdomain:$REGISTRY_CONN_PORT"
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/lib/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ function check_bundles() {
# check_images_exists ensures the image(s) is found and pullable.
function check_image_exists() {
local expected_image="${1:?expected image required}"
local CATALOG_ARCH="$(arch | sed 's|aarch64|arm64|g')"
if ! crane digest --insecure --platform linux/${CATALOG_ARCH} $expected_image; then
local exists_arch="${2:-${CATALOG_ARCH}}"
if ! crane digest --insecure --platform linux/${exists_arch} $expected_image; then
echo "image $expected_image not pushed to registry"
return 1
fi
Expand All @@ -111,7 +111,6 @@ function check_sequence_number() {
function check_image_removed() {
local removed_image="${1:?removed image required}"
set -e
local CATALOG_ARCH="$(arch | sed 's|aarch64|arm64|g')"
output=$(crane digest --platform linux/${CATALOG_ARCH} --insecure $removed_image 2>&1) && returncode=$? || returncode=$?
if [[ $returncode != 1 ]]; then
echo "image $removed_image still exists in registry"
Expand Down
9 changes: 6 additions & 3 deletions test/e2e/lib/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ function setup_reg() {
# to the connected registry
function prep_registry() {
local CATALOGTAG="${1:?CATALOGTAG required}"
local CATALOG_ARCH="$(arch | sed 's|aarch64|arm64|g')"
# Copy target catalog to connected registry
crane copy --insecure ${CATALOGREGISTRY}/${CATALOGNAMESPACE}:${CATALOGTAG} \
--platform linux/${CATALOG_ARCH} \
Expand Down Expand Up @@ -187,6 +186,8 @@ function setup_operator_testdata() {
find "$DATA_DIR" -type f -exec sed -i -E 's@TARGET_CATALOG_TAG@'"$TARGET_CATALOG_TAG"'@g' {} \;
find "$DATA_DIR" -type f -exec sed -i -E 's@DATA_TMP@'"$DATA_DIR"'@g' {} \;
find "$DATA_DIR" -type f -exec sed -i -E 's@MIRROR_OCI_DIR@'"$MIRROR_OCI_DIR"'@g' {} \;
find "$DATA_DIR" -type f -exec sed -i -E 's@OCI_REGISTRY_NAMESPACE@'"$OCI_REGISTRY_NAMESPACE"'@g' {} \;
find "$DATA_DIR" -type f -exec sed -i -E 's@CATALOG_ARCH@'"$CATALOG_ARCH"'@g' {} \;
}

# setup_helm_testdata will move required
Expand Down Expand Up @@ -216,7 +217,7 @@ function setup_helm_repository_testdata() {
export HELM_REPOSITORY_CACHE=$DATA_DIR
echo -e "\nSetting up test directory in $DATA_DIR"
mkdir -p "$OUTPUT_DIR"
curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 -o ./helm
curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-${CATALOG_ARCH} -o ./helm
chmod +x ./helm
./helm repo add sbo https://redhat-developer.github.io/service-binding-operator-helm-chart/
cp "${DIR}/configs/${CONFIG_PATH}" "${OUTPUT_DIR}/"
Expand All @@ -242,6 +243,8 @@ function prepare_mirror_testdata() {
find "$DATA_DIR" -type f -exec sed -i -E 's@TARGET_CATALOG_TAG@'"$TARGET_CATALOG_TAG"'@g' {} \;
find "$DATA_DIR" -type f -exec sed -i -E 's@DATA_TMP@'"$DATA_DIR"'@g' {} \;
find "$DATA_DIR" -type f -exec sed -i -E 's@MIRROR_OCI_DIR@'"$MIRROR_OCI_DIR"'@g' {} \;
find "$DATA_DIR" -type f -exec sed -i -E 's@OCI_REGISTRY_NAMESPACE@'"$OCI_REGISTRY_NAMESPACE"'@g' {} \;
find "$DATA_DIR" -type f -exec sed -i -E 's@OCI_CTLG@'"$OCI_CTLG"'@g' {} \;
}

function prepare_oci_testdata() {
Expand All @@ -250,4 +253,4 @@ function prepare_oci_testdata() {
tar xfz "${DIR}/artifacts/${OCI_CTLG_PATH}" -C "${DATA_DIR}/mirror_oci"
mkdir -p "olm_artifacts/oc-mirror-dev"
cp -r "${DIR}/artifacts/configs" "olm_artifacts/oc-mirror-dev/"
}
}
26 changes: 13 additions & 13 deletions test/e2e/testcases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ function pruned_catalogs() {
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:test-catalog-latest \
"bar.v0.1.0 foo.v0.1.1" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:86fa1b12"
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:${CATALOG_ID}"

workflow_diff imageset-config-headsonly.yaml "test-catalog-prune-diff" -c="--source-use-http --source-skip-tls"
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:test-catalog-latest \
"bar.v0.1.0 foo.v0.2.0" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
check_image_removed "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:86fa1b12"
check_image_removed "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:${CATALOG_ID}"
}

# Test heads-only mode with catalogs that prune with a custom target
Expand All @@ -96,13 +96,13 @@ function pruned_catalogs_with_target() {
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGORG}/${TARGET_CATALOG_NAME}:${TARGET_CATALOG_TAG} \
"bar.v0.1.0 foo.v0.1.1" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:86fa1b12"
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:${CATALOG_ID}"

workflow_diff imageset-config-headsonly-newtarget.yaml "test-catalog-prune-diff" -c="--source-use-http --source-skip-tls"
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGORG}/${TARGET_CATALOG_NAME}:${TARGET_CATALOG_TAG} \
"bar.v0.1.0 foo.v0.2.0" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
check_image_removed "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:86fa1b12"
check_image_removed "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:${CATALOG_ID}"
}

# Test heads-only mode with catalogs that prune bundles
Expand All @@ -111,13 +111,13 @@ function pruned_catalogs_with_include() {
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:test-catalog-latest \
"bar.v0.1.0 foo.v0.1.1" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:86fa1b12"
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:${CATALOG_ID}"

workflow_diff imageset-config-filter-multi-prune.yaml "test-catalog-prune-diff" -c="--source-use-http --source-skip-tls"
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:test-catalog-latest \
"bar.v0.1.0 foo.v0.2.0" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
check_image_removed "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:86fa1b12"
check_image_removed "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:${CATALOG_ID}"
}

# Test heads-only mode with catalogs that prune bundles
Expand All @@ -126,13 +126,13 @@ function pruned_catalogs_mirror_to_mirror() {
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:test-catalog-latest \
"bar.v0.1.0 foo.v0.1.1" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:86fa1b12"
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:${CATALOG_ID}"

workflow_mirror2mirror imageset-config-headsonly.yaml "test-catalog-prune-diff" -c="--source-use-http --source-skip-tls"
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:test-catalog-latest \
"bar.v0.1.0 foo.v0.2.0" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
check_image_removed "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:86fa1b12"
check_image_removed "localhost.localdomain:${REGISTRY_DISCONN_PORT}/${CATALOGNAMESPACE}:${CATALOG_ID}"
}

# Test registry backend
Expand Down Expand Up @@ -228,7 +228,7 @@ function skip_deps {
# Test local helm chart
function helm_local {
workflow_helm imageset-config-helm.yaml podinfo-6.0.0.tgz
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/stefanprodan/podinfo:6.0.0"
check_image_exists "localhost.localdomain:${REGISTRY_DISCONN_PORT}/stefanprodan/podinfo:6.0.0" "amd64"
}


Expand Down Expand Up @@ -256,7 +256,7 @@ function no_updates_exist {
function m2m_oci_catalog {
rm -fr olm_artifacts
workflow_m2m_oci_catalog imageset-config-oci-mirror.yaml "docker://localhost.localdomain:${REGISTRY_DISCONN_PORT}" -c="--dest-skip-tls --oci-insecure-signature-policy"
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/redhatgov/oc-mirror-dev:test-catalog-latest \
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${OCI_REGISTRY_NAMESPACE}/oc-mirror-dev:test-catalog-latest \
"baz.v1.0.1" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
}
Expand All @@ -279,7 +279,7 @@ function m2m_release_with_oci_catalog {
workflow_oci_mirror_all imageset-config-oci-mirror-all.yaml "docker://localhost.localdomain:${REGISTRY_DISCONN_PORT}/test-catalog-latest" -c="--dest-skip-tls --oci-insecure-signature-policy"

# use crane digest to verify
crane digest --insecure localhost.localdomain:${REGISTRY_DISCONN_PORT}/test-catalog-latest/redhatgov/oc-mirror-dev:bar-v0.1.0
crane digest --insecure localhost.localdomain:${REGISTRY_DISCONN_PORT}/test-catalog-latest/${OCI_REGISTRY_NAMESPACE}/oc-mirror-dev:bar-v0.1.0
crane digest --insecure localhost.localdomain:${REGISTRY_DISCONN_PORT}/test-catalog-latest/openshift/release-images:alpine-x86_64
crane digest --insecure localhost.localdomain:${REGISTRY_DISCONN_PORT}/test-catalog-latest/openshift/release:alpine-x86_64-alpime

Expand All @@ -294,7 +294,7 @@ function m2m_release_with_oci_catalog {
function m2d2m_oci_catalog() {
rm -fr olm_artifacts
workflow_m2d2m_oci_catalog imageset-config-oci-mirror.yaml "localhost.localdomain:${REGISTRY_DISCONN_PORT}" -c="--source-use-http --source-skip-tls"
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/redhatgov/oc-mirror-dev:test-catalog-latest \
check_bundles localhost.localdomain:${REGISTRY_DISCONN_PORT}/${OCI_REGISTRY_NAMESPACE}/oc-mirror-dev:test-catalog-latest \
"baz.v1.0.1" \
localhost.localdomain:${REGISTRY_DISCONN_PORT}
}
}

0 comments on commit 015b08b

Please sign in to comment.