ttomecek / fedrepo_req

Forked from fedrepo_req 6 years ago
Clone

ttomecek / fedrepo_req

Forked from fedrepo_req 6 years ago
A CLI tool that provides an easy way to submit ticket requests for packaging tasks in Fedora
Members 1
mprahl committed 6 years ago

fedrepo_req (Deprecated)

Overview

This is deprecated, please use fedpkg request-repo and fedpkg request-branch.

fedrepo_req contains a command-line (CLI) tools developed in Python that provides an easy way to submit ticket requests for things such as:

  • Requesting a new repository/package
  • Requesting a new branch for your repository/package

Usage

fedrepo-req - a command to request new src.fedoraproject.org repositories while optionally requesting a single branch to be created at repository creation time. If you are looking to create additional branches after requesting the repository, please use fedrepo-req-branch instead.

Please note that if you specify a branch other than master when requesting a new repository, a master branch will still be created in git and PDC alongside of your specified branch.

Usage: fedrepo-req [OPTIONS] REPO [BRANCH]

  Request new repositories on src.fedoraproject.org. If a branch is
  specified, it will create it in addition to the master branch in PDC.

  Examples:

      fedrepo-req nethack -t 12345

      fedrepo-req nethack epel7 -t 12345

      fedrepo-req nethack lts -t 12345 --sl security_fixes:2022-12-01

      fedrepo-req nethack --exception

Options:
  --exception                     The package is an exception to the regular
                                  package review process (specifically, it
                                  does not require a Bugzilla bug).
  -d, --description TEXT          The package's description.
  -m, --monitor [no-monitoring|monitoring|monitoring-with-scratch]
                                  Monitoring type for the package.
  -n, --namespace [rpms|container|modules|test-modules]
                                  The repo's namespace.
  -s, --summary TEXT              Override the package's summary from the
                                  Bugzilla bug.
  -t, --ticket TEXT               Bugzilla bug ID of the package review
                                  request.
  -u, --upstreamurl TEXT          The package's upstream URL.
  --sl TEXT                       The service levels tied to the branch. This
                                  must be in the format of
                                  "sl_name:2020-12-01"
  -h, --help                      Show this message and exit.

Below is an example when requesting the "python" repository with the default "f27" branch and default SL. The -t represents the Bugzilla bug ID for the package review:

$ fedrepo-req python -t 1234

Below is an example when requesting the "python" repository with the "2.7" branch and two SLs. The -t represents the Bugzilla bug ID for the package review:

$ fedrepo-req python 2.7 --sl security_fixes:2022-12-01 --sl bug_fixes:2022-12-01 -t 1234

fedrepo-req-branch - a command to request new src.fedoraproject.org branches. This creates the branch in git and PDC.

Usage: fedrepo-req-branch [OPTIONS] REPO BRANCH

  Request new branches on src.fedoraproject.org repositories. This adds a
  branch in git and an entry in PDC, which is required to build your
  package.

  Examples:

      fedrepo-req-branch nethack epel7

      fedrepo-req-branch nethack lts --sl security_fixes:2022-12-01 --sl
      bug_fixes:2022-12-01

Options:
  --git-branch / --no-git-branch  Create the new branch in git. This defaults
                                  to on.
  -n, --namespace [rpms|container|modules|test-modules]
                                  The repo's namespace.
  --sl TEXT                       The service levels tied to the branch. This
                                  must be in the format of
                                  "sl_name:2022-12-01"
  -h, --help                      Show this message and exit.

Below is an example of requesting the "2.7" branch for the "python" package:

$ fedrepo-req-branch python 2.7  --sl security_fixes:2020-12-01 --sl bug_fixes:2020-12-01

Service Levels

The "--sl" flag is used to denote a service level on an arbitrary branch. An arbitrary branch is a branch that isn't tied to a Fedora release and is to be included in a module. Since modules can have conflicting and divergent lifecycles, some packages within those modules need to have different versions than in the standard Fedora release branches. Service levels, therefore, denote what kind and how long the support you're planning to provide is. This usually maps to the upstream support of the version you plan to have in the branch. Please note that Fedora Release Engineering only allows service levels that expire on June 1st or December 1st so that components only expire twice per year.

