Skip to content

Commit

Permalink
Add env files for Kind-in-Prow integration test jobs
Browse files Browse the repository at this point in the history
The existing `test/e2e-tests-kind.env` is specifically for the `PipelineRun` approach. These new files are for running the e2e tests, via `kind`, in Prow.

There are four new env files - one for just the go e2e tests each for `stable` and `alpha`, and one for just the yaml tests each for `stable` and `alpha`.

Additionally, `examples/v1beta1/taskruns/git-volume.yaml` is moved to `examples/v1beta1/taskruns/no-ci/git-volume.yaml`. This is because Kind nodes don't have `git` installed, which is necessary for git volumes to work. Also, `--ignore-path=/product_uuid` has been added to the Kaniko args in `examples/v1beta1/pipelineruns/pipelinerun.yaml` and `test/yamls/v1beta1/pipelineruns/pipelinerun.yaml` to work around an issue with Kaniko multi-stage builds on Kind (GoogleContainerTools/kaniko#2164).

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
  • Loading branch information
abayer authored and tekton-robot committed Jul 14, 2022
1 parent 0cd5e2e commit 6542823
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
3 changes: 2 additions & 1 deletion examples/v1beta1/pipelineruns/pipelinerun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ spec:
default: ""
- name: BUILDER_IMAGE
description: The image on which builds will run
default: gcr.io/kaniko-project/executor:v1.3.0
default: gcr.io/kaniko-project/executor:v1.8.1
- name: baseImage
description: Base image for GoogleContainerTools/skaffold microservice apps
default: BASE=alpine:3.9
Expand All @@ -166,6 +166,7 @@ spec:
- --destination=$(params.IMAGE)
- --oci-layout-path=$(workspaces.source.path)/$(params.CONTEXT)/image-digest
- --build-arg=$(inputs.params.baseImage)
- --ignore-path=/product_uuid # TODO(abayer): Work around Kaniko multi-stage build issues on Kind: https://github.com/GoogleContainerTools/kaniko/issues/2164
# kaniko assumes it is running as root, which means this example fails on platforms
# that default to run containers as random uid (like OpenShift). Adding this securityContext
# makes it explicit that it needs to run as root.
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions test/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scri

function install_pipeline_crd() {
echo ">> Deploying Tekton Pipelines"
ko resolve -R -f config/ \
| sed -e 's%"level": "info"%"level": "debug"%' \
local ko_target="$(mktemp)"
ko resolve -R -f config/ > "${ko_target}" || fail_test "Pipeline image resolve failed"
cat "${ko_target}" | sed -e 's%"level": "info"%"level": "debug"%' \
| sed -e 's%loglevel.controller: "info"%loglevel.controller: "debug"%' \
| sed -e 's%loglevel.webhook: "info"%loglevel.webhook: "debug"%' \
| kubectl apply -R -f - || fail_test "Build pipeline installation failed"
Expand Down
6 changes: 6 additions & 0 deletions test/e2e-tests-kind-prow-alpha.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SKIP_INITIALIZE=true
PIPELINE_FEATURE_GATE=alpha
EMBEDDED_STATUS_GATE=minimal
RUN_YAML_TESTS=true
KO_DOCKER_REPO=registry.local:5000
E2E_GO_TEST_TIMEOUT=40m
5 changes: 5 additions & 0 deletions test/e2e-tests-kind-prow.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SKIP_INITIALIZE=true
PIPELINE_FEATURE_GATE=stable
RUN_YAML_TESTS=true
KO_DOCKER_REPO=registry.local:5000
E2E_GO_TEST_TIMEOUT=40m
9 changes: 7 additions & 2 deletions test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ PIPELINE_FEATURE_GATE=${PIPELINE_FEATURE_GATE:-stable}
EMBEDDED_STATUS_GATE=${EMBEDDED_STATUS_GATE:-full}
SKIP_INITIALIZE=${SKIP_INITIALIZE:="false"}
RUN_YAML_TESTS=${RUN_YAML_TESTS:="true"}
SKIP_GO_E2E_TESTS=${SKIP_GO_E2E_TESTS:="false"}
E2E_GO_TEST_TIMEOUT=${E2E_GO_TEST_TIMEOUT:="20m"}
failed=0

# Script entry point.
Expand Down Expand Up @@ -66,13 +68,16 @@ function set_embedded_status() {
function run_e2e() {
# Run the integration tests
header "Running Go e2e tests"
go_test_e2e -timeout=20m ./test/... || failed=1
# Skip ./test/*.go tests if SKIP_GO_E2E_TESTS == true
if [ "${SKIP_GO_E2E_TESTS}" != "true" ]; then
go_test_e2e -timeout=${E2E_GO_TEST_TIMEOUT} ./test/... || failed=1
fi

# Run these _after_ the integration tests b/c they don't quite work all the way
# and they cause a lot of noise in the logs, making it harder to debug integration
# test failures.
if [ "${RUN_YAML_TESTS}" == "true" ]; then
go_test_e2e -parallel=4 -mod=readonly -tags=examples -timeout=20m ./test/ || failed=1
go_test_e2e -mod=readonly -tags=examples -timeout=${E2E_GO_TEST_TIMEOUT} ./test/ || failed=1
fi
}

Expand Down
5 changes: 4 additions & 1 deletion test/yamls/v1beta1/pipelineruns/pipelinerun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ spec:
default: ""
- name: BUILDER_IMAGE
description: The image on which builds will run
default: gcr.io/kaniko-project/executor:v1.3.0
default: gcr.io/kaniko-project/executor:v1.8.1
- name: baseImage
description: Base image for GoogleContainerTools/skaffold microservice apps
default: BASE=alpine:3.9
Expand All @@ -166,13 +166,16 @@ spec:
- --destination=$(params.IMAGE)
- --oci-layout-path=$(workspaces.source.path)/$(params.CONTEXT)/image-digest
- --build-arg=$(inputs.params.baseImage)
- --ignore-path=/product_uuid # TODO(abayer): Work around Kaniko multi-stage build issues on Kind: https://github.com/GoogleContainerTools/kaniko/issues/2164
# kaniko assumes it is running as root, which means this example fails on platforms
# that default to run containers as random uid (like OpenShift). Adding this securityContext
# makes it explicit that it needs to run as root.
securityContext:
runAsUser: 0
- name: write-digest
workingDir: $(workspaces.source.path)
# TODO(abayer): Using ko:// means we end up rebuilding the image, which can be annoying. Consider alternatives while ensuring
# we're always replacing the ko:// images with ones already built from our source...
image: ko://github.com/tektoncd/pipeline/cmd/imagedigestexporter
# output of imagedigestexport [{"name":"image","digest":"sha256:eed29..660"}]
command: ["/ko-app/imagedigestexporter"]
Expand Down

0 comments on commit 6542823

Please sign in to comment.