charts/tools/gate/tekton/300-test.sh
Tin Lam de63cdf6d4 chore(gate): adds and fixes zuul jobs
This patch adds in a tekton zuul job and fixes/adjusts the existing
linting and building, which currently does not perform the advertised
checks. This is the final patch of the chain of patches in order:

0. https://review.opendev.org/#/c/759865/ : tekton-pipelines
1. https://review.opendev.org/#/c/759598/ : tekton-triggers
2. https://review.opendev.org/#/c/759764/ : tektnon-dashboard

Change-Id: Ie7bd9efd42fd13fe8e5e83f290f72ed00ba9dea1
Signed-off-by: Tin Lam <tin@irrational.io>
2020-12-10 16:24:37 +00:00

66 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
set -eux
NS="tekton-pipelines"
function retry {
local n=1
local max=3
local delay=10
while true; do
"$@" && break || {
if [[ $n -lt $max ]]; then
(( n++ ))
sleep $delay
else
echo "failed after $n attempts." >&2
exit 1
fi
}
done
}
kubectl -n $NS apply -f ./tools/gate/tekton/yaml/role-resources/secret.yaml
kubectl -n $NS apply -f ./tools/gate/tekton/yaml/role-resources/serviceaccount.yaml
kubectl -n $NS apply -f ./tools/gate/tekton/yaml/role-resources/clustertriggerbinding-roles
kubectl -n $NS apply -f ./tools/gate/tekton/yaml/role-resources/triggerbinding-roles
retry kubectl -n $NS apply -f ./tools/gate/tekton/yaml/triggertemplates/triggertemplate.yaml
retry kubectl -n $NS apply -f ./tools/gate/tekton/yaml/triggerbindings/triggerbinding.yaml
retry kubectl -n $NS apply -f ./tools/gate/tekton/yaml/triggerbindings/triggerbinding-message.yaml
retry kubectl -n $NS apply -f ./tools/gate/tekton/yaml/eventlisteners/eventlistener.yaml
kubectl -n $NS get svc
kubectl -n $NS get pod
kubectl -n $NS get triggerbinding
kubectl -n $NS get triggertemplate
kubectl -n $NS wait --for=condition=Ready pod --timeout=120s --all
# Install the pipeline
kubectl -n $NS apply -f ./tools/gate/tekton/yaml/example-pipeline.yaml
kubectl -n $NS wait --for=condition=Ready pod --timeout=120s --all
kubectl get po -A
# Trigger the sample github pipeline
SVCIP=$(kubectl -n $NS get svc --no-headers | grep el-listener | awk '{print $3}')
curl -X POST \
http://$SVCIP:8080 \
-H 'Content-Type: application/json' \
-H 'X-Hub-Signature: sha1=2da37dcb9404ff17b714ee7a505c384758ddeb7b' \
-d '{
"repository":
{
"url": "https://github.com/tektoncd/triggers.git"
}
}'
# Ensure the run is successful
kubectl -n $NS wait --for=condition=Succeeded pipelineruns --timeout=120s --all
# Check the pipeline runs
kubectl -n $NS get pipelinerun