To view the current service levels to chose from, please view the definitions in PDC.

Configuration

The default configuration is located at /etc/fedrepo_req/config.ini. For more information on this, please view the "Default Configuration" section below. The user specified configuration should be located in ~/.config/fedrepo_req/config.ini. To add an additional path, you may set the environment variable FEDREPO_REQ_CONFIG to the path of a configuration file.

To get started, you'll need to get a Pagure API key to be able to create new tickets on the "releng/fedora-scm-requests" repo and add it to ~/.config/fedrepo_req/config.ini. To do this:

  • Go to your Pagure account's API tokens page
  • Select "Create a new ticket against this project"
  • Click on "Create"
  • Scroll down to the "API Keys" section and copy the API key.
  • Create your personal config file at ~/.config/fedrepo_req/config.ini
  • Paste the API key so that it looks like this:
[app]
pagure_api_token = <api_key_here>

Admin Configuration

If you are using the fedrepo-req-admin tool, you'll need to get a Pagure API key to create projects/repos and add it to ~/.config/fedrepo_req/config.ini. To do this:

  • Ask @pingou for a token generated by pagure-admin
  • Modify your personal config file at ~/.config/fedrepo_req/config.ini
  • Paste the API key in the admin section so that it looks like this:
[admin]
pagure_api_token = <api_key_here>

Additionally, you'll need an API key on the "releng/fedora-scm-requests" repo to comment and close tickets. To do this:

  • Go to the releng/fedora-scm-requests API tokens page
  • Select "Change the status of a ticket of this project"
  • Select "Comment on a ticket of this project"
  • Select "Update an issue, status, comments, custom fields..."
  • Click on "Create"
  • Scroll down to the "API Keys" section and copy the API key.
  • Create your personal config file at ~/.config/fedrepo_req/config.ini
  • Paste the API key in the admin section so that it looks like this:
[admin]
pagure_ticket_api_token = <api_key_here>

Additionally, you'll need an API token to make modifications in PDC. To do this:

  • Go to the PDC API tokens page
  • (In Firefox, YMMV) Press F12 to open the console
  • Enter the Network Tab
  • Ctrl-R to refresh
  • Right-click on the line containing auth/token/obtain and Copy as cURL
  • Paste on the command line, add -H "Accept: application/json" and Enter
  • This will return your API token
  • Paste the API key in the admin section so that it looks like this:
[admin]
pdc_api_token = <api_key_here>

Lastly, since the admin tool uses git, you'll need to trust the remote git server's SSH key. To do this, make sure you have the proper "@cert-authority" entries in your ~/.ssh/known_hosts file. One way to achieve this is by running the following command:

curl --silent https://admin.fedoraproject.org/ssh_known_hosts >> ~/.ssh/known_hosts

Default Configuration

The default configuration is located at /etc/fedrepo_req/config.ini. This sets the values for:

  • pagure_url - the URL to the Pagure instance that contains the releng/fedora-scm-requests repository. This defaults to https://pagure.io.
  • pagure_dist_git_url - the URL to the Pagure instance on dist-git. This defaults to https://src.fedoraproject.org.
  • pdc_url - the URL to the Product Definition Center (PDC) instance that stores branch and service level agreements. This defaults to https://pdc.fedoraproject.org.

PDC

The Product Definition Center (PDC) is critical in the Fedora packaging space. To learn in general what PDC is and why PDC is in Fedora, please read the PDC Change Request.

PDC is used in the packaging space in a few ways, primarily, the following APIs are relevant:

  • Component Branches: lists the branches in dist-git with metadata such as the service levels tied to them. A branch entry is created here after a request from fedrepo-req-branch is processed. This branch entry then provides access to creating that branch in dist-git.
  • Component Branch Service Levels: the list of service levels mapped to dist-git branches.
  • Component Service Level Types: the list of service levels that can be tied to a dist-git branch.

For more information as to why these APIs were implemented, please read the Arbitrary Branching Focus Document