Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add operator test for arm64 platform #1959

Merged
merged 12 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/minikube-test-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: bash <(curl -sL https://che-incubator.github.io/chectl/install.sh) --channel=next
- name: Run tests
run: /bin/bash build/scripts/minikube-tests/test-helm.sh
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: artifacts
Expand Down
27 changes: 19 additions & 8 deletions .github/workflows/minikube-test-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023 Red Hat, Inc.
# Copyright (c) 2019-2025 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
Expand All @@ -14,23 +14,34 @@ name: Operator test
on: pull_request
jobs:
operator-on-minikube:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{ matrix.runners }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set arch environment variable
run: |
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
echo arch="amd64" >> $GITHUB_ENV
else
echo arch="arm64" >> $GITHUB_ENV
fi
- name: Start minikube cluster
id: run-minikube
uses: che-incubator/setup-minikube-action@next
with:
minikube-version: v1.29.0
run: |
curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-${{env.arch}}
install minikube-linux-${{env.arch}} /usr/local/bin/minikube && rm minikube-linux-${{env.arch}}
minikube start --vm-driver=docker --addons=ingress --cpus 2 --memory 6500
- name: Install yq
run: sudo pip install yq
- name: Install chectl
run: bash <(curl -sL https://che-incubator.github.io/chectl/install.sh) --channel=next
- name: Run tests
run: /bin/bash build/scripts/minikube-tests/test-operator.sh
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: artifacts
name: artifacts-${{env.arch}}
path: /tmp/artifacts-che
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: /bin/bash build/scripts/minikube-tests/test-upgrade-from-stable-to-next.sh
env:
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: artifacts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: /bin/bash build/scripts/minikube-tests/test-upgrade-from-stable-to-stable.sh
env:
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: artifacts
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/release-next-catalog-and-operator-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ jobs:
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install yq
run: sudo pip install yq
- name: Login to quay.io
Expand All @@ -61,13 +65,22 @@ jobs:
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io
- name: Build catalog source
run: ${GITHUB_WORKSPACE}/build/scripts/olm/release-catalog.sh --channel 'next' --catalog-image quay.io/eclipse/eclipse-che-olm-catalog:next
run: |
${GITHUB_WORKSPACE}/build/scripts/olm/release-catalog.sh \
--channel next \
--image-tool docker \
--platform linux/amd64,linux/arm64,linux/ppc64le \
--catalog-image quay.io/eclipse/eclipse-che-olm-catalog:next
build-catalog-with-digest:
runs-on: ubuntu-22.04
needs: build-operator-image
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install yq
run: sudo pip install yq
- name: Login to quay.io
Expand All @@ -87,5 +100,7 @@ jobs:
${GITHUB_WORKSPACE}/build/scripts/release/addDigests.sh -s $(make csv-path CHANNEL=next) -t next
${GITHUB_WORKSPACE}/build/scripts/olm/release-catalog.sh \
--channel next \
--image-tool docker \
--platform linux/amd64,linux/arm64,linux/ppc64le \
--catalog-image quay.io/eclipse/eclipse-che-olm-catalog:next-digest \
--bundle-image quay.io/eclipse/eclipse-che-olm-bundle:$(make bundle-version CHANNEL=next)-digest
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,11 @@ bundle-build: download-opm ## Build a bundle image
[[ -z "$(BUNDLE_IMG)" ]] && { echo [ERROR] BUNDLE_IMG not defined; exit 1; }

BUNDLE_PATH=$$($(MAKE) bundle-path)
$(IMAGE_TOOL) build -f $${BUNDLE_PATH}/bundle.Dockerfile -t $(BUNDLE_IMG) $${BUNDLE_PATH}
if [[ -z "$(PLATFORMS)" ]]; then
$(IMAGE_TOOL) build -f $${BUNDLE_PATH}/bundle.Dockerfile -t $(BUNDLE_IMG) $${BUNDLE_PATH}
else
$(IMAGE_TOOL) buildx build --platform $(PLATFORMS) -f $${BUNDLE_PATH}/bundle.Dockerfile -t $(BUNDLE_IMG) $${BUNDLE_PATH}
fi

bundle-push: SHELL := /bin/bash
bundle-push: ## Push a bundle image
Expand All @@ -513,7 +517,11 @@ catalog-build: download-opm ## Build a catalog image
[[ -z "$(CATALOG_IMG)" ]] && { echo [ERROR] CATALOG_IMG not defined; exit 1; }

$(OPM) validate olm-catalog/$(CHANNEL)
$(IMAGE_TOOL) build -f olm-catalog/index.Dockerfile -t $(CATALOG_IMG) --build-arg CHANNEL=$(CHANNEL) .
if [[ -z "$(PLATFORMS)" ]]; then
$(IMAGE_TOOL) build -f olm-catalog/index.Dockerfile -t $(CATALOG_IMG) --build-arg CHANNEL=$(CHANNEL) .
else
$(IMAGE_TOOL) buildx build --platform $(PLATFORMS) -f olm-catalog/index.Dockerfile -t $(CATALOG_IMG) --build-arg CHANNEL=$(CHANNEL) .
fi

catalog-push: SHELL := /bin/bash
catalog-push: ## Push a catalog image
Expand Down
10 changes: 5 additions & 5 deletions build/scripts/minikube-tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ spec:
value: https://$(minikube ip).nip.io
- name: OPENVSX_REGISTRY_URL
value: https://open-vsx.org
image: quay.io/che-incubator/che-code:latest
image: quay.io/che-incubator/che-code:next
memoryLimit: 256Mi
memoryRequest: 32Mi
sourceMapping: /projects
Expand Down Expand Up @@ -281,7 +281,7 @@ spec:
value: https://$(minikube ip).nip.io
- name: OPENVSX_REGISTRY_URL
value: https://open-vsx.org
image: quay.io/devfile/universal-developer-image:ubi8-latest
image: quay.io/devfile/universal-developer-image:ubi9-latest
memoryLimit: 1024Mi
memoryRequest: 256Mi
sourceMapping: /projects
Expand Down Expand Up @@ -317,16 +317,16 @@ spec:
components:
- name: tooling-container
container:
image: quay.io/devfile/universal-developer-image:ubi8-latest
image: quay.io/devfile/universal-developer-image:ubi9-latest
cpuLimit: 100m
cpuRequest: 100m
EOF
}

startAndWaitDevWorkspace() {
# pre-pull image for faster workspace startup
minikube image pull quay.io/devfile/universal-developer-image:ubi8-latest
minikube image pull quay.io/che-incubator/che-code:latest
minikube image pull quay.io/devfile/universal-developer-image:ubi9-latest
minikube image pull quay.io/che-incubator/che-code:next

kubectl patch devworkspace ${DEV_WORKSPACE_NAME} -p '{"spec":{"started":true}}' --type=merge -n ${USER_NAMESPACE}
kubectl wait devworkspace ${DEV_WORKSPACE_NAME} -n ${USER_NAMESPACE} --for=jsonpath='{.status.phase}'=Running --timeout=300s
Expand Down
19 changes: 15 additions & 4 deletions build/scripts/olm/release-catalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ init() {
unset CATALOG_IMAGE
unset BUNDLE_IMAGE
unset IMAGE_TOOL
unset PLATFORM

while [[ "$#" -gt 0 ]]; do
case $1 in
'--channel'|'-c') CHANNEL="$2"; shift 1;;
'--catalog-image'|'-i') CATALOG_IMAGE="$2"; shift 1;;
'--bundle-image'|'-b') BUNDLE_IMAGE="$2"; shift 1;;
'--image-tool'|'-t') IMAGE_TOOL="$2"; shift 1;;
'--platform'|'-p') PLATFORM="$2"; shift 1;;
'--force'|'-f') FORCE="true";;
'--help'|'-h') usage; exit;;
esac
Expand All @@ -53,11 +55,12 @@ usage () {
echo "Build and push catalog and bundle images."
echo
echo "Usage:"
echo -e "\t$0 -i CATALOG_IMAGE -c CHANNEL [-o OPERATOR_IMAGE] [-t IMAGE_TOOL]"
echo -e "\t$0 -i CATALOG_IMAGE -c CHANNEL [-t IMAGE_TOOL]"
echo
echo "Options:"
echo -e "\t-i,--catalog-image Catalog image to build"
echo -e "\t-i,--bundle-image Bundle image to build"
echo -e "\t-b,--bundle-image Bundle image to build"
echo -e "\t-p,--platform Target platform for build"
echo -e "\t-c,--channel=next|stable Olm channel to build bundle from"
echo -e "\t-t,--image-tool [default: docker] Image tool"
echo -e "\t-f,--force [default: false] Force to build catalog and bundle images even if bundle already exists in the catalog"
Expand All @@ -76,7 +79,11 @@ build () {
exit 0
else
echo "[INFO] Build and push the new bundle image"
make bundle-build bundle-push CHANNEL="${CHANNEL}" BUNDLE_IMG="${BUNDLE_IMAGE}" IMAGE_TOOL="${IMAGE_TOOL}"
make bundle-build bundle-push \
CHANNEL="${CHANNEL}" \
BUNDLE_IMG="${BUNDLE_IMAGE}" \
IMAGE_TOOL="${IMAGE_TOOL}" \
PLATFORM="${PLATFORM}"

echo "[INFO] Add bundle to the catalog"

Expand All @@ -98,7 +105,11 @@ build () {
fi

echo "[INFO] Build and push the catalog image"
make catalog-build catalog-push CHANNEL="${CHANNEL}" CATALOG_IMG="${CATALOG_IMAGE}" IMAGE_TOOL="${IMAGE_TOOL}"
make catalog-build catalog-push \
CHANNEL="${CHANNEL}" \
CATALOG_IMG="${CATALOG_IMAGE}" \
IMAGE_TOOL="${IMAGE_TOOL}" \
PLATFORM="${PLATFORM}"

make download-addlicense
make license $(make catalog-path CHANNEL="${CHANNEL}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che.v7.97.0-897.next
labels:
operatorframework.io/arch.amd64: supported
operatorframework.io/arch.arm64: supported
operatorframework.io/os.linux: supported
name: eclipse-che.v7.99.0-898.next
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1073,7 +1077,7 @@ spec:
minKubeVersion: 1.19.0
provider:
name: Eclipse Foundation
version: 7.97.0-897.next
version: 7.99.0-898.next
webhookdefinitions:
- admissionReviewVersions:
- v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ metadata:
operatorframework.io/suggested-namespace: openshift-operators
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
labels:
operatorframework.io/arch.amd64: supported
operatorframework.io/arch.arm64: supported
operatorframework.io/os.linux: supported
name: eclipse-che.v0.0.0
namespace: placeholder
spec:
Expand Down
Loading