-
Notifications
You must be signed in to change notification settings - Fork 122
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
Handle Tekton pipeline level variables #421
Handle Tekton pipeline level variables #421
Conversation
79d2c1c
to
96b27dc
Compare
thanks @jinchihe, can you update this test to include the edge case you have in this PR? You can then run |
96b27dc
to
982169f
Compare
982169f
to
37020f4
Compare
@Tomcli Thanks for your reviewing, I would like to add a new test since that's new features, instead of argo variable replacing. I already added a new tests for the change, and update |
/cc @vincent-pli |
@jinchihe: GitHub didn't allow me to request PR reviews from the following users: vincent-pli. Note that only kubeflow members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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. |
3e30e52
to
e84f188
Compare
Addressed @fenglixa comments, also updated below tests to verify that: |
/lgtm @Tomcli , is this OK to your side? |
it looks good to me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jinchihe -- I just have a few small wording corrections. Otherwise this looks good.
sdk/python/tests/compiler/testdata/tekton_pipeline_variables.py
Outdated
Show resolved
Hide resolved
sdk/python/tests/compiler/testdata/tekton_pipeline_variables.yaml
Outdated
Show resolved
Hide resolved
Nope. |
e84f188
to
c7e7765
Compare
Thanks @ckadner for your reviewing. Addressed your comments. |
Thanks @jinchihe |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fenglixa, jinchihe 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 |
/lgtm |
/feature
Which issue is resolved by this Pull Request:
The PR is going to resolve the problem:
If we used the tekton pipeline level variables, such as
context.pipelineRun.name
orcontext.pipelineRun.namespace
, see detail of tekton variable here .Currently even if we defined those variables in inputs section of components, after compiled by dsl, the variables is not loaded, and only replace value in containerOps. In fact, that's pipeline level variables, we need to pass that by
params
, cannot use ``context.pipelineRun.namespace` in containerOps directly, see the example for details: https://github.com/tektoncd/pipeline/blob/master/examples/v1beta1/pipelineruns/using_context_variables.yamlDescription of your changes:
If there is tekton pipeline level variables in container, then
$(context.pipeline/pipelineRun).*)
to$(params.var_name)
, for example:context.pipelineRun.name
->$(params.pipelineRun-name)
$(context.pipeline/pipelineRun).*)
topipeline_run['spec']['pipelineSpec']['tasks']['params']
$(context.pipeline/pipelineRun).*)
topipeline_run['spec']['pipelineSpec']['tasks']['taskSpec']['params']
The the container can use the variables normally.
Environment tested:
python --version
):tkn version
):kubectl version
):/etc/os-release
):Checklist:
The title for your pull request (PR) should follow our title convention. Learn more about the pull request title convention used in this repository.
PR titles examples:
fix(frontend): fixes empty page. Fixes #1234
Use
fix
to indicate that this PR fixes a bug.feat(backend): configurable service account. Fixes #1234, fixes #1235
Use
feat
to indicate that this PR adds a new feature.chore: set up changelog generation tools
Use
chore
to indicate that this PR makes some changes that users don't need to know.test: fix CI failure. Part of #1234
Use
part of
to indicate that a PR is working on an issue, but shouldn't close the issue when merged.Do you want this pull request (PR) cherry-picked into the current release branch?
If yes, use one of the following options:
cherrypick-approved
label to this PR. The release manager adds this PR to the release branch in a batch update.