Skip to content

Commit

Permalink
fix the flakiness
Browse files Browse the repository at this point in the history
  • Loading branch information
xinredhat authored and Roming22 committed Jan 2, 2024
1 parent 1f149f4 commit 80055c5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions .tekton/pipeline/test-pipeline-service-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
name: setup-ci-runner-container
runAfter:
- "deploy-cluster"
retries: 2
params:
- name: target_branch
value: $(params.target_branch)
Expand Down
1 change: 1 addition & 0 deletions .tekton/pipeline/test-pipeline-service-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ spec:
name: setup-ci-runner-container
runAfter:
- "deploy-cluster"
retries: 2
params:
- name: target_branch
value: $(params.target_branch)
Expand Down
10 changes: 9 additions & 1 deletion ci/images/ci-runner/hack/bin/copy-plnsvc-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ set -o pipefail
set -x

echo "Copy source code of pipeline service to the ci-runner container"
kubectl cp "./" "default/ci-runner:/workspace/source"
# kubectl cp "./" "default/ci-runner:/workspace/source"

for _ in {1..10}; do
if kubectl cp "./" "default/ci-runner:/workspace/source"; then
break
fi
echo "Failed to Copy source code of pipeline service to the ci-runner container, retrying ..."
sleep 5
done

echo "Copy sidecar sources to the ci-runner container"
kubectl cp "./ci/images/ci-runner/hack/sidecar" "default/ci-runner:/workspace/sidecar"
Expand Down
7 changes: 5 additions & 2 deletions ci/images/ci-runner/hack/bin/create-ci-runner-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ MANIFEST_DIR=$(
)
kubectl -n default apply -k "$MANIFEST_DIR/sidecar"

kubectl -n default wait pod/ci-runner --for=condition=Ready --timeout=90s
kubectl -n default describe pod/ci-runner
if ! kubectl -n default wait pod/ci-runner --for=condition=Ready --timeout=180s; then
echo "ci-runner is not ready" >&2
kubectl -n default describe pod/ci-runner >&2
exit 1
fi

echo
echo "KUBECONFIG:"
Expand Down
12 changes: 10 additions & 2 deletions ci/images/ci-runner/hack/bin/run-plnsvc-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@ set -x
touch "$PWD/destroy-cluster.txt"

echo "Execute dev_setup.sh script to set up pipeline-service ..."
kubectl -n default exec pod/ci-runner -- \
sh -c "/workspace/sidecar/bin/plnsvc_setup.sh $REPO_URL $REPO_REVISION"
# if the following comand fail, it retries 3 times with 5 seconds sleep
for _ in {1..3}; do
if kubectl -n default exec pod/ci-runner -- \
sh -c "/workspace/sidecar/bin/plnsvc_setup.sh $REPO_URL $REPO_REVISION"; then
break
fi
echo "Failed to execute dev_setup.sh script, retrying ..."
sleep 5
done

7 changes: 6 additions & 1 deletion operator/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
set -o errexit
set -o nounset
set -o pipefail
set -x

usage() {
echo "
Expand Down Expand Up @@ -87,7 +88,11 @@ setup_test() {
}

wait_for_pipeline() {
kubectl wait --for=condition=succeeded "$1" -n "$2" --timeout 300s >"$DEBUG_OUTPUT"
if ! kubectl wait --for=condition=succeeded "$1" -n "$2" --timeout 300s >"$DEBUG_OUTPUT"; then
echo "[ERROR] Pipeline failed to complete successful" >&2
kubectl get pipelineruns "$1" -n "$2" >"$DEBUG_OUTPUT"
exit 1
fi
}

check_pod_security() {
Expand Down

0 comments on commit 80055c5

Please sign in to comment.