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

🌱 run global ci in PR checks #280

Merged
merged 1 commit into from
Nov 15, 2023
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
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
Loading