Pipeline was a pass-through wrapping one Task — unnecessary indirection. CI now creates TaskRun directly against the integration-test Task.
This commit is contained in:
+12
-11
@@ -72,30 +72,30 @@ jobs:
|
|||||||
RUN_NAME="integration-test-${SHA}"
|
RUN_NAME="integration-test-${SHA}"
|
||||||
|
|
||||||
# Clean up any previous run with the same name
|
# Clean up any previous run with the same name
|
||||||
kubectl delete pipelinerun "${RUN_NAME}" -n api --ignore-not-found
|
kubectl delete taskrun "${RUN_NAME}" -n api --ignore-not-found
|
||||||
|
|
||||||
# Create PipelineRun — spins up gateway sidecar + curl tests
|
# Create TaskRun — spins up gateway sidecar + curl tests
|
||||||
cat <<YAML | kubectl create -f -
|
cat <<YAML | kubectl create -f -
|
||||||
apiVersion: tekton.dev/v1
|
apiVersion: tekton.dev/v1
|
||||||
kind: PipelineRun
|
kind: TaskRun
|
||||||
metadata:
|
metadata:
|
||||||
name: ${RUN_NAME}
|
name: ${RUN_NAME}
|
||||||
namespace: api
|
namespace: api
|
||||||
labels:
|
labels:
|
||||||
commit-sha: "${SHA}"
|
commit-sha: "${SHA}"
|
||||||
spec:
|
spec:
|
||||||
pipelineRef:
|
taskRef:
|
||||||
name: integration-test-pipeline
|
name: integration-test
|
||||||
params:
|
params:
|
||||||
- name: image
|
- name: image
|
||||||
value: "${IMAGE}:${SHA}"
|
value: "${IMAGE}:${SHA}"
|
||||||
YAML
|
YAML
|
||||||
|
|
||||||
echo "✓ PipelineRun created: ${RUN_NAME}"
|
echo "✓ TaskRun created: ${RUN_NAME}"
|
||||||
|
|
||||||
# Wait for completion (Succeeded or Failed)
|
# Wait for completion (Succeeded or Failed)
|
||||||
echo "Waiting for tests (timeout 5m)..."
|
echo "Waiting for tests (timeout 5m)..."
|
||||||
if kubectl wait pipelinerun/"${RUN_NAME}" -n api \
|
if kubectl wait taskrun/"${RUN_NAME}" -n api \
|
||||||
--for=condition=Succeeded --timeout=5m 2>/dev/null; then
|
--for=condition=Succeeded --timeout=5m 2>/dev/null; then
|
||||||
echo "result=pass" >> $GITHUB_OUTPUT
|
echo "result=pass" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
@@ -105,12 +105,13 @@ jobs:
|
|||||||
# Print logs + results
|
# Print logs + results
|
||||||
echo ""
|
echo ""
|
||||||
echo "=== Test Logs ==="
|
echo "=== Test Logs ==="
|
||||||
kubectl logs -n api "pipelinerun/${RUN_NAME}" --all-containers 2>/dev/null || true
|
POD=$(kubectl get pod -n api -l tekton.dev/taskRun=${RUN_NAME} -o name | head -1)
|
||||||
|
kubectl logs -n api "${POD}" -c step-run-tests 2>/dev/null || true
|
||||||
echo ""
|
echo ""
|
||||||
REASON=$(kubectl get pipelinerun "${RUN_NAME}" -n api \
|
REASON=$(kubectl get taskrun "${RUN_NAME}" -n api \
|
||||||
-o jsonpath='{.status.conditions[0].reason}')
|
-o jsonpath='{.status.conditions[0].reason}')
|
||||||
SUMMARY=$(kubectl get pipelinerun "${RUN_NAME}" -n api \
|
SUMMARY=$(kubectl get taskrun "${RUN_NAME}" -n api \
|
||||||
-o jsonpath='{.status.results[?(@.name=="test-summary")].value}')
|
-o jsonpath='{.status.results[?(@.name=="summary")].value}')
|
||||||
echo "Status: ${REASON}"
|
echo "Status: ${REASON}"
|
||||||
echo "Summary: ${SUMMARY}"
|
echo "Summary: ${SUMMARY}"
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,9 @@ metadata:
|
|||||||
name: ci-tekton-trigger
|
name: ci-tekton-trigger
|
||||||
namespace: api
|
namespace: api
|
||||||
rules:
|
rules:
|
||||||
- apiGroups: ["tekton.dev"]
|
|
||||||
resources: ["pipelineruns"]
|
|
||||||
verbs: ["create", "get", "list", "watch", "delete"]
|
|
||||||
- apiGroups: ["tekton.dev"]
|
- apiGroups: ["tekton.dev"]
|
||||||
resources: ["taskruns"]
|
resources: ["taskruns"]
|
||||||
verbs: ["get", "list"]
|
verbs: ["create", "get", "list", "watch", "delete"]
|
||||||
- apiGroups: [""]
|
- apiGroups: [""]
|
||||||
resources: ["pods", "pods/log"]
|
resources: ["pods", "pods/log"]
|
||||||
verbs: ["get", "list"]
|
verbs: ["get", "list"]
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ namespace: api
|
|||||||
resources:
|
resources:
|
||||||
- ci-rbac.yaml
|
- ci-rbac.yaml
|
||||||
- task-integration-test.yaml
|
- task-integration-test.yaml
|
||||||
- pipeline-integration-test.yaml
|
|
||||||
|
|
||||||
generatorOptions:
|
generatorOptions:
|
||||||
disableNameSuffixHash: true
|
disableNameSuffixHash: true
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
apiVersion: tekton.dev/v1
|
|
||||||
kind: Pipeline
|
|
||||||
metadata:
|
|
||||||
name: integration-test-pipeline
|
|
||||||
namespace: api
|
|
||||||
labels:
|
|
||||||
app: api-gateway
|
|
||||||
component: testing
|
|
||||||
spec:
|
|
||||||
description: >
|
|
||||||
Run integration tests against a gateway image.
|
|
||||||
Spins up the image as a sidecar, tests via curl, reports pass/fail.
|
|
||||||
params:
|
|
||||||
- name: image
|
|
||||||
type: string
|
|
||||||
description: "Container image to test (repo:sha)"
|
|
||||||
results:
|
|
||||||
- name: test-result
|
|
||||||
description: "pass or fail"
|
|
||||||
value: $(tasks.integration-test.results.result)
|
|
||||||
- name: test-summary
|
|
||||||
description: "e.g. 8/8 passed"
|
|
||||||
value: $(tasks.integration-test.results.summary)
|
|
||||||
tasks:
|
|
||||||
- name: integration-test
|
|
||||||
taskRef:
|
|
||||||
name: integration-test
|
|
||||||
params:
|
|
||||||
- name: image
|
|
||||||
value: $(params.image)
|
|
||||||
Reference in New Issue
Block a user