#450 Automation role/account to open pull requests in projects in pagure.io
Opened by siosm. Modified

For the https://pagure.io/workstation-ostree-config project, I would like to create Zuul jobs that update the content of the repo and open a Pull Request with the update

To avoid using a personal token, we would need a dedicated account in pagure / a role in Zuul (?) with an API key with pull request access to (all?) repos.

This is similar in concept to how jobs running as GitHub Actions are given a GitHub Token that has a limited access to the GitHub API.


Notes:
- We can use the API to open PRs: https://pagure.io/api/0/#pull_requests-tab

@siosm your plan sounds reasonable:

  1. get an bot account to pagure.io - I would open a request to fedora-infrastructure: https://pagure.io/fedora-infrastructure/issues
  2. create a secret in the Fedora Zuul instance - https://www.softwarefactory-project.io/zuul-hands-on-part-5-job-secrets.html
  3. put the secret to https://pagure.io/fedora-zuul-jobs-config/blob/master/f/zuul.d
  4. and then we will need to create a zuul job that does the magic, possibly with a custom role

@fbo @tdecacqu hi guys, or is there some better way for this workflow in Zuul?

Metadata Update from @mvadkert:
- Issue tagged with: Zuul CI

Hi @siosm and @mvadkert,

Yes that's the right way to handle this.

To create the Zuul secret for the API key, here is the process:

  1. Use this Python script: https://opendev.org/zuul/zuul/src/branch/master/tools/encrypt_secret.py
  2. Add the API key into a file
  3. ./encrypt_secret.py --tenant fedora --infile --outfile /tmp/secret.yaml https://fedora.softwarefactory-project.io/zuul fedora-zuul-jobs-config
  4. Open a PR to add the secret into https://pagure.io/fedora-zuul-jobs-config/blob/master/f/zuul.d

We could then create a Job that will use that secret and we can tell Zuul to run that job in a Periodic pipeline https://pagure.io/fedora-project-config/blob/master/f/zuul.d/_pipelines.yaml#_313

Metadata