pipe-cd / pipecd

The One CD for All {applications, platforms, operations}
https://pipecd.dev
Apache License 2.0
1.1k stars 154 forks source link

Link application repository PR and the PipeCD deployment related to it. #5028

Closed ffjlabo closed 3 weeks ago

ffjlabo commented 4 months ago

What would you like to be added:

When separating the app code repo and manifests repo by using event watcher, it would be nice to link the app repo PR and PipeCD deployment.

Why is this needed:

There are some use cases. For example,

Warashi commented 4 months ago

I investigated the plan to solve this issue.

Pre-condition:

Plan:

Overview:

Pass the context information through actions-event-register -> pipectl -> control-plane-server -> piped -> manifest repo -> piped

Detail

  1. collect GitHub repo/commit context in actions-event-register
  2. create a new option --context to the pipectl and pass contexts to it
  3. add map<string,string> context here and pass contexts
  4. add map<string,string> context here and store contexts
  5. add Context map[string]string here and pass contexts
  6. add a document about the text/template feature of the GIT_UPDATE event
  7. finally, users can use {{ .Context.GITHUB_SHA }} or something like this in the commit message format through the GIT_UPDATE event config so that users can use the application repository context in the deployment SCRIPT_RUN stage or from the webhook.
ffjlabo commented 1 month ago

📝 It might be useful to add some metadata as git trailer https://git-scm.com/docs/git-interpret-trailers#_description

ffjlabo commented 3 weeks ago

We will fix actions-event-register after releasing this fix. Follow https://github.com/pipe-cd/pipecd/issues/5307 for it.