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

Expose scm material url and branch as environment variables to tasks #6289

Closed
granddesigntech opened this issue May 15, 2019 · 3 comments
Closed
Projects

Comments

@granddesigntech
Copy link

granddesigntech commented May 15, 2019

Issue Type
  • Feature enhancement
Summary

I need to be able to pass the following values to the build process I am executing (creating a pipeline to orchestrate the build, test & release automations of another team):

  • commit id
  • scm url
  • branch name
  • version

currently only the commit id and version are exposed as environment variables to the task.

Request is to add the scm url and branch name to the set of material metadata being exposed as env vars to tasks.

@arvindsv
Copy link
Member

I'm usually up for providing more information. In these cases though, assuming git for now, these are available using command such as:

git config --get remote.origin.url
git branch --points-at HEAD --format "%(refname:short)"

Right? Isn't that enough? Trying to understand whether it's about convenience or something more than that.

Of course, one of the issues we'd need to look at if URL is provided is that the URL might have credentials in some cases.

@granddesigntech
Copy link
Author

More detail: I specifically didn't include more detail because I wanted the request to reflect the level of knowledge the pipeline task has when it has to perform what it has to perform. It should not have to know whether it is a git repo or an svn repo or any other. That knowledge is nicely compartmentalised into the material handling and should stay there.

Usecase: The above not withstanding there are some times when the user or beneficiary of the automation might benefit from some (fairly generic across scm tools) information configured, generated or otherwise identified during material handling that the task itself should not need to know the toolset involved to retrieve (eg branch, remote repo url, change id, etc) as once you are manipulating tools specific to the material in subsequent tasks that pipeline stage is now broken if the material source/toolset changes and reusability across SCM repos is impossible without unwieldy cludges.
Particularly since the product IS exposing values the SCM plugin has to use the toolset or API specific to the SCM in play to determine it seems somewhat churlish not to expose values that have already been entered explicitly by the user. Why make them then pollute their task with out of place knowledge (ie of what SCM toolset to use) and code to find out what they have already entered?

Credentials: It would seem prudent to elide passwords found in the url format password location or values of query section fields like "password", "passwd", "pass", etc.

@maheshp maheshp added this to the NextUp milestone May 30, 2019
@kritika-singh3 kritika-singh3 modified the milestones: NextUp, Release 19.10.0 Oct 3, 2019
@kritika-singh3 kritika-singh3 added this to To do in 19.10.0 Oct 3, 2019
@maheshp maheshp moved this from To do to Done in 19.10.0 Oct 9, 2019
@rajiesh
Copy link
Contributor

rajiesh commented Oct 23, 2019

Verified on 19.10.0 (10328-5cb62ca14461d56576551e0bbec2978c909ea9b2)

@rajiesh rajiesh closed this as completed Oct 23, 2019
@rajiesh rajiesh moved this from Done to QA Done in 19.10.0 Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
19.10.0
QA Done
Development

No branches or pull requests

5 participants