#6966 SOP and scripts for unretiring.
Merged 6 years ago by mohanboddu. Opened 6 years ago by ralph.

file modified
+1
@@ -74,6 +74,7 @@ 

      sop_sigul_client_setup

      sop_stage_final_release_for_mirrors

      sop_two_week_atomic

+     sop_unretire

      sop_update_branch_last_known_good

      sop_update_critpath

      sop_update_releng_docs

@@ -0,0 +1,38 @@ 

+ .. SPDX-License-Identifier:    CC-BY-SA-3.0

+ 

+ 

+ ===========================

+ Unretiring a package branch

+ ===========================

+ 

+ Description

+ ===========

+ 

+ Sometimes, packagers request that we *unretire* a package branch that has

+ previously been retired.

+ 

+ This typically happens on the `master` branch, but could conceivably happen on

+ any stable or "arbitrary" branch.

+ 

+ Before proceeding further, the release engineer should check that the package

+ was not previously retired for some Very Good Reason, legal or otherwise.

+ Decide whether or not to proceed with unretirement accordingly.

+ 

+ Action

+ ======

+ 

+ Unretiring a package consists of the following actions:

+ 

+ - Git revert the `dead.package` file commit in dist-git on the particular branch.

+ - Unblock the package in koji::

+ 

+     koji unblock-pkg epel7 TurboGears2

+ 

+ - Set the PDC EOLs for the branch to appropriate future values::

+ 

+     export PYTHONPATH=scripts/pdc/

+     python scripts/pdc/adjust-eol.py fedora TOKEN TurboGears2 rpm epel7 default

+ 

+ - Refresh the pagure acl config to allow pushes.  ssh to `pkgs02` and run::

+ 

+     PAGURE_CONFIG=/etc/pagure/pagure.cfg pagure-admin refresh-gitolite --project rpms/TurboGears2

@@ -0,0 +1,47 @@ 

+ """ create-branch.py - Add a new branch to PDC *by hand*.

+ 

+ In general, you shouldn't use this script.  The "front door" for new branches

+ is to have people use the fedrepo-req tool to request branches, and to have

+ cvsadmin members use the fedrepo-req-admin tool to process them.  That tool

+ creates branches in PDC and new repos in pagure.  This tool should be used as

+ the backdoor option, in case releng needs to create a branch manually.

+ 

+ https://pdc.fedoraproject.org/rest_api/v1/component-branches/

+ 

+ Note that branches must be associated with SLAs and EOLs.

+ 

+ You can run this on pdc-backend01, the token is in /etc/pdc.d/

+ You can also find the token in the private git repo.

+ """

+ 

+ import argparse

+ 

+ try:

+     import utilities

+ except ImportError:

+     print("Try setting PYTHONPATH to find the utilities.py file.")

+     raise

+ 

+ import pdc_client

+ 

+ parser = argparse.ArgumentParser(description=__doc__)

+ parser.add_argument('servername', help='PDC server name.  See /etc/pdc.d/')

+ parser.add_argument('token', help='PDC token for authentication.')

+ parser.add_argument('package', help='Name of the package')

+ parser.add_argument('type', help='Type of the package (rpm, module, container, ..)')

+ parser.add_argument('branch', help='Name of the branch (f26, or 1.12, or master)')

+ parser.add_argument('eol', help='End of life date for the SLAs, '

+                     'in the format of "2020-01-01".  May also be "default".')
till commented 6 years ago

AFAICS you could add default="default" to make the argument option and use the default values when the argument is not specified.

+ parser.add_argument('-y', '--yes', dest='yes', action='store_true',

+                     default=False,

+                     help='Force "yes" to every question.')

+ 

+ args = parser.parse_args()

+ 

+ 

+ if __name__ == '__main__':

+     print("Connecting to PDC args.server %r with token %r" % (args.servername, args.token))

+     pdc = pdc_client.PDCClient(args.servername, token=args.token)

+ 

+     utilities.patch_eol(

+         pdc, args.package, args.eol, args.branch, args.type, args.yes)

file modified
+42
@@ -1,8 +1,11 @@ 

  """ Common PDC utility functions, shared by scripts. """

  from __future__ import print_function

  

+ import copy

  import sys

  

+ from fedrepo_req import STANDARD_BRANCH_SLAS

+ 

  

  def prompt(message, force):

      return force or raw_input(message + " [y/N]: ").lower() in ('y', 'yes')
@@ -73,3 +76,42 @@ 

          print("Applied %r to %r (critpath %r)" % (modified, base, critpath))

      else:

          print("Did not apply any slas to %r (critpath %r)" % (base, critpath))

+ 

+ 

+ 

+ def patch_eol(pdc, package, eol, branch, type, force):

+     specified_eol = eol

+     endpoint = pdc['component-branch-slas']

+     # A base query

+     query = dict(branch=branch, global_component=package, branch_type=type)

+     slas = list(pdc.get_paged(endpoint, **query))

+     fmt = lambda s: "({type}){global_component}#{name} {sla}:{eol}".format(**s)

+     modified = []

+     for sla in slas:

+         flattened = copy.copy(sla)

+         flattened.update(sla['branch'])

+ 

+         if specified_eol == 'default':

+             if branch not in STANDARD_BRANCH_SLAS:

+                 raise KeyError("%r is not a standard branch, so we don't know "

+                                "a `default` SLA." % branch)

+             if sla['sla'] not in STANDARD_BRANCH_SLAS[branch]:

+                 raise KeyError("%r does not have a default eol for %r" % (

+                     sla['sla'], branch))

+             eol = STANDARD_BRANCH_SLAS[branch][sla['sla']]

+ 

+         # See if user wants intervention

+         message = "Adjust eol of %s to %s?" % (fmt(flattened), eol)

+         if not prompt(message, force):

+             print("Not adjusting eol.")

+             continue

+ 

+         # Do it.

+         modified.append(fmt(flattened))

+         endpoint['%i/' % sla['id']] += dict(eol=eol)

+ 

+     # Report at the end.

+     if modified:

+         print("Set eol to %s on %r" % (eol, modified))

+     else:

+         print("Did not adjust any EOLs.")

rebased

6 years ago

FYI, I'm trying this out on #6959.

It seems that #6959 went well.

See also https://pagure.io/fedrepo_req/issue/64 which, if implemented, would change this.

AFAICS this should be "Did not ..."

IMHO it would be better to import the EOL dates with from fedrepo_req import STANDARD_BRANCH_SLAS instead of requiring users to specify them on the command line. Also a copy of the dictionary would be better if this is only a workaround. Ideally the default branch SLA EOL dates would be available im PDC (IMHO) and it would also be great if PDC had a reset_SLA_EOL_dates() method (or similar). I will file some issues and see if there is interest upstream.

2 new commits added

  • Allow specifying "default" for EOLs.
  • Typofix.
6 years ago

Thanks @till! I added defaults in eb882d8.

1 new commit added

  • Use "default" in the SOP.
6 years ago

AFAICS you could add default="default" to make the argument option and use the default values when the argument is not specified.

Commit 6bd060f fixes this pull-request

Pull-Request has been merged by mboddu@bhujji.com

6 years ago

Pull-Request has been merged by mohanboddu

6 years ago