Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "alpha" feature gate tests (integration & examples) to our CI #3917

Merged
merged 1 commit into from May 10, 2021
Merged

Add "alpha" feature gate tests (integration & examples) to our CI #3917

merged 1 commit into from May 10, 2021

Conversation

ghost
Copy link

@ghost ghost commented May 6, 2021

Changes

Fixes #3896

Prior to this commit the integration tests run against PRs were only those for "stable" features.

This PR adds additional integration test runs for "alpha" features as well. test/e2e-scripts.sh now patches the feature-flags ConfigMap before executing integration tests and examples tests, first with "enable-api-fields: stable" and then with "enable-api-fields: alpha".

As part of switching on alpha tests two issues have also been fixed with alpha features:

  1. Sidecar workspaces could collide with existing volumeMounts attached
    to the sidecar if the mountpath of the workspace matched an existing
    volumeMount. This has been fixed by preventing the additional workspace
    volumeMount if one already exists at that mountpath.

  2. Tekton bundles integration tests needed to be updated to account
    for validation errors that are returned when a bundle is invalid.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

Release Notes

Pipelines now e2e tests every commit against both the "stable" and "alpha" feature gates.

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 6, 2021
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 6, 2021
@ghost
Copy link
Author

ghost commented May 6, 2021

/kind misc

@tekton-robot tekton-robot added the kind/misc Categorizes issue or PR as a miscellaneuous one. label May 6, 2021
@ghost ghost changed the title WIP Run our CI under "alpha" feature gate as well as "stable" Add "alpha" feature gate tests (integration & examples) to our CI May 6, 2021
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 6, 2021

// addSidecarVolumeMount adds a volumeMount to the sidecar unless its MountPath would conflict
// with another of the sidecar's existing volume mounts.
func addSidecarVolumeMount(sidecar *v1beta1.Sidecar, volumeMount corev1.VolumeMount) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a bug discovered by running the alpha e2e tests! 😎

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/workspace/apply.go 100.0% 97.4% -2.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/workspace/apply.go 100.0% 97.4% -2.6

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/workspace/apply.go 100.0% 97.4% -2.6

@ghost
Copy link
Author

ghost commented May 7, 2021

@pierretasci the tekton bundles integration tests are now being run as part of our CI (and failing atm). Is this something that should work straight away or is there more setup than just a feature flag required to get them running successfully?

I'm looking into it but wondered if you might immediately know what needs to change.

Here are the error messages:

tektonbundles_test.go:386: Error waiting for PipelineRun to finish with expected error: "hello-world-piplinerun" completed with the wrong reason: CouldntGetPipeline (message: Error retrieving pipeline for pipelinerun arendelle-25kgl/hello-world-piplinerun: error when listing pipelines for pipelineRun hello-world-piplinerun: invalid tekton bundle: 10.39.248.207:5000/tektonbundlesimproperformat:sha256:a4c4d878e0620aa3cfd29500afb032eb2acb8d8c787944673f3df8360541bdac does not contain a dev.tekton.image.name annotation)
    tektonbundles_test.go:274: Error waiting for PipelineRun to finish with expected error: "hello-world-piplinerun" completed with the wrong message: Pipeline arendelle-t6ll4/hello-world-pipeline-dne can't be Run; it contains Tasks that don't exist: Couldn't retrieve Task "hello-world-dne": invalid tekton bundle: registry:sha256:ddad3d7c1e96adf9153f8921a7c9790f880a390163df453be1566e9ef0d546e0 does not contain a dev.tekton.image.apiVersion annotation

Edit after some debugging: Ah ok, I think the failures are expected but we're supposed to receive "not found" errors instead of validation problems like we do here.

@ghost
Copy link
Author

ghost commented May 7, 2021

So it looks like the Resolver.Get() func enforces image compliance before checking that the expected resource exists inside the image. This is the source of the error message at least. What I don't totally understand atm is why the images under test are considered invalid. Both of the failing tests specify dev.tekton.image.name and dev.tekton.image.apiVersion annotations before publishing the image.

OK I get it now. Updated the test/tektonbundles_test.go file.

@pierretasci
Copy link

OK I get it now. Updated the test/tektonbundles_test.go file.

Thanks for fixing tha and sorry for only getting to this message now!

@ghost
Copy link
Author

ghost commented May 7, 2021

All good, thanks for taking a look!

@ghost ghost added this to the Pipelines v0.24 milestone May 7, 2021
@ghost
Copy link
Author

ghost commented May 7, 2021

@afrittoli I've added this to the 0.24 milestone as a late addition so that we're running tests against the "alpha" gate before the release goes live. Since this is so late in the window no problem at all if you want to keep it out of 0.24.0.

@ghost
Copy link
Author

ghost commented May 7, 2021

/test pull-tekton-pipeline-integration-tests

Prior to this commit the integration tests run against PRs
were only those for "stable" features.

This PR adds additional integration test runs for "alpha"
features as well. `test/e2e-scripts.sh` now patches the feature-flags
ConfigMap before executing integration tests and examples tests, first
with "enable-api-fields: stable" and then with "enable-api-fields: alpha".

As part of switching on alpha tests two issues have also been fixed
with alpha features:

1. Sidecar workspaces could collide with existing volumeMounts attached
to the sidecar if the mountpath of the workspace matched an existing
volumeMount. This has been fixed by preventing the additional workspace
volumeMount if one already exists at that mountpath.

2. Tekton bundles integration tests needed to be updated to account
for validation errors that are returned when a bundle is invalid.
@ghost
Copy link
Author

ghost commented May 7, 2021

/test tekton-pipeline-unit-tests

@ghost
Copy link
Author

ghost commented May 7, 2021

Awesome, integration tests are passing with both "stable" and "alpha" flags set. 🎉

@ghost
Copy link
Author

ghost commented May 7, 2021

For the build tests, please see #3922

Comment on lines +55 to +59
set_feature_gate "stable"
run_e2e

set_feature_gate "alpha"
run_e2e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we are running twice the e2e tests now right ? I think, long term, it should be two different job that can run in parallel but maybe the focus should be on using tekton pipelines for the CI before thinking about that 😛

Something I don't see in this PR though, is an example of a test that is gonna be skipped if the "alpha" feature gate is not set (aka if we are running on stable).

@afrittoli
Copy link
Member

So, we are running twice the e2e tests now right ? I think, long term, it should be two different job that can run in parallel but maybe the focus should be on using tekton pipelines for the CI before thinking about that 😛

Indeed, I started working on running CI in kind so that we can run more jobs without using all our available projects. And using Tekton to define the test pipeline.

Something I don't see in this PR though, is an example of a test that is gonna be skipped if the "alpha" feature gate is not set (aka if we are running on stable).

We already have tests in the alpha folder - see in examples/v1beta1/pipelineruns/alpha

@vdemeester
Copy link
Member

Something I don't see in this PR though, is an example of a test that is gonna be skipped if the "alpha" feature gate is not set (aka if we are running on stable).

We already have tests in the alpha folder - see in examples/v1beta1/pipelineruns/alpha

Ah ok, for the examples 👍🏼. But we might have to have some "helpers" on the go e2e tests 🙃

@ghost
Copy link
Author

ghost commented May 10, 2021

Something I don't see in this PR though, is an example of a test that is gonna be skipped if the "alpha" feature gate is not set (aka if we are running on stable).

@vdemeester this sounds like what you're after?

var requireFeatureFlags = requireAnyGate(map[string]string{
"enable-tekton-oci-bundles": "true",
"enable-api-fields": "alpha",
})
// TestTektonBundlesSimpleWorkingExample is an integration test which tests a simple, working Tekton bundle using OCI
// images.
func TestTektonBundlesSimpleWorkingExample(t *testing.T) {
ctx := context.Background()
c, namespace := setup(ctx, t, withRegistry, requireFeatureFlags)

@ghost
Copy link
Author

ghost commented May 10, 2021

Specifically, requireAnyGate is a helper for e2e tests.

@afrittoli
Copy link
Member

/test pull-tekton-pipeline-build-tests

Comment on lines +55 to +56
set_feature_gate "stable"
run_e2e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: it would be nice to be able to check that the controller has "seen" the configuration change before we start the tests. Not sure how, though?

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 10, 2021
@afrittoli
Copy link
Member

Specifically, requireAnyGate is a helper for e2e tests.

Indeed, and we have a TestCustomTask and TestTektonBundles* using it.

@vdemeester
Copy link
Member

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 10, 2021
@tekton-robot tekton-robot merged commit ea9158f into tektoncd:main May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/misc Categorizes issue or PR as a miscellaneuous one. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add enable-api-fields: alpha to pipeline's CI runs
5 participants