fix: possible error when 'stepTemplate' and 'steps' contain the same…
possible error when 'stepTemplate' and 'steps' contain the same env key
Changes
Now, when there is a conflict between the env structure of 'stepTemplate' and 'steps', it will eventually be merged according to the value in 'steps'.
Fixs: #5334
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
- [x] Has Docs included if any changes are user facing
- [x] Has Tests included if any functionality added or changed
- [x] Follows the commit message standard
- [x] Meets the Tekton contributor standards (including functionality, content, code)
- [x] Has a kind label. You can add one by adding a comment on this PR that contains
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep - [x] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
- [x] Release notes contains the string "action required" if the change requires additional action from users switching to the new release
Release Notes
When stepTemplate and steps contain the same env key, they are finally merged into the env in steps.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: cugykw / name: yang kewei (75c8a8a3429db1203328b06382adb40809ef72d9)
Hi @cugykw. Thanks for your PR.
I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/kind bug
/ok-to-test
[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
- ~~pkg/apis/OWNERS~~ [vdemeester]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
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/apis/pipeline/v1beta1/merge.go | 82.4% | 84.6% | 2.3 |
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/apis/pipeline/v1beta1/merge.go | 82.4% | 84.6% | 2.3 |
The pull-tekton-pipeline-build-tests failure (https://prow.tekton.dev/view/gs/tekton-prow/pr-logs/pull/tektoncd_pipeline/5336/pull-tekton-pipeline-build-tests/1560280438541389824#1:build-log.txt%3A153-181) is legit - please run make fmt.
The
pull-tekton-pipeline-build-testsfailure (https://prow.tekton.dev/view/gs/tekton-prow/pr-logs/pull/tektoncd_pipeline/5336/pull-tekton-pipeline-build-tests/1560280438541389824#1:build-log.txt%3A153-181) is legit - please runmake fmt.
thanks, i have fixed
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/apis/pipeline/v1beta1/merge.go | 82.4% | 84.6% | 2.3 |
The
pull-tekton-pipeline-build-testsfailure (https://prow.tekton.dev/view/gs/tekton-prow/pr-logs/pull/tektoncd_pipeline/5336/pull-tekton-pipeline-build-tests/1560280438541389824#1:build-log.txt%3A153-181) is legit - please runmake fmt.
@abayer , please review again, thanks
/assign @abayer @jerop PTAL.
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/apis/pipeline/v1/merge.go | 75.0% | 80.4% | 5.4 |
| pkg/apis/pipeline/v1beta1/merge.go | 82.4% | 84.6% | 2.3 |
/retest
=== RUN TestRealWaiterWaitMissingContent
--- PASS: TestRealWaiterWaitMissingContent (0.02s)
=== RUN TestRealWaiterWaitWithContent
waiter_test.go:134: expected Wait() to have detected a non-zero file size by now
--- FAIL: TestRealWaiterWaitWithContent (0.08s)
=== RUN TestRealWaiterWaitWithErrorWaitfile
--- PASS: TestRealWaiterWaitWithErrorWaitfile (0.00s)
=== RUN TestRealWaiterWaitWithBreakpointOnFailure
--- PASS: TestRealWaiterWaitWithBreakpointOnFailure (0.00s)
FAIL
FAIL github.com/tektoncd/pipeline/cmd/entrypoint 2.482s
func TestRealWaiterWaitWithContent(t *testing.T) {
tmp, err := ioutil.TempFile("", "real_waiter_test_file")
if err != nil {
t.Errorf("error creating temp file: %v", err)
}
defer os.Remove(tmp.Name())
rw := realWaiter{}
doneCh := make(chan struct{})
go func() {
err := rw.setWaitPollingInterval(testWaitPollingInterval).Wait(tmp.Name(), true, false)
if err != nil {
t.Errorf("error waiting on tmp file %q", tmp.Name())
}
close(doneCh)
}()
if err := ioutil.WriteFile(tmp.Name(), []byte("😺"), 0700); err != nil {
t.Errorf("error writing content to temp file: %v", err)
}
delay := time.NewTimer(2 * testWaitPollingInterval)
select {
case <-doneCh:
// Success
case <-delay.C:
t.Errorf("expected Wait() to have detected a non-zero file size by now")
}
}
testWaitPollingInterval set too small?
/ping @Yongxuanzhang
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.
/lifecycle stale
Send feedback to tektoncd/plumbing.
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.
/lifecycle rotten
Send feedback to tektoncd/plumbing.
/remove-lifecycle rotten /test check-pr-has-kind-label
@vdemeester: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:
/test pull-tekton-pipeline-alpha-integration-tests/test pull-tekton-pipeline-beta-integration-tests/test pull-tekton-pipeline-build-tests/test pull-tekton-pipeline-integration-tests/test tekton-pipeline-unit-tests
The following commands are available to trigger optional jobs:
/test pull-tekton-pipeline-go-coverage
Use /test all to run all jobs.
In response to this:
/remove-lifecycle rotten /test check-pr-has-kind-label
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
/test check-pr-has-kind-label
@jerop: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:
/test pull-tekton-pipeline-alpha-integration-tests/test pull-tekton-pipeline-beta-integration-tests/test pull-tekton-pipeline-build-tests/test pull-tekton-pipeline-integration-tests/test tekton-pipeline-unit-tests
The following commands are available to trigger optional jobs:
/test pull-tekton-pipeline-go-coverage
Use /test all to run all jobs.
In response to this:
/test check-pr-has-kind-label
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
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/apis/pipeline/v1/merge.go | 75.0% | 80.4% | 5.4 |
| pkg/apis/pipeline/v1beta1/merge.go | 82.4% | 84.6% | 2.3 |
The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report
| File | Old Coverage | New Coverage | Delta |
|---|---|---|---|
| pkg/apis/pipeline/v1/merge.go | 75.0% | 80.4% | 5.4 |
| pkg/apis/pipeline/v1beta1/merge.go | 82.4% | 84.6% | 2.3 |
[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
- ~~OWNERS~~ [vdemeester]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
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/apis/pipeline/v1/merge.go | 75.0% | 80.4% | 5.4 |
| pkg/apis/pipeline/v1beta1/merge.go | 82.4% | 84.6% | 2.3 |
The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report
| File | Old Coverage | New Coverage | Delta |
|---|---|---|---|
| pkg/apis/pipeline/v1/merge.go | 75.0% | 80.4% | 5.4 |
| pkg/apis/pipeline/v1beta1/merge.go | 82.4% | 84.6% | 2.3 |
@cugykw thank you for this fix and for the patience with reviews 🙏🏾
changes look good to me, only request is to update the documentation for
stepTemplateto indicate how we handle this name conflict - https://github.com/tektoncd/pipeline/blob/main/docs/tasks.md#specifying-a-step-template
@jerop Thanks to you, I tried to update the docs.