|
| 1 | +--- |
| 2 | +apiVersion: tekton.dev/v1beta1 |
| 3 | +kind: Task |
| 4 | +metadata: |
| 5 | + name: tekton-results-upstream-e2e |
| 6 | +spec: |
| 7 | + params: |
| 8 | + - name: target_branch |
| 9 | + - name: repo_url |
| 10 | + - name: revision |
| 11 | + workspaces: |
| 12 | + - name: source |
| 13 | + - name: kubeconfig-dir |
| 14 | + steps: |
| 15 | + - name: execute-tekton-results-upstream-e2e |
| 16 | + image: quay.io/redhat-pipeline-service/ci-runner:$(params.target_branch) |
| 17 | + workingDir: $(workspaces.source.path) |
| 18 | + env: |
| 19 | + - name: KUBECONFIG |
| 20 | + value: "$(workspaces.kubeconfig-dir.path)/kubeconfig" |
| 21 | + script: | |
| 22 | + #! /usr/bin/env bash |
| 23 | + cd $(workspaces.source.path) |
| 24 | + git clone --no-checkout $(params.repo_url) |
| 25 | + cd tektoncd-results |
| 26 | + git config remote.origin.fetch '+refs/heads/downstream*:refs/remotes/origin/downstream*' |
| 27 | + git fetch origin $(params.revision) |
| 28 | + git checkout $(params.revision) |
| 29 | + export SA_TOKEN_PATH=${SA_TOKEN_PATH:-"/tmp/tekton-results/tokens"} |
| 30 | + export SSL_CERT_PATH=${SSL_CERT_PATH:="/tmp/tekton-results/ssl"} |
| 31 | + mkdir -p ${SA_TOKEN_PATH} ${SSL_CERT_PATH} |
| 32 | + kubectl get secrets tekton-results-tls -n tekton-results --template='{{index .data "tls.crt"}}' | base64 -d > ${SSL_CERT_PATH}/tekton-results-cert.pem |
| 33 | + kubectl get secrets tekton-results-tls -n tekton-results --template='{{index .data "tls.key"}}' | base64 -d > ${SSL_CERT_PATH}/tekton-results-key.pem |
| 34 | + kubectl apply -f ./test/e2e/kustomize/rbac.yaml |
| 35 | + service_accounts=(all-namespaces-read-access single-namespace-read-access) |
| 36 | + for service_account in "${service_accounts[@]}"; do |
| 37 | + kubectl create token "$service_account" > "${SA_TOKEN_PATH}"/"$service_account" |
| 38 | + done |
| 39 | + RESULT_ROUTE=$(kubectl get route tekton-results -n tekton-results --template='{{.spec.host}}') |
| 40 | + cat <<EOF > patch-test-config.patch |
| 41 | + diff --git a/test/e2e/grpc_client.go b/test/e2e/grpc_client.go |
| 42 | + --- a/test/e2e/grpc_client.go |
| 43 | + +++ b/test/e2e/grpc_client.go |
| 44 | + @@ -36,4 +36,4 @@ const ( |
| 45 | + certFile = "tekton-results-cert.pem" |
| 46 | + - apiServerName = "tekton-results-api-service.tekton-pipelines.svc.cluster.local" |
| 47 | + - apiServerAddress = "localhost:50051" |
| 48 | + + apiServerName = "tekton-results-api-service.tekton-results.svc.cluster.local" |
| 49 | + + apiServerAddress = "$RESULT_ROUTE" |
| 50 | + defCertFolder = "/tmp/tekton-results/ssl" |
| 51 | + |
| 52 | + EOF |
| 53 | + git apply patch-test-config.patch |
| 54 | + export CGO_ENABLED=0 |
| 55 | + go test -v -count=1 --tags=e2e ./test/e2e/... |
0 commit comments