Skip to content

Commit

Permalink
🌱 run global ci in PR checks + release pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: David Zager <[email protected]>
  • Loading branch information
djzager committed Nov 13, 2023
1 parent cd93491 commit d4bee28
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 34 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ jobs:
done
docker image inspect quay.io/${{ matrix.projects.image }}:${{ inputs.version }}
test:
name: Test Konveyor
needs: release-components
uses: konveyor/ci/.github/workflows/global-ci-bundle.yml@main
with:
operator: quay.io/konveyor/tackle2-operator:${{ inputs.version }}
tackle_hub: quay.io/konveyor/tackle2-hub:${{ inputs.version }}
keycloack_init: quay.io/konveyor/tackle-keycloak-init:${{ inputs.version }}
tackle_ui: quay.io/konveyor/tackle2-ui:${{ inputs.version }}
addon_admin: quay.io/konveyor/tackle2-addon:${{ inputs.version }}
addon_analyzer: quay.io/konveyor/tackle2-addon-analyzer:${{ inputs.version }}

publish:
name: Build and Push Manifest
needs: release-components
Expand Down
22 changes: 6 additions & 16 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
- main
- 'release-*.*'

env:
IMG: ttl.sh/konveyor-operator-${{ github.sha }}:1h
BUNDLE_IMG: ttl.sh/konveyor-operator-bundle-${{ github.sha }}:1h

jobs:
check-title:
Expand All @@ -21,21 +18,14 @@ jobs:
build-operator:
needs: check-title
runs-on: ubuntu-latest
env:
IMG: ttl.sh/konveyor-operator-${{ github.sha }}:1h
steps:
- uses: actions/checkout@v3
- run: make docker-build docker-push

build-bundle:
run-ci:
needs: build-operator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make bundle bundle-build bundle-push

operator-install:
needs: build-bundle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make start-minikube
- run: OPERATOR_BUNDLE_IMAGE="${BUNDLE_IMG}" make install-tackle
uses: konveyor/ci/.github/workflows/global-ci-bundle.yml@main
with:
operator: ttl.sh/konveyor-operator-${{ github.sha }}:1h
42 changes: 24 additions & 18 deletions hack/install-konveyor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ PATH="${__bin_dir}:${PATH}"
NAMESPACE="${NAMESPACE:-konveyor-tackle}"
OPERATOR_BUNDLE_IMAGE="${OPERATOR_BUNDLE_IMAGE:-quay.io/konveyor/tackle2-operator-bundle:latest}"
TACKLE_CR="${TACKLE_CR:-}"
TIMEOUT="${TIMEOUT:-10m}"

if ! command -v kubectl >/dev/null 2>&1; then
kubectl_bin="${__bin_dir}/kubectl"
Expand All @@ -38,21 +39,36 @@ if ! command -v operator-sdk >/dev/null 2>&1; then
chmod +x "${operator_sdk_bin}"
fi

debug() {
echo "Install Konveyor FAILED!!!"
echo "What follows is some info that may be useful in debugging the failure"

kubectl get namespace "${NAMESPACE}" -o yaml || true
kubectl get --namespace "${NAMESPACE}" all || true
kubectl get --namespace "${NAMESPACE}" -o yaml \
subscriptions.operators.coreos.com,catalogsources.operators.coreos.com,installplans.operators.coreos.com,clusterserviceversions.operators.coreos.com \
|| true
kubectl get --namespace "${NAMESPACE}" -o yaml tackles.tackle.konveyor.io/tackle || true

for pod in $(kubectl get pods -n "${NAMESPACE}" -o jsonpath='{.items[*].metadata.name}'); do
kubectl --namespace "${NAMESPACE}" describe pod "${pod}" || true
done
exit 1
}
trap 'debug' EXIT

run_bundle() {
kubectl auth can-i create namespace --all-namespaces
kubectl create namespace "${NAMESPACE}" || true
operator-sdk run bundle "${OPERATOR_BUNDLE_IMAGE}" --namespace "${NAMESPACE}"
operator-sdk run bundle "${OPERATOR_BUNDLE_IMAGE}" --namespace "${NAMESPACE}" --timeout "${TIMEOUT}"

# If on MacOS, need to install `brew install coreutils` to get `timeout`
timeout 600s bash -c 'until kubectl get customresourcedefinitions.apiextensions.k8s.io tackles.tackle.konveyor.io; do sleep 30; done' \
|| kubectl get subscription --namespace "${NAMESPACE}" -o yaml konveyor-operator # Print subscription details when timed out
timeout 600s bash -c 'until kubectl get customresourcedefinitions.apiextensions.k8s.io tackles.tackle.konveyor.io; do sleep 30; done'
}

install_tackle() {
echo "Waiting for the Tackle CRD to become available"
kubectl wait \
--namespace "${NAMESPACE}" \
--for=condition=established \
kubectl wait --namespace "${NAMESPACE}" --for=condition=established \
customresourcedefinitions.apiextensions.k8s.io/tackles.tackle.konveyor.io

if [ -n "${TACKLE_CR}" ]; then
Expand All @@ -76,25 +92,15 @@ EOF
--namespace "${NAMESPACE}" \
--for=condition=Successful \
--timeout=600s \
tackles.tackle.konveyor.io/tackle \
|| kubectl get \
--namespace "${NAMESPACE}" \
-o yaml \
tackles.tackle.konveyor.io/tackle # Print tackle debug when timed out
tackles.tackle.konveyor.io/tackle

# Now wait for all the tackle deployments
kubectl wait \
--namespace "${NAMESPACE}" \
--selector="app.kubernetes.io/part-of=tackle" \
--for=condition=Available \
--timeout=600s \
deployments.apps \
|| kubectl get \
--namespace "${NAMESPACE}" \
--selector="app.kubernetes.io/part-of=tackle" \
--field-selector=status.phase!=Running \
-o yaml \
pods # Print not running tackle pods when timed out
deployments.apps
}

kubectl get customresourcedefinitions.apiextensions.k8s.io tackles.tackle.konveyor.io || run_bundle
Expand Down

0 comments on commit d4bee28

Please sign in to comment.