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 more dynamic variables #396

Closed
skv-patrik opened this issue Jan 5, 2022 · 3 comments · Fixed by #541
Closed

Add more dynamic variables #396

skv-patrik opened this issue Jan 5, 2022 · 3 comments · Fixed by #541
Assignees

Comments

@skv-patrik
Copy link

Four dynamic variables are available at the moment:

  • {{repo_owner}}
  • {{repo_name}}
  • {{repo_url}}
  • {{revision}}

When doing tasks like sonarscanner you need variables like pull request number, git base reference branch and git head reference branch in your pull_request.yaml (these parameters are stored in /tmp/payload.json)

It would be great if these variables also were available as dynamic variables. E.g.

  • {{pull_request_number}}
  • {{{pull_request_base_ref}}
  • {{{pull_request_head_ref}}
@chmouel
Copy link
Member

chmouel commented Jan 5, 2022

@skv-patrik the idea at first is that only the variable that are common to pull and push is exposed, we only expose the absolute necessary because we dont want to "diverge" too much from tekton/kubernetes templates.

I am not against it, and I did find myself in need of them, so I think those could be exposed when we are doing a pull request.

we support other type of VCS as well and those needs to be mapped properly.

@chmouel
Copy link
Member

chmouel commented Jan 5, 2022

I have added an issue in our backlog https://issues.redhat.com/browse/SRVKP-1946

@chmouel chmouel self-assigned this Apr 8, 2022
chmouel added a commit to chmouel/pipelines-as-code that referenced this issue Apr 8, 2022
Only expanded on Pull/Merge requests. But maybe we want to change that
to be expanded as "" if we have pr matching push and pull and not having
some weird caracters showing if we use it.

Fixes openshift-pipelines#396

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
chmouel added a commit to chmouel/pipelines-as-code that referenced this issue Apr 8, 2022
Only expanded on Pull/Merge requests. But maybe we want to change that
to be expanded as "" if we have pr matching push and pull and not having
some weird caracters showing if we use it.

Fixes openshift-pipelines#396

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@chmouel
Copy link
Member

chmouel commented Apr 8, 2022

{{{pull_request_base_ref}}
{{{pull_request_head_ref}}

was already added as source_branch/target_branch as per https://pipelinesascode.com/docs/guide/autoringprs/

just adding pull request number in #541

@sm43 sm43 closed this as completed in #541 Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants