Skip to content

Commit

Permalink
chore: Refactoring build/test catalog scripts (#1172)
Browse files Browse the repository at this point in the history
* chore: Refactoring build/test catalog scripts

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha authored Nov 17, 2021
1 parent b4930b5 commit 985fc2f
Show file tree
Hide file tree
Showing 20 changed files with 374 additions and 655 deletions.
2 changes: 1 addition & 1 deletion .ci/cico_updates_openshift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ overrideDefaults() {
}

runTests() {
"${OPERATOR_REPO}"/olm/testUpdate.sh "openshift" "stable" ${NAMESPACE}
"${OPERATOR_REPO}"/olm/testUpdate.sh -p openshift -c stable -i quay.io/eclipse/eclipse-che-openshift-opm-catalog:test -n ${NAMESPACE}
waitEclipseCheDeployed ${LAST_PACKAGE_VERSION}
provisionOAuth
startNewWorkspace
Expand Down
11 changes: 5 additions & 6 deletions .github/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,14 @@ collectDevworkspaceOperatorLogs() {

# Build latest operator image
buildCheOperatorImage() {
#docker build -t "${OPERATOR_IMAGE}" -f Dockerfile .
docker build -t "${OPERATOR_IMAGE}" -f Dockerfile . && docker save "${OPERATOR_IMAGE}" > /tmp/operator.tar
}

buildAndPushCheOperatorImage() {
docker build -t "${OPERATOR_IMAGE}" -f Dockerfile . && docker push "${OPERATOR_IMAGE}"
}


copyCheOperatorImageToMinikube() {
#docker save "${OPERATOR_IMAGE}" | minikube ssh --native-ssh=false -- docker load
eval $(minikube docker-env) && docker load -i /tmp/operator.tar && rm /tmp/operator.tar
Expand Down Expand Up @@ -408,11 +412,6 @@ enableImagePuller() {
kubectl patch checluster/eclipse-che -n ${NAMESPACE} --type=merge -p '{"spec":{"imagePuller":{"enable": true}}}'
}

insecurePrivateDockerRegistry() {
IMAGE_REGISTRY_HOST="127.0.0.1:5000"
export IMAGE_REGISTRY_HOST
}

# Utility to print objects created by Openshift CI automatically
printOlmCheObjects() {
echo -e "[INFO] Operator Group object created in namespace: ${NAMESPACE}"
Expand Down
19 changes: 14 additions & 5 deletions .github/bin/minikube/test-olm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,24 @@ source "${OPERATOR_REPO}/olm/olm.sh"
trap "catchFinish" EXIT SIGINT

runTest() {
local channel=next
local channel
local catalogImage

if [[ $GITHUB_HEAD_REF =~ release$ ]]; then
channel=stable
catalogImage=quay.io/eclipse/eclipse-che-kubernetes-opm-catalog:test
else
# build operator image and push to a local docker registry
export OPERATOR_IMAGE="127.0.0.1:5000/test/operator:test"
buildAndPushCheOperatorImage

# build catalog source
channel=next
catalogImage=127.0.0.1:5000/test/catalog:test
"${OPERATOR_REPO}"/olm/buildCatalog.sh -p kubernetes -c next -i ${catalogImage} -o ${OPERATOR_IMAGE}
fi

export OPERATOR_IMAGE="${IMAGE_REGISTRY_HOST}/operator:test"
source "${OPERATOR_REPO}"/olm/testCatalogSource.sh "kubernetes" ${channel} "${NAMESPACE}"
source "${OPERATOR_REPO}"/olm/testCatalog.sh -p kubernetes -c ${channel} -n ${NAMESPACE} -i ${catalogImage}
startNewWorkspace
waitWorkspaceStart

Expand All @@ -54,6 +65,4 @@ runTest() {
}

initDefaults
installOperatorMarketPlace
insecurePrivateDockerRegistry
runTest
2 changes: 1 addition & 1 deletion .github/bin/minikube/test-stable-olm-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ source "${OPERATOR_REPO}"/.github/bin/common.sh
trap "catchFinish" EXIT SIGINT

runTest() {
"${OPERATOR_REPO}"/olm/testUpdate.sh "kubernetes" "stable" ${NAMESPACE}
"${OPERATOR_REPO}"/olm/testUpdate.sh -p kubernetes -c stable -i quay.io/eclipse/eclipse-che-kubernetes-opm-catalog:test -n ${NAMESPACE}
waitEclipseCheDeployed ${LAST_PACKAGE_VERSION}
startNewWorkspace
waitWorkspaceStart
Expand Down
54 changes: 0 additions & 54 deletions .github/bin/recovery-olm-channels.sh

This file was deleted.

22 changes: 15 additions & 7 deletions .github/workflows/build-catalog-and-bundle-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,18 @@ jobs:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build and push images to quay.io
run: >
${GITHUB_WORKSPACE}/olm/buildAndPushBundleImages.sh -c 'next' -p 'openshift' &&
${GITHUB_WORKSPACE}/olm/buildAndPushBundleImages.sh -c 'next-all-namespaces' -p 'openshift' &&
${GITHUB_WORKSPACE}/olm/buildAndPushBundleImages.sh -c 'next' -p 'kubernetes'
env:
IMAGE_REGISTRY_HOST: quay.io
IMAGE_REGISTRY_USER_NAME: eclipse
run: |
${GITHUB_WORKSPACE}/olm/buildCatalog.sh \
--channel 'next' \
--platform 'openshift' \
--catalog-image quay.io/eclipse/eclipse-che-openshift-opm-catalog:next
${GITHUB_WORKSPACE}/olm/buildCatalog.sh \
--channel 'next' \
--platform 'kubernetes' \
--catalog-image quay.io/eclipse/eclipse-che-kubernetes-opm-catalog:next
${GITHUB_WORKSPACE}/olm/buildCatalog.sh \
--channel 'next-all-namespaces' \
--platform 'openshift' \
--catalog-image quay.io/eclipse/eclipse-che-openshift-opm-catalog:next
2 changes: 1 addition & 1 deletion .github/workflows/minikube-olm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: |
minikube addons enable ingress
# Enable registry and portfward to push images to registry
# Enable registry and port forward to push images to registry
/bin/bash olm/minikube-registry-addon.sh &
- name: Install chectl
run: bash <(curl -sL https://www.eclipse.org/che/chectl/) --channel=next
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/recovery-index-images.yaml

This file was deleted.

89 changes: 66 additions & 23 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,69 @@
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (testCatalogSource.sh) minikube stable",
"name": "Bash-Debug (testCatalog.sh) minikube stable",
"cwd": "${workspaceFolder}/olm",
"program": "${workspaceFolder}/olm/testCatalogSource.sh",
"program": "${workspaceFolder}/olm/testCatalog.sh",
"args": [
"-p",
"kubernetes",
"-c",
"stable",
"che",
"-i",
"quay.io/eclipse/eclipse-che-kubernetes-opm-catalog:test",
"-n",
"eclipse-che",
]
},
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (testCatalogSource.sh) minikube next",
"name": "Bash-Debug (testCatalog.sh) minikube next",
"cwd": "${workspaceFolder}/olm",
"program": "${workspaceFolder}/olm/testCatalogSource.sh",
"program": "${workspaceFolder}/olm/testCatalog.sh",
"args": [
"-p",
"kubernetes",
"-c",
"next",
"che",
"my_catalog"
"-i",
"quay.io/eclipse/eclipse-che-kubernetes-opm-catalog:next",
"-n",
"eclipse-che",
]
},
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (testCatalogSource.sh) openshift next",
"name": "Bash-Debug (testCatalog.sh) openshift next",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/olm/testCatalogSource.sh",
"program": "${workspaceFolder}/olm/testCatalog.sh",
"args": [
"-p",
"openshift",
"-c",
"next",
"che"
"-i",
"quay.io/eclipse/eclipse-che-openshift-opm-catalog:next",
"-n",
"eclipse-che",
]
},
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (testCatalogSource.sh) openshift stable",
"name": "Bash-Debug (testCatalog.sh) openshift stable",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/olm/testCatalogSource.sh",
"program": "${workspaceFolder}/olm/testCatalog.sh",
"args": [
"-p",
"openshift",
"-c",
"stable",
"che"
"-i",
"quay.io/eclipse/eclipse-che-openshift-opm-catalog:test",
"-n",
"eclipse-che",
]
},
{
Expand All @@ -80,9 +99,14 @@
"cwd": "${workspaceFolder}/olm",
"program": "${workspaceFolder}/olm/testUpdate.sh",
"args": [
"-p",
"kubernetes",
"-c",
"stable",
"che"
"-i",
"quay.io/eclipse/eclipse-che-kubernetes-opm-catalog:test",
"-n",
"eclipse-che"
]
},
{
Expand All @@ -92,9 +116,14 @@
"cwd": "${workspaceFolder}/olm",
"program": "${workspaceFolder}/olm/testUpdate.sh",
"args": [
"-p",
"kubernetes",
"-c",
"next",
"che"
"-i",
"quay.io/eclipse/eclipse-che-kubernetes-opm-catalog:next",
"-n",
"eclipse-che"
]
},
{
Expand All @@ -104,9 +133,14 @@
"cwd": "${workspaceFolder}/olm",
"program": "${workspaceFolder}/olm/testUpdate.sh",
"args": [
"-p",
"openshift",
"-c",
"stable",
"che"
"-i",
"quay.io/eclipse/eclipse-che-openshift-opm-catalog:test",
"-n",
"eclipse-che"
]
},
{
Expand All @@ -116,35 +150,44 @@
"cwd": "${workspaceFolder}/olm",
"program": "${workspaceFolder}/olm/testUpdate.sh",
"args": [
"-p",
"openshift",
"-c",
"next",
"che"
"-i",
"quay.io/eclipse/eclipse-che-openshift-opm-catalog:next",
"-n",
"eclipse-che"
]
},
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (buildAndPushBundleImages.sh) Kubernetes platfrom",
"name": "Bash-Debug (buildCatalog.sh) Kubernetes platfrom",
"cwd": "${workspaceFolder}/olm",
"program": "./buildAndPushBundleImages.sh",
"program": "./buildCatalog.sh",
"args": [
"-p",
"kubernetes",
"-c",
"next"
"next",
"-i",
"quay.io/eclipse/eclipse-che-kubernetes-opm-catalog:next"
]
},
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (buildAndPushBundleImages.sh) Openshift platform",
"name": "Bash-Debug (buildCatalog.sh) Openshift platform",
"cwd": "${workspaceFolder}/olm",
"program": "./buildAndPushBundleImages.sh",
"program": "./buildCatalog.sh",
"args": [
"-p",
"openshift",
"-c",
"next"
"next",
"-i",
"quay.io/eclipse/eclipse-che-openshift-opm-catalog:next"
]
},
{
Expand Down
Loading

0 comments on commit 985fc2f

Please sign in to comment.