openshift-pipelines / pipelines-as-code

Pipelines-as-Code for Tekton
https://pipelinesascode.com
Apache License 2.0
124 stars 81 forks source link

Expose git source repo URL in pipelinerun annotations #1693

Closed MartinBasti closed 4 weeks ago

MartinBasti commented 1 month ago

When a PR is created from fork, there is no annotation that would show source repo URL and it's hard to identify which fork was used.

There is {{source_url}} variable in PLR definition, would be nice if the source_url is automatically recorded in annotations. The same for source_branch

chmouel commented 1 month ago

SGTM

cc @enarha

MartinBasti commented 1 month ago

if it's a good first issue I can try to contribute :)

enarha commented 1 month ago

You can add the annotation. This worked for me https://github.com/enarha/actions/pull/43/files . The annotation was created on the PipelineRun.

MartinBasti commented 1 month ago

My service needs that context, I don't want to tell every user to do manual updates in PLR, when PAC has this information.

enarha commented 1 month ago

We have two options IMO here. The one I like less is to expose some or all of those dynamic variables by using configuration of what to be exposed which will either make the configuration more complex or expose too much information (if we expose all vars with single configuration option). The second option which I like more is by using some form of global pipelinerun configuration similar to the global repository settings (https://pipelinesascode.com/docs/install/global_repositories_setting/#pipelines-as-code-global-repository-settings). Neither of these is as easy as just exposing a single var, but it's the right thing to do IMO.

enarha commented 1 month ago

On a system I have access to it looks like we already expose 23 annotations, so maybe not a big issue to just add one more.