Merge "chore(tests): refactors test script"
This commit is contained in:
commit
31df1636d8
@ -1,6 +1,6 @@
|
|||||||
{{- define "mutatingwebhookconfiguration-webhook" -}}
|
{{- define "mutatingwebhookconfiguration-webhook" -}}
|
||||||
---
|
---
|
||||||
apiVersion: admissionregistration.k8s.io/v1beta1
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
kind: MutatingWebhookConfiguration
|
kind: MutatingWebhookConfiguration
|
||||||
metadata:
|
metadata:
|
||||||
name: webhook.pipeline.tekton.dev
|
name: webhook.pipeline.tekton.dev
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{- define "validatingwebhookconfiguration-webhook-config" -}}
|
{{- define "validatingwebhookconfiguration-webhook-config" -}}
|
||||||
---
|
---
|
||||||
apiVersion: admissionregistration.k8s.io/v1beta1
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
kind: ValidatingWebhookConfiguration
|
kind: ValidatingWebhookConfiguration
|
||||||
metadata:
|
metadata:
|
||||||
name: config.webhook.pipeline.tekton.dev
|
name: config.webhook.pipeline.tekton.dev
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{- define "validatingwebhookconfiguration-webhook-validation" -}}
|
{{- define "validatingwebhookconfiguration-webhook-validation" -}}
|
||||||
---
|
---
|
||||||
apiVersion: admissionregistration.k8s.io/v1beta1
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
kind: ValidatingWebhookConfiguration
|
kind: ValidatingWebhookConfiguration
|
||||||
metadata:
|
metadata:
|
||||||
name: validation.webhook.pipeline.tekton.dev
|
name: validation.webhook.pipeline.tekton.dev
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{- define "config_validation-triggers" -}}
|
{{- define "config_validation-triggers" -}}
|
||||||
---
|
---
|
||||||
apiVersion: admissionregistration.k8s.io/v1beta1
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
kind: ValidatingWebhookConfiguration
|
kind: ValidatingWebhookConfiguration
|
||||||
metadata:
|
metadata:
|
||||||
name: config.webhook.triggers.tekton.dev
|
name: config.webhook.triggers.tekton.dev
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{- define "webhook-triggers" -}}
|
{{- define "webhook-triggers" -}}
|
||||||
---
|
---
|
||||||
apiVersion: admissionregistration.k8s.io/v1beta1
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
kind: MutatingWebhookConfiguration
|
kind: MutatingWebhookConfiguration
|
||||||
metadata:
|
metadata:
|
||||||
name: webhook.triggers.tekton.dev
|
name: webhook.triggers.tekton.dev
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{- define "webhook_validation-triggers" -}}
|
{{- define "webhook_validation-triggers" -}}
|
||||||
---
|
---
|
||||||
apiVersion: admissionregistration.k8s.io/v1beta1
|
apiVersion: admissionregistration.k8s.io/v1
|
||||||
kind: ValidatingWebhookConfiguration
|
kind: ValidatingWebhookConfiguration
|
||||||
metadata:
|
metadata:
|
||||||
name: validation.webhook.triggers.tekton.dev
|
name: validation.webhook.triggers.tekton.dev
|
||||||
|
5
tools/gate/harbor/300-test.sh
Executable file
5
tools/gate/harbor/300-test.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
helm test harbor -n harbor
|
26
tools/gate/pipelines/run-test.sh
Executable file
26
tools/gate/pipelines/run-test.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
# executes the harbor tests
|
||||||
|
./tools/gate/harbor/300-test.sh
|
||||||
|
|
||||||
|
# executes the tekton tests
|
||||||
|
./tools/gate/tekton/300-test.sh
|
||||||
|
|
||||||
|
# performs AIO integration tests
|
||||||
|
CREDENTIAL="--username=admin --password=Harbor12345"
|
||||||
|
|
||||||
|
# Downloads the cli helm push plugin with chartmuseum
|
||||||
|
helm plugin install https://github.com/chartmuseum/helm-push
|
||||||
|
|
||||||
|
# Downloads a chartmuseum tarball and upload it to a newly created repo in harbor
|
||||||
|
helm repo add stable https://charts.helm.sh/stable
|
||||||
|
helm repo update
|
||||||
|
helm pull stable/chartmuseum
|
||||||
|
|
||||||
|
HARBORIP=$(kubectl -n harbor get svc harbor-harbor-core -ojsonpath='{.spec.clusterIP}')
|
||||||
|
helm repo add myrepo http://$HARBORIP/chartrepo $CREDENTIAL
|
||||||
|
helm push $CREDENTIAL $(ls chartmuseum*.tgz) myrepo
|
||||||
|
helm repo update
|
||||||
|
helm search repo --regexp myrepo/*
|
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
NS="tekton-pipelines"
|
TEKTON_NS="tekton-pipelines"
|
||||||
|
|
||||||
|
# Runs the tekton pipeline trigger test
|
||||||
function retry {
|
function retry {
|
||||||
local n=1
|
local n=1
|
||||||
local max=3
|
local max=5
|
||||||
local delay=10
|
local delay=10
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
@ -22,44 +23,40 @@ function retry {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sleep 60
|
||||||
|
|
||||||
kubectl -n $NS apply -f ./tools/gate/tekton/yaml/role-resources/secret.yaml
|
kubectl -n $TEKTON_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 $TEKTON_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 $TEKTON_NS apply -f ./tools/gate/tekton/yaml/role-resources/clustertriggerbinding-roles
|
||||||
kubectl -n $NS apply -f ./tools/gate/tekton/yaml/role-resources/triggerbinding-roles
|
kubectl -n $TEKTON_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 $TEKTON_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 $TEKTON_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 $TEKTON_NS apply -f ./tools/gate/tekton/yaml/triggerbindings/triggerbinding-message.yaml
|
||||||
retry kubectl -n $NS apply -f ./tools/gate/tekton/yaml/eventlisteners/eventlistener.yaml
|
retry kubectl -n $TEKTON_NS apply -f ./tools/gate/tekton/yaml/eventlisteners/eventlistener.yaml
|
||||||
|
|
||||||
kubectl -n $NS get svc
|
kubectl -n $TEKTON_NS get svc
|
||||||
kubectl -n $NS get pod
|
kubectl -n $TEKTON_NS get pod
|
||||||
kubectl -n $NS get triggerbinding
|
kubectl -n $TEKTON_NS get triggerbinding
|
||||||
kubectl -n $NS get triggertemplate
|
kubectl -n $TEKTON_NS get triggertemplate
|
||||||
|
|
||||||
kubectl -n $NS wait --for=condition=Ready pod --timeout=120s --all
|
kubectl -n $TEKTON_NS wait --for=condition=Ready pod --timeout=120s --all
|
||||||
|
|
||||||
# Install the pipeline
|
# Install the pipeline
|
||||||
kubectl -n $NS apply -f ./tools/gate/tekton/yaml/example-pipeline.yaml
|
kubectl -n $TEKTON_NS apply -f ./tools/gate/tekton/yaml/example-pipeline.yaml
|
||||||
kubectl -n $NS wait --for=condition=Ready pod --timeout=120s --all
|
kubectl -n $TEKTON_NS wait --for=condition=Ready pod --timeout=120s --all
|
||||||
|
|
||||||
kubectl get po -A
|
kubectl get po -A
|
||||||
|
|
||||||
# Trigger the sample github pipeline
|
# Trigger the sample github pipeline
|
||||||
SVCIP=$(kubectl -n $NS get svc --no-headers | grep el-listener | awk '{print $3}')
|
SVCIP=$(kubectl -n $TEKTON_NS get svc --no-headers | grep el-listener | awk '{print $3}')
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
http://$SVCIP:8080 \
|
http://$SVCIP:8080 \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-H 'X-Hub-Signature: sha1=2da37dcb9404ff17b714ee7a505c384758ddeb7b' \
|
-H 'X-Hub-Signature: sha1=2da37dcb9404ff17b714ee7a505c384758ddeb7b' \
|
||||||
-d '{
|
-d '{"repository":{"url": "https://github.com/tektoncd/triggers.git"}}'
|
||||||
"repository":
|
|
||||||
{
|
|
||||||
"url": "https://github.com/tektoncd/triggers.git"
|
|
||||||
}
|
|
||||||
}'
|
|
||||||
|
|
||||||
# Ensure the run is successful
|
# Ensure the run is successful
|
||||||
kubectl -n $NS wait --for=condition=Succeeded pipelineruns --timeout=120s --all
|
kubectl -n $TEKTON_NS wait --for=condition=Succeeded pipelineruns --timeout=120s --all
|
||||||
|
|
||||||
# Check the pipeline runs
|
# Check the pipeline runs
|
||||||
kubectl -n $NS get pipelinerun
|
kubectl -n $TEKTON_NS get pipelinerun
|
||||||
|
121
tools/utils/aio-setup.sh
Executable file
121
tools/utils/aio-setup.sh
Executable file
@ -0,0 +1,121 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
: ${TEKTON_NS:="tekton-pipelines"}
|
||||||
|
: ${HARBOR_NS:="harbor"}
|
||||||
|
: ${LOKI_NS:="loki-stack"}
|
||||||
|
: ${NFS_NS:="nfs"}
|
||||||
|
: ${GRAFANA_NS:="grafana"}
|
||||||
|
: ${CHART_ROOT_PATH:="./charts"}
|
||||||
|
: ${CLONE_REPO:="false"}
|
||||||
|
: ${DEPLOY_K8S:="true"}
|
||||||
|
: ${HARBOR_VERSION:="1.5.2"}
|
||||||
|
|
||||||
|
# ensures we have git
|
||||||
|
sudo -E apt install -y git
|
||||||
|
|
||||||
|
# clones upstream rep
|
||||||
|
if [ $CLONE_REPO == "true" ]; then
|
||||||
|
git clone "https://review.opendev.org/airship/charts" airship-charts
|
||||||
|
cd airship-charts
|
||||||
|
fi
|
||||||
|
|
||||||
|
# deploys k8s locally on machine, this also deploys calico
|
||||||
|
if [ $DEPLOY_K8S == "true" ]; then
|
||||||
|
./tools/gate/deploy-k8s.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
# creates namespaces
|
||||||
|
kubectl create namespace $NFS_NS || true
|
||||||
|
kubectl create namespace $HARBOR_NS || true
|
||||||
|
kubectl create namespace $TEKTON_NS || true
|
||||||
|
kubectl create namespace $GRAFANA_NS || true
|
||||||
|
kubectl create namespace $LOKI_NS || true
|
||||||
|
|
||||||
|
# adds all the necessary repo here and update
|
||||||
|
helm repo add osh https://tarballs.opendev.org/openstack/openstack-helm-infra
|
||||||
|
helm repo add harbor https://helm.goharbor.io
|
||||||
|
helm repo add loki https://grafana.github.io/loki/charts
|
||||||
|
helm repo add grafana https://grafana.github.io/helm-charts
|
||||||
|
helm repo update
|
||||||
|
|
||||||
|
# adds label here so the OSH chart can be target the node
|
||||||
|
kubectl label nodes --all openstack-control-plane=enabled --overwrite
|
||||||
|
|
||||||
|
# deploys nfs
|
||||||
|
helm upgrade --install nfs-provisioner osh/nfs-provisioner \
|
||||||
|
--namespace=$NFS_NS \
|
||||||
|
--set storage.persistentVolumeClaim.size=10Gi \
|
||||||
|
--set storage.persistentVolumeClaim.class_name=nfs-provisioner \
|
||||||
|
${EXTRA_HELM_ARGS_NFS}
|
||||||
|
|
||||||
|
# waits for the pods to get ready
|
||||||
|
kubectl wait --for=condition=ready pod --timeout=600s --all -n $NFS_NS
|
||||||
|
|
||||||
|
# deploys harbor
|
||||||
|
tee /tmp/harbor.yaml << EOF
|
||||||
|
expose:
|
||||||
|
tls:
|
||||||
|
enabled: false
|
||||||
|
internalTLS:
|
||||||
|
enabled: false
|
||||||
|
persistence:
|
||||||
|
persistentVolumeClaim:
|
||||||
|
registry:
|
||||||
|
storageClass: nfs-provisioner
|
||||||
|
chartmuseum:
|
||||||
|
storageClass: nfs-provisioner
|
||||||
|
jobservice:
|
||||||
|
storageClass: nfs-provisioner
|
||||||
|
database:
|
||||||
|
storageClass: nfs-provisioner
|
||||||
|
size: 5Gi
|
||||||
|
redis:
|
||||||
|
storageClass: nfs-provisioner
|
||||||
|
trivy:
|
||||||
|
storageClass: nfs-provisioner
|
||||||
|
EOF
|
||||||
|
|
||||||
|
helm upgrade --install harbor harbor/harbor \
|
||||||
|
--namespace=$HARBOR_NS \
|
||||||
|
--values=/tmp/harbor.yaml \
|
||||||
|
--version=${HARBOR_VERSION} \
|
||||||
|
${EXTRA_HELM_ARGS_HARBOR}
|
||||||
|
|
||||||
|
# deploys tekton
|
||||||
|
tee /tmp/dashboard.yaml << EOF
|
||||||
|
config:
|
||||||
|
args:
|
||||||
|
read_only: true
|
||||||
|
EOF
|
||||||
|
|
||||||
|
helm upgrade --install tekton-pipelines ${CHART_ROOT_PATH}/tekton-pipelines \
|
||||||
|
--namespace=$TEKTON_NS \
|
||||||
|
${EXTRA_HELM_ARGS_TEKTON_PIPELINES}
|
||||||
|
|
||||||
|
helm upgrade --install tekton-triggers ${CHART_ROOT_PATH}/tekton-triggers \
|
||||||
|
--namespace=$TEKTON_NS \
|
||||||
|
${EXTRA_HELM_ARGS_TEKTON_TRIGGERS}
|
||||||
|
|
||||||
|
helm upgrade --install tekton-dashboard ${CHART_ROOT_PATH}/tekton-dashboard \
|
||||||
|
--namespace=$TEKTON_NS \
|
||||||
|
--values=/tmp/dashboard.yaml \
|
||||||
|
${EXTRA_HELM_ARGS_TEKTON_DASHBOARD}
|
||||||
|
|
||||||
|
# waits for the pods to get ready
|
||||||
|
kubectl wait --for=condition=ready pod --timeout=600s --all -n $TEKTON_NS
|
||||||
|
kubectl wait --for=condition=ready pod --timeout=600s --all -n $HARBOR_NS
|
||||||
|
|
||||||
|
# installs grafana and loki from upstream chart
|
||||||
|
helm upgrade --install grafana grafana/grafana \
|
||||||
|
--namespace=$GRAFANA_NS \
|
||||||
|
${EXTRA_HELM_ARGS_GRAFANA}
|
||||||
|
|
||||||
|
helm upgrade --install loki-stack loki/loki-stack \
|
||||||
|
--namespace=$LOKI_NS \
|
||||||
|
${EXTRA_HELM_ARGS_LOKI_STACK}
|
||||||
|
|
||||||
|
# waits for the pods to get ready
|
||||||
|
kubectl wait --for=condition=ready pod --timeout=600s --all -n $GRAFANA_NS
|
||||||
|
kubectl wait --for=condition=ready pod --timeout=600s --all -n $LOKI_NS
|
@ -1,35 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# NOTE(lamt): Runs this script in the root directory of this repo.
|
|
||||||
: ${NAMESPACE:="tekton-pipelines"}
|
|
||||||
: ${CHART_ROOT_PATH:="./charts"}
|
|
||||||
|
|
||||||
# deploys a Kubernetes cluster
|
|
||||||
# ./tools/gate/deploy-k8s.sh
|
|
||||||
|
|
||||||
# creates namespace
|
|
||||||
kubectl create namespace $NAMESPACE || true
|
|
||||||
|
|
||||||
# TODO(lamt): Needs an PV/C provider - NFS
|
|
||||||
|
|
||||||
# deploys harbor
|
|
||||||
helm upgrade --install harbor ${CHART_ROOT_PATH}/harbor \
|
|
||||||
--namespace=$NAMESPACE \
|
|
||||||
${EXTRA_HELM_ARGS_TEKTON_HARBOR}
|
|
||||||
|
|
||||||
# deploys tekton
|
|
||||||
helm upgrade --install tekton-pipelines ${CHART_ROOT_PATH}/tekton-pipelines \
|
|
||||||
--namespace=$NAMESPACE \
|
|
||||||
${EXTRA_HELM_ARGS_TEKTON_PIPELINES}
|
|
||||||
|
|
||||||
helm upgrade --install tekton-triggers ${CHART_ROOT_PATH}/tekton-triggers \
|
|
||||||
--namespace=$NAMESPACE \
|
|
||||||
${EXTRA_HELM_ARGS_TEKTON_TRIGGERS}
|
|
||||||
|
|
||||||
helm upgrade --install tekton-dashboard ${CHART_ROOT_PATH}/tekton-dashboard \
|
|
||||||
--namespace=$NAMESPACE \
|
|
||||||
${EXTRA_HELM_ARGS_TEKTON_DASHBOARD}
|
|
||||||
|
|
||||||
# waits for the pods to get ready
|
|
||||||
kubectl --namespace $NAMESPACE wait --for=condition=ready pod --timeout=600s --all
|
|
23
tools/utils/tekton-cleanup.sh
Executable file
23
tools/utils/tekton-cleanup.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
: ${TEKTON_NS:="tekton-pipelines"}
|
||||||
|
|
||||||
|
tekton_releases=$(helm -n $TEKTON_NS ls -q)
|
||||||
|
if [ -z "$tekton_releases" ]; then
|
||||||
|
echo "no release in $TEKTON_NS found"
|
||||||
|
else
|
||||||
|
for release in $tekton_releases; do
|
||||||
|
helm -n $TEKTON_NS uninstall $release
|
||||||
|
done
|
||||||
|
|
||||||
|
# waits til the resources are cleaned up
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
# helm uninstalls should clean up all the resources, but in the scenarios they are orphaned,
|
||||||
|
# this should attempt to clean it up.
|
||||||
|
for resource in mutatingwebhookconfigurations validatingwebhookconfigurations; do
|
||||||
|
kubectl -n $TEKTON_NS get $resource -o name | awk -F'/' '{print $2}' | grep tekton.dev | xargs -r kubectl -n $TEKTON_NS delete $resource
|
||||||
|
done
|
||||||
|
fi
|
@ -28,10 +28,8 @@
|
|||||||
vars:
|
vars:
|
||||||
collect_kubernetes_logs_namespace: tekton-pipelines
|
collect_kubernetes_logs_namespace: tekton-pipelines
|
||||||
gate_scripts:
|
gate_scripts:
|
||||||
- ./tools/gate/tekton/100-deploy-k8s.sh
|
- ./tools/utils/aio-setup.sh
|
||||||
- ./tools/gate/tekton/200-install.sh
|
- ./tools/gate/pipelines/run-test.sh
|
||||||
- ./tools/gate/tekton/300-test.sh
|
|
||||||
- ./tools/gate/harbor/200-install.sh
|
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: airship-charts-upload-git-mirror
|
name: airship-charts-upload-git-mirror
|
||||||
|
Loading…
x
Reference in New Issue
Block a user