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


==============
Mass Branching
==============

Description
===========

At each alpha freeze we branch the pending release away from ``devel/`` which
allows rawhide to move on while the pending release goes into bugfix and
polish mode.

Action
======

Update fedscm-admin
-------------------

Add the new release to fedscm-admin and create an update and send it to limb.

Please take a look at the `fedscm-admin commit`_.


Repos to branch
---------------

All the following listed repos needs updating, including adding a new branch
for branched release and updating rawhide branch with new release values.

1. https://pagure.io/pungi-fedora
2. https://pagure.io/fedora-kickstarts
3. https://pagure.io/fedora-comps
4. https://pagure.io/fedora-lorax-templates/
5. https://pagure.io/releng/fedora-module-defaults/
6. https://pagure.io/workstation-ostree-config/
7. https://src.fedoraproject.org/rpms/fedora-release
8. https://src.fedoraproject.org/rpms/fedora-repos

PDC
---

The "product-release" needs to be created in PDC.

In the ``scripts/pdc/`` directory, run::

    $ python create-product-release.py fedora $TOKEN fedora $NEW_VERSION


On ``pdc-backend01.stg`` (for testing) or ``pdc-backend01`` (for production)
clone (or update an existing one) the releng repo::

    git clone https://pagure.io/releng.git


In the ``scripts/pdc/`` directory, run (see the ``--help`` of the script for
information on how to run it)::

    $ python create-new-release-branches.py ... --createfile


.. note:: the ``--createfile`` argument is necessary, that file is needed
          for the next step.

.. note:: Due to memory leak issue in pdc, we need to set the config in
          /etc/pdc.d/fedora.json
          {
            "fedora": {
            "host": "http://pdc-web02.iad2.fedoraproject.org/rest_api/v1/",
            "develop": false,
            "ssl-verify": false,
            }
          }

dist-git
--------

Now that pdc has the new release and each package has been branched in pdc
we need to update dist-git in two steps:

- Create the new branch in git
- Update the gitolite.conf to allow user to push to this new branch

For both of these actions you will need the file generated by pdc above.

Create the git branches
^^^^^^^^^^^^^^^^^^^^^^^

On ``pkgs01.stg`` (for testing) or ``pkgs02`` (for production), run::

    $ sudo -u pagure python /usr/local/bin/mass-branching-git.py <new branch name> <input file>

Where ``<new branch name>`` will be something like ``f28`` and the ``<input file>``
the path to the file generated by pdc above.


Ansible
-------

Apps in ansible need to be updated to be aware of a new branch.

PkgDB
^^^^^

This is temporary until pkgdb can be fully decommissioned but in the mean
time, the new release needs to be added to it.
To do so, adjust infra ansible playbook in `pkgdb-proxy role`_:

::

    --- a/roles/pkgdb-proxy/files/pkgdb-gnome-software-collections.json
    +++ b/roles/pkgdb-proxy/files/pkgdb-gnome-software-collections.json
    @@ -4,8 +4,8 @@
           "allow_retire": true,
           "branchname": "rawhide",
           "date_created": "2014-05-14 12:36:15",
    -      "date_updated": "2019-08-14 17:07:23",
    -      "dist_tag": ".fc32",
    +      "date_updated": "2020-02-11 17:07:23",
    +      "dist_tag": ".fc33",
           "koji_name": "rawhide",
           "name": "Fedora",
           "status": "Under Development",
    @@ -13,6 +13,17 @@
         },
         {
           "allow_retire": false,
    +      "branchname": "f32",
    +      "date_created": "2014-05-14 12:36:15",
    +      "date_updated": "2020-02-11 17:07:23",
    +      "dist_tag": ".fc32",
    +      "koji_name": "f32",
    +      "name": "Fedora",
    +      "status": "Under Development",
    +      "version": "32"
    +    },
    +    {
    +      "allow_retire": false,
           "branchname": "f31",
           "date_created": "2014-05-14 12:36:15",
           "date_updated": "2018-08-14 17:07:23",

fedora-packages
^^^^^^^^^^^^^^^

There is a file in the fedora-packages webapp source that needs to be updated
with new releases.  It tells fedora-packages what tags to ask koji about. Just
like before, make the following edit the ansible repo in `packages3 role`_:

::

    --- a/roles/packages3/web/files/distmappings.py
    +++ b/roles/packages3/web/files/distmappings.py
    @@ -1,5 +1,9 @@
     # Global list of koji tags we care about
    -tags = ({'name': 'Rawhide', 'tag': 'f32'},
    +tags = ({'name': 'Rawhide', 'tag': 'f33'},
    +
    +        {'name': 'Fedora 32', 'tag': 'f32-updates'},
    +        {'name': 'Fedora 32', 'tag': 'f32'},
    +        {'name': 'Fedora 32 Testing', 'tag': 'f32-updates-testing'},

             {'name': 'Fedora 31', 'tag': 'f31-updates'},
             {'name': 'Fedora 31', 'tag': 'f31'},

Bodhi
^^^^^

Bodhi needs to be updated to add new release. This needs to be done in `bodhi2 role`_
in infra ansible repo. This change includes, updating koji-sync-listener.py,
new-updates-sync, pungi configs for both rpm and modular updates, bodhi templates.

::

    --- a/roles/bodhi2/backend/files/koji-sync-listener.py
    +++ b/roles/bodhi2/backend/files/koji-sync-listener.py
    @@ -23,7 +23,7 @@ def handle(content):
         sys.stdout.flush()
         # XXX If you modify this taglist.  Please also modify the other copy in
         # bodhi2/backend/tasks/main.yml
    -    taglist = 'f32 f32-container f32-modular f32-flatpak f31 f31-container f31-flatpak f31-modular f30 f30-container f30-flatpak f30-modular epel8 epel8-playground epel8-modular epel7 dist-6E-epel module-package-list modular'
    +    taglist = 'f33 f33-container f33-modular f33-flatpak f32 f32-container f32-modular f32-flatpak f31 f31-container f31-flatpak f31-modular f30 f30-container f30-flatpak f30-modular epel8 epel8-playground epel8-modular epel7 dist-6E-epel module-package-list modular'
        cmd = [
            '/usr/local/bin/owner-sync-pagure',
            '--package', package,

    diff --git a/roles/bodhi2/backend/files/new-updates-sync b/roles/bodhi2/backend/files/new-updates-sync
    index 2228517..3baa775 100755
    --- a/roles/bodhi2/backend/files/new-updates-sync
    +++ b/roles/bodhi2/backend/files/new-updates-sync
    @@ -20,7 +20,51 @@ FEDORAALTDEST = '/pub/fedora-secondary/updates/'
     EPELDEST = '/pub/epel/'
     OSTREESOURCE = '/mnt/koji/compose/ostree/repo/'
     OSTREEDEST = '/mnt/koji/ostree/repo/'
    -RELEASES = {'f31': {'topic': 'fedora',
    +RELEASES = {'f32': {'topic': 'fedora',
    +                    'version': '32',
    +                    'modules': ['fedora', 'fedora-secondary'],
    +                    'repos': {'updates': {
    +                        'from': 'f32-updates',
    +                        'ostrees': [{'ref': 'fedora/32/%(arch)s/updates/silverblue',
    +                                     'dest': OSTREEDEST,
    +                                     'arches': ['x86_64', 'ppc64le', 'aarch64']}],
    +                        'to': [{'arches': ['x86_64', 'armhfp', 'aarch64', 'source'],
    +                                'dest': os.path.join(FEDORADEST, '32', 'Everything')},
    +                               {'arches': ['ppc64le', 's390x'],
    +                                'dest': os.path.join(FEDORAALTDEST, '32', 'Everything')}
    +                              ]},
    +                              'updates-testing': {
    +                        'from': 'f32-updates-testing',
    +                        'ostrees': [{'ref': 'fedora/32/%(arch)s/testing/silverblue',
    +                                     'dest': OSTREEDEST,
    +                                     'arches': ['x86_64', 'ppc64le', 'aarch64']}],
    +                        'to': [{'arches': ['x86_64', 'aarch64', 'armhfp', 'source'],
    +                                'dest': os.path.join(FEDORADEST, 'testing', '32', 'Everything')},
    +                               {'arches': ['ppc64le', 's390x'],
    +                                'dest': os.path.join(FEDORAALTDEST, 'testing', '32', 'Everything')}
    +                              ]}}
    +                   },
    +            'f32m': {'topic': 'fedora',
    +                    'version': '32m',
    +                    'modules': ['fedora', 'fedora-secondary'],
    +                    'repos': {'updates': {
    +                        'from': 'f32-modular-updates',
    +                        'ostrees': [],
    +                        'to': [{'arches': ['x86_64', 'aarch64', 'armhfp', 'source'],
    +                                'dest': os.path.join(FEDORADEST, '32', 'Modular')},
    +                               {'arches': ['ppc64le', 's390x'],
    +                                'dest': os.path.join(FEDORAALTDEST, '32', 'Modular')}
    +                              ]},
    +                              'updates-testing': {
    +                        'from': 'f32-modular-updates-testing',
    +                        'ostrees': [],
    +                        'to': [{'arches': ['x86_64', 'aarch64', 'armhfp', 'source'],
    +                                'dest': os.path.join(FEDORADEST, 'testing', '32', 'Modular')},
    +                               {'arches': ['ppc64le', 's390x'],
    +                                'dest': os.path.join(FEDORAALTDEST, 'testing', '32', 'Modular')}
    +                              ]}}
    +                   },
    +            'f31': {'topic': 'fedora',
                         'version': '31',
                         'modules': ['fedora', 'fedora-secondary'],
                         'repos': {'updates': {

    --- a/roles/bodhi2/backend/tasks/main.yml
    +++ b/roles/bodhi2/backend/tasks/main.yml
    @@ -73,7 +73,7 @@
       # bodhi2/backend/files/koji-sync-listener.py
       # This cronjob runs only once a day.  The listener script runs reactively.
       cron: name="owner-sync" minute="15" hour="4" user="root"
    -      job="/usr/local/bin/lock-wrapper owner-sync '/usr/local/bin/owner-sync-pagure f32 f32-container f32-modular f32-flatpak f31 f31-container f31-flatpak f31-modular f30 f30-container f30-flatpak f30-modular epel8 epel8-playground epel8-modular epel7 dist-6E-epel module-package-list modular'"
    +      job="/usr/local/bin/lock-wrapper owner-sync '/usr/local/bin/owner-sync-pagure f33 f33-container f33-modular f33-flatpak f32 f32-container f32-modular f32-flatpak f31 f31-container f31-flatpak f31-modular f30 f30-container f30-flatpak f30-modular epel8 epel8-playground epel8-modular epel7 dist-6E-epel module-package-list modular'"
           cron_file=update-koji-owner
       when: env == "production"
       tags:

    diff --git a/roles/bodhi2/backend/templates/pungi.module.conf.j2 b/roles/bodhi2/backend/templates/pungi.module.conf.j2
    index a594069..266cbf9 100644
    --- a/roles/bodhi2/backend/templates/pungi.module.conf.j2
    +++ b/roles/bodhi2/backend/templates/pungi.module.conf.j2
    @@ -16,6 +16,8 @@ sigkeys = [
     	'cfc659b9',
     [% elif release.version_int == 31 %]
     	'3c3359c4',
    +[% elif release.version_int == 32 %]
    +	'12c944d0',
     [% elif release.version_int == 8 %]
             '2f86d6a1',
     [% endif %]

    diff --git a/roles/bodhi2/backend/templates/pungi.rpm.conf.j2 b/roles/bodhi2/backend/templates/pungi.rpm.conf.j2
    index adfa110..e68f565 100644
    --- a/roles/bodhi2/backend/templates/pungi.rpm.conf.j2
    +++ b/roles/bodhi2/backend/templates/pungi.rpm.conf.j2
    @@ -31,6 +31,8 @@ sigkeys = [
         '3c3359c4',
     [% elif release.version_int == 32 %]
         '12c944d0',
    +[% elif release.version_int == 33 %]
    +    '9570ff31',
     [% elif release.version_int == 6 %]
         '0608b895',
     [% elif release.version_int == 7 %]

    diff --git a/roles/bodhi2/base/templates/production.ini.j2 b/roles/bodhi2/base/templates/production.ini.j2
    index f6bd701..3ae6711 100644
    --- a/roles/bodhi2/base/templates/production.ini.j2
    +++ b/roles/bodhi2/base/templates/production.ini.j2
    @@ -605,6 +605,8 @@ f{{ FedoraRawhideNumber }}c.pre_beta.mandatory_days_in_testing = 0
     # Rawhide gating - Updates in rawhide don't require any days in testing.
     f{{ FedoraRawhideNumber }}.status = pre_beta
     f{{ FedoraRawhideNumber }}.pre_beta.mandatory_days_in_testing = 0
    +f32.status = pre_beta
    +f32.pre_beta.mandatory_days_in_testing = 0
     ##
     ## Buildroot Override
     ##

    diff --git a/roles/bodhi2/backend/templates/koji_sync_listener.toml b/roles/bodhi2/backend/templates/koji_sync_listener.toml
    --- a/roles/bodhi2/backend/templates/koji_sync_listener.toml
    +++ b/roles/bodhi2/backend/templates/koji_sync_listener.toml
    @@ -36,6 +36,10 @@ arguments = {}
    # XXX If you modify this taglist.  Please also modify the other copy in
    # bodhi2/backend/tasks/main.yml
    taglist = [
    +     "f34",
    +     "f34-container",
    +     "f34-modular",
    +     "f34-flatpak",
          "f33",
          "f33-container",
          "f33-modular",


Greenwave
^^^^^^^^^

Greenwave needs to know about the new release. This is done in `greenwave openshift role`_:

::

    diff --git a/roles/openshift-apps/greenwave/templates/fedora.yaml b/roles/openshift-apps/greenwave/templates/fedora.yaml
    index cf0e9fb..5c2a0f3 100644
    --- a/roles/openshift-apps/greenwave/templates/fedora.yaml
    +++ b/roles/openshift-apps/greenwave/templates/fedora.yaml
    @@ -53,6 +53,7 @@ rules:
     --- !Policy
     id: "taskotron_release_critical_tasks_for_testing"
     product_versions:
    +  - fedora-33
       - fedora-32
       - fedora-31
       - fedora-30
    @@ -66,6 +67,7 @@ rules:
     --- !Policy
     id: "taskotron_release_critical_tasks_for_stable"
     product_versions:
    +  - fedora-33
       - fedora-32
       - fedora-31
       - fedora-30

mbs
^^^

Add the new rawhide platform. Its done in `mbs role`_ in infra ansible repo.

::

    diff --git a/roles/mbs/common/files/default-modules.production/platform-f33.yaml b/roles/mbs/common/files/default-modules.production/platform-f33.yaml
    new file mode 100644
    index 0000000..960356c
    --- /dev/null
    +++ b/roles/mbs/common/files/default-modules.production/platform-f33.yaml
    @@ -0,0 +1,28 @@
    +data:
    +  description: Fedora 33 traditional base
    +  license:
    +    module: [MIT]
    +  name: platform
    +  profiles:
    +    buildroot:
    +      rpms: [bash, bzip2, coreutils, cpio, diffutils, fedora-release, findutils, gawk,
    +        glibc-minimal-langpack, grep, gzip, info, make, patch, redhat-rpm-config,
    +        rpm-build, sed, shadow-utils, tar, unzip, util-linux, which, xz]
    +    srpm-buildroot:
    +      rpms: [bash, fedora-release, fedpkg-minimal, glibc-minimal-langpack, gnupg2,
    +        redhat-rpm-config, rpm-build, shadow-utils]
    +  stream: f33
    +  summary: Fedora 33 traditional base
    +  context: 00000000
    +  version: 1
    +  xmd:
    +    mbs:
    +      buildrequires: {}
    +      commit: f33
    +      requires: {}
    +      koji_tag: module-f33-build
    +      mse: TRUE
    +      virtual_streams: [fedora]
    +document: modulemd
    +version: 1
    +

Enable Branched Compose
^^^^^^^^^^^^^^^^^^^^^^^

We need to enable the branched compose. This is done in `releng role`_ of infra ansbile repo

::

    --- a/roles/releng/files/branched
    +++ b/roles/releng/files/branched
    @@ -1,3 +1,3 @@
     # branched compose
     #MAILTO=releng-cron@lists.fedoraproject.org
    -#15 7 * * * root TMPDIR=`mktemp -d /tmp/branched.XXXXXX` && cd $TMPDIR && git clone https://pagure.io/pungi-fedora.git && cd pungi-fedora && git checkout f31 && /usr/local/bin/lock-wrapper branched-compose "PYTHONMALLOC=debug LANG=en_US.UTF-8 ./nightly.sh" && sudo -u ftpsync /usr/local/bin/update-fullfiletimelist -l /pub/fedora-secondary/update-fullfiletimelist.lock -t /pub fedora fedora-secondary
    +15 7 * * * root TMPDIR=`mktemp -d /tmp/branched.XXXXXX` && cd $TMPDIR && git clone https://pagure.io/pungi-fedora.git && cd pungi-fedora && git checkout f32 && /usr/local/bin/lock-wrapper branched-compose "PYTHONMALLOC=debug LANG=en_US.UTF-8 ./nightly.sh" && sudo -u ftpsync /usr/local/bin/update-fullfiletimelist -l /pub/fedora-secondary/update-fullfiletimelist.lock -t /pub fedora fedora-secondary

Fedora Branched
^^^^^^^^^^^^^^^

Set FedoraBranched variable to True in infra ansible repo

::

    --- a/vars/all/FedoraBranched.yaml
    +++ b/vars/all/FedoraBranched.yaml
    @@ -1 +1 @@
    -FedoraBranched: False
    +FedoraBranched: True

Set FedoraBranchedBodhi variable to preenable in infra ansible repo

::

    --- a/vars/all/FedoraBranchedBodhi.yaml
    +++ b/vars/all/FedoraBranchedBodhi.yaml
    @@ -1,2 +1,2 @@
    #options are: prebeta, postbeta, current
    -   FedoraBranchedBodhi: current
    +   FedoraBranchedBodhi: preenable

Koji hub
^^^^^^^^

Update the koji hub config to allow side tags for new koji rawhide tag

::

    --- a/roles/koji_hub/templates/hub.conf.j2
    +++ b/roles/koji_hub/templates/hub.conf.j2
    @@ +1 @@
    +   tag f34-build :: allow
    tag f33-build :: allow
    tag f32-build :: allow

Robosignatory
^^^^^^^^^^^^^

Robosignatory has two parts:

1. Disable branched signing, so that we can freeze branched until we get a compose
2. Adding new release

Both can be in `robosignatory role`_ in infra ansible repo

::

    --- a/roles/robosignatory/templates/robosignatory.toml.j2
    +++ b/roles/robosignatory/templates/robosignatory.toml.j2
    @@ -218,23 +218,23 @@ handlers = ["console"]

                 # Gated rawhide and branched

    -            [[consumer_config.koji_instances.primary.tags]]
    -            from = "f32-signing-pending"
    -            to = "f32-updates-testing-pending"
    -            key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    -            keyid = "{{ (env == 'production')|ternary('12c944d0', 'd300e724') }}"
    -
    -            [consumer_config.koji_instances.primary.tags.sidetags]
    -            pattern = 'f32-build-side-<seq_id>'
    -            from = '<sidetag>-signing-pending'
    -            to = '<sidetag>-testing-pending'
    -            trusted_taggers = ['bodhi']
    -
    -            [[consumer_config.koji_instances.primary.tags]]
    -            from = "f32-pending"
    -            to = "f32"
    -            key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    -            keyid = "{{ (env == 'production')|ternary('12c944d0', 'd300e724') }}"
    +#            [[consumer_config.koji_instances.primary.tags]]
    +#            from = "f32-signing-pending"
    +#            to = "f32-updates-testing-pending"
    +#            key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +#            keyid = "{{ (env == 'production')|ternary('12c944d0', 'd300e724') }}"
    +
    +#            [consumer_config.koji_instances.primary.tags.sidetags]
    +#            pattern = 'f32-build-side-<seq_id>'
    +#            from = '<sidetag>-signing-pending'
    +#            to = '<sidetag>-testing-pending'
    +#            trusted_taggers = ['bodhi']
    +
    +#            [[consumer_config.koji_instances.primary.tags]]
    +#            from = "f32-pending"
    +#            to = "f32"
    +#            key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +#            keyid = "{{ (env == 'production')|ternary('12c944d0', 'd300e724') }}"

                 [[consumer_config.koji_instances.primary.tags]]
                 from = "f32-modular-pending"

    --- a/roles/robosignatory/templates/robosignatory.toml.j2
    +++ b/roles/robosignatory/templates/robosignatory.toml.j2
    @@ -216,8 +216,46 @@ handlers = ["console"]
                 key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
                 keyid = "{{ (env == 'production')|ternary('12c944d0', 'd300e724') }}"

    +            [[consumer_config.koji_instances.primary.tags]]
    +            from = "f33-coreos-signing-pending"
    +            to = "coreos-pool"
    +            key = "{{ (env == 'production')|ternary('fedora-33', 'testkey') }}"
    +            keyid = "{{ (env == 'production')|ternary('9570ff31', 'd300e724') }}"
    +
                 # Gated rawhide and branched

    +            [[consumer_config.koji_instances.primary.tags]]
    +            from = "f33-signing-pending"
    +            to = "f33-updates-testing-pending"
    +            key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +            keyid = "{{ (env == 'production')|ternary('12c944d0', 'd300e724') }}"
    +
    +            [consumer_config.koji_instances.primary.tags.sidetags]
    +            pattern = 'f33-build-side-<seq_id>'
    +            from = '<sidetag>-signing-pending'
    +            to = '<sidetag>-testing-pending'
    +            trusted_taggers = ['bodhi']
    +
    +            [[consumer_config.koji_instances.primary.tags]]
    +            from = "f33-pending"
    +            to = "f33"
    +            key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +            keyid = "{{ (env == 'production')|ternary('12c944d0', 'd300e724') }}"
    +
    +            [[consumer_config.koji_instances.primary.tags]]
    +            from = "f33-modular-pending"
    +            to = "f33-modular"
    +            key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +            keyid = "{{ (env == 'production')|ternary('12c944d0', 'd300e724') }}"
    +            type = "modular"
    +
    +            [[consumer_config.koji_instances.primary.tags]]
    +            from = "f33-modular-updates-candidate"
    +            to = "f33-modular"
    +            key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +            keyid = "{{ (env == 'production')|ternary('12c944d0', 'd300e724') }}"
    +            type = "modular"
    +
     #            [[consumer_config.koji_instances.primary.tags]]
     #            from = "f32-signing-pending"
     #            to = "f32-updates-testing-pending"
    @@ -469,15 +507,43 @@ handlers = ["console"]
             directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
             key = "{{ (env == 'production')|ternary('fedora-31', 'testkey') }}"

    -        [consumer_config.ostree_refs."fedora/rawhide/aarch64/silverblue"]
    +        [consumer_config.ostree_refs."fedora/32/x86_64/silverblue"]
             directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
             key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    -        [consumer_config.ostree_refs."fedora/rawhide/ppc64le/silverblue"]
    +        [consumer_config.ostree_refs."fedora/32/aarch64/silverblue"]
             directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
             key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    -        [consumer_config.ostree_refs."fedora/rawhide/x86_64/silverblue"]
    +        [consumer_config.ostree_refs."fedora/32/ppc64le/silverblue"]
    +        directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
    +        key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +        [consumer_config.ostree_refs."fedora/32/x86_64/updates/silverblue"]
    +        directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
    +        key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +        [consumer_config.ostree_refs."fedora/32/x86_64/testing/silverblue"]
    +        directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
    +        key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +        [consumer_config.ostree_refs."fedora/32/aarch64/updates/silverblue"]
    +        directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
    +        key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +        [consumer_config.ostree_refs."fedora/32/aarch64/testing/silverblue"]
             directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
             key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +        [consumer_config.ostree_refs."fedora/32/ppc64le/updates/silverblue"]
    +        directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
    +        key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +        [consumer_config.ostree_refs."fedora/32/ppc64le/testing/silverblue"]
    +        directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
    +        key = "{{ (env == 'production')|ternary('fedora-32', 'testkey') }}"
    +
    +        [consumer_config.ostree_refs."fedora/rawhide/aarch64/silverblue"]
    +        directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
    +        key = "{{ (env == 'production')|ternary('fedora-33', 'testkey') }}"
    +        [consumer_config.ostree_refs."fedora/rawhide/ppc64le/silverblue"]
    +        directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
    +        key = "{{ (env == 'production')|ternary('fedora-33', 'testkey') }}"
    +        [consumer_config.ostree_refs."fedora/rawhide/x86_64/silverblue"]
    +        directory = "/mnt/fedora_koji/koji/compose/ostree/repo/"
    +        key = "{{ (env == 'production')|ternary('fedora-33', 'testkey') }}"


         [consumer_config.coreos]

Push the changes
^^^^^^^^^^^^^^^^

When done editing the files, commit, push and apply them via the corresponding
ansible playbook:

::

    sudo rbac-playbook groups/koji-hub.yml
    sudo rbac-playbook groups/releng-compose.yml
    sudo rbac-playbook groups/bodhi-backend.yml
    sudo rbac-playbook openshift-apps/greenwave.yml
    sudo -i ansible-playbook /srv/web/infra/ansible/playbooks/groups/proxies.yml -t pkgdb2
    sudo rbac-playbook groups/mbs.yml -t mbs

Ask someone in fedora infra to run the robosignatory playbook.


Koji
----
The koji build system needs to have some tag/target work done to handle builds
from the new branch and to update where builds from rawhide go.

Run `make-koji-release-tags`_ script in `pagure releng`_ repo


Fedora Release
--------------
The ``fedora-release`` package needs to be updated in Rawhide and Branched.

Changes to ``fedora-release.spec`` in the **rawhide** branch:

1. Increment ``%define dist_version``::

    -%define dist_version 35
    +%define dist_version 36

2. Increment ``Version:`` and reset ``Release:``::

    -Version:        35
    -Release:        0.3%{?eln:.eln%{eln}}
    +Version:        36
    +Release:        0.1%{?eln:.eln%{eln}}

3. Add a ``%changelog`` entry::

     %changelog
    +* Tue Feb 23 2021 Mohan Boddu <mboddu@bhujji.com> - 36-0.1
    +- Setup for rawhide being F36

Changes to ``fedora-release.spec`` in the **branched** branch:

1. Adjust ``release_name`` and unset ``is_rawhide``::

    -%define release_name Rawhide
    -%define is_rawhide 1
    +%define release_name Thirty Five
    +%define is_rawhide 0

2. Verify the correct number for ``dist_version`` and ``Version:``::

    %define dist_version 35
    Version:        35

3. Bump ``Release:``::

    -Release:        0.3%{?eln:.eln%{eln}}
    +Release:        0.4%{?eln:.eln%{eln}}

3. Add a ``%changelog`` entry::

     %changelog
    +* Tue Feb 23 2021 Mohan Boddu <mboddu@bhujji.com> - 35-0.4
    +- Branching F35 from rawhide


Fedora Repos
------------

The ``fedora-repos`` package needs to be updated in Rawhide, Branched, and also
in all stable release branches (in order to receive new GPG keys and updated
symlinks).

Changes to the **rawhide** branch (mostly in ``fedora-repos.spec``):

1. Generate and add a *Rawhide+1* GPG key file, then add it to the spec file::

    Source57:       RPM-GPG-KEY-fedora-37-primary

2. Update the ``archmap`` file and define architectures for *Rawhide+1*::

    +fedora-37-primary: x86_64 armhfp aarch64 ppc64le s390x

3. Increment ``%global rawhide_release``::

    -%global rawhide_release 35
    +%global rawhide_release 36

4. Bump ``Version:`` and reset ``Release:``::

    -Version:        35
    -Release:        0.2%{?eln:.eln%{eln}}
    +Version:        36
    +Release:        0.1%{?eln:.eln%{eln}}

5. Add a ``%changelog`` entry::

     %changelog
    +* Tue Feb 23 2021 Tomas Hrcka <thrcka@redhat.com> - 36-0.1
    +- Setup for rawhide being F36

Changes to the **branched** branch (mostly in ``fedora-repos.spec``):

1. Copy the *Rawhide+1* GPG key file from the *rawhide* branch, then add it to
   the spec file::

    Source57:       RPM-GPG-KEY-fedora-37-primary

2. Copy the ``archmap`` file from the *rawhide* branch.
3. Update ``%global rawhide_release``::

    -%global rawhide_release 35
    +%global rawhide_release 36

4. Enable ``updates_testing_enabled``::

    -%global updates_testing_enabled 0
    +%global updates_testing_enabled 1

5. Bump ``Release:``::

    -Release:        0.2%{?eln:.eln%{eln}}
    +Release:        0.3%{?eln:.eln%{eln}}

6. Add a ``%changelog`` entry::

     %changelog
    +* Tue Feb 23 2021 Tomas Hrcka <thrcka@redhat.com> - 35-0.3
    +- Update Rawhide definition, enable updates-testing for Branched

.. note::
    Build ``fedora-release`` and ``fedora-repos`` packages for Branched release **before enabling the Rawhide gating**.

Changes to the **stable** branches (mostly in ``fedora-repos.spec``):

1. Copy the *Rawhide+1* GPG key file from the *rawhide* branch, then add it to
   the spec file::

    Source57:       RPM-GPG-KEY-fedora-37-primary

2. Copy the ``archmap`` file from the *rawhide* branch.
3. Update ``%global rawhide_release``::

    -%global rawhide_release 35
    +%global rawhide_release 36

4. Bump ``Release:``::

    -Release:        0.2%{?eln:.eln%{eln}}
    +Release:        0.3%{?eln:.eln%{eln}}

5. Add a ``%changelog`` entry::

     %changelog
    +* Tue Feb 23 2021 Tomas Hrcka <thrcka@redhat.com> - 34-0.3
    +- Update Rawhide definition


Bodhi
-----

Linking Empty Repos
^^^^^^^^^^^^^^^^^^^

We need to link empty repos so that new-updates-sync wont complain about missing repos.
The following commands should be run on **bodhi-backend01.phx2.fedoraproject.org**

::

    $ sudo ln -s /mnt/koji/compose/updates/empty-repo/ /mnt/koji/compose/updates/f32-updates
    $ sudo ln -s /mnt/koji/compose/updates/empty-repo/ /mnt/koji/compose/updates/f32-updates-testing
    $ sudo ln -s /mnt/koji/compose/updates/empty-repo/ /mnt/koji/compose/updates/f32-modular-updates
    $ sudo ln -s /mnt/koji/compose/updates/empty-repo/ /mnt/koji/compose/updates/f32-modular-updates-testing

Creating Empty Repos
^^^^^^^^^^^^^^^^^^^^

To create empty repos on the master mirror, run `create_emtpy_repos.sh`_ from `pagure releng`_ repo.
This should be run on **bodhi-backend01.phx2.fedoraproject.org**

::

    $ sudo -u ftpsync sh scripts/branching/create_empty_repos.sh 31

.. note::
    Please verify the repo permissions that are created under /pub/fedora/linux/development/<fedora_release_number>
    and /pub/fedora-secondary/development/<fedora_release_number>. They should be owned by *ftpsync:ftpsync*

Creating rawhide release
^^^^^^^^^^^^^^^^^^^^^^^^

To create a rawhide release in bodhi, you need to run

::

    $ bodhi releases create --name "F36" --long-name "Fedora 36" --id-prefix FEDORA --version 36 --branch f36 --dist-tag f36 --stable-tag f36 --testing-tag f36-updates-testing --candidate-tag f36-updates-candidate --pending-stable-tag f36-updates-pending --pending-testing-tag f36-updates-testing-pending --pending-signing-tag f36-signing-pending --state pending --override-tag f36-override --create-automatic-updates --not-composed-by-bodhi

To create a container release for rawhide in bodhi, you need to run

::

    $ bodhi releases create --name "F36C" --long-name "Fedora 36 Containers" --id-prefix FEDORA-CONTAINER --version 36 --branch f36 --dist-tag f36-container --stable-tag f36-container-updates --testing-tag f36-container-updates-testing --candidate-tag f36-container-updates-candidate --pending-stable-tag f36-container-updates-pending --pending-testing-tag f36-container-updates-testing-pending --state pending --override-tag f36-container-override

To create a flatpak release for branched in bodhi, you need to run

::

    $ bodhi releases create --name "F35F" --long-name "Fedora 35 Flatpaks" --id-prefix FEDORA-FLATPAK --version 35 --branch f35 --dist-tag f35-flatpak --stable-tag f35-flatpak-updates --testing-tag f35-flatpak-updates-testing --candidate-tag f35-flatpak-updates-candidate --pending-stable-tag f35-flatpak-updates-pending --pending-testing-tag f35-flatpak-updates-testing-pending --state pending --override-tag f35-flatpak-override

You need to run the ``bodhi openshift`` playbook, so that UI will know about the new release.
Then, you need to restart **fm-consumer@config.service** and **bodhi-celery.service** services on
**bodhi-backend01.phx2.fedoraproject.org**

::

    $ sudo rbac-playbook openshift-apps/bodhi.yml
    $ sudo systemctl restart fm-consumer@config.service bodhi-celery.service


.. note::
    Build fedora-release, fedora-repos package for **rawhide after enabling the rawhide gating**

Update rawhide koji repo
^^^^^^^^^^^^^^^^^^^^^^^^

We need to point the *rawhide* buildroot repo to the newly created rawhide buildroot. This way kojira doesn't make a newrepo for *rawhide* target as often as fxx-build (new rawhide buildroot).

Run the following command from any of the compose boxes

::
    $ cd /mnt/koji/repos/rawhide; rm -f latest; ln -s ../f34-build/latest ./latest

Update block_retired.py script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

`block_retired.py`_ script in releng repo should be updated with rawhide release and also branched release should be added to the script.

Please look at this `block_retired.py commit`_ as an example.

Updating MirrorManager
^^^^^^^^^^^^^^^^^^^^^^

We need to update the mirrormanager so that it will point rawhide to the new rawhide release.

Please follow the instructions in the `fedora infra ticket`_ to update the database of mirrormanager.

Enable autosigning on branched release
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Once the branched compose is composed, we need to re-enable robosignatory on branched release


Fedora Container Base Image
---------------------------

In order to enable builds for Container Base Images via the `Fedora Layered
Image Build System`_ we will need to import a new image for Rawhide as well as
for the new ``fedora:rawhide`` and ``fedora:${RAWHIDE}`` tags.

Check for the latest successful Rawhide Base Image composed image `here
<https://koji.fedoraproject.org/koji/packageinfo?packageID=21546>`_.

On ``compose-x86-01.phx2`` run:

::

    # Update this to be the correct URL for your image
    $ BASEIMAGE_URL="https://kojipkgs.fedoraproject.org//packages/Fedora-Docker-Base/Rawhide/20170310.n.0/images/Fedora-Docker-Base-Rawhide-20170310.n.0.x86_64.tar.xz"

    # Update this to whatever version number Rawhide now points to
    $ RAWHIDE="27"

    # Load the latest, find it's image name
    $ sudo docker load < <(curl -s "${BASEIMAGE_URL}")
    $ sudo docker images | grep base-rawhide
    fedora-docker-base-rawhide-20170310.n.0.x86_64      latest      ffd832a990ca        5 hours ago     201.8 MB

    # Tag everything
    $ sudo docker tag fedora-docker-base-rawhide-20170310.n.0.x86_64 candidate-registry.fedoraproject.org/fedora:rawhide
    $ sudo docker tag fedora-docker-base-rawhide-20170310.n.0.x86_64 candidate-registry.fedoraproject.org/fedora:${RAWHIDE}
    $ sudo docker tag fedora-docker-base-rawhide-20170310.n.0.x86_64 registry.fedoraproject.org/fedora:rawhide
    $ sudo docker tag fedora-docker-base-rawhide-20170310.n.0.x86_64 registry.fedoraproject.org/fedora:${RAWHIDE

    # Push the images
    $ sudo docker push candidate-registry.fedoraproject.org/fedora:rawhide
    $ sudo docker push candidate-registry.fedoraproject.org/fedora:${RAWHIDE}
    $ sudo docker push registry.fedoraproject.org/fedora:rawhide
    $ sudo docker push registry.fedoraproject.org/fedora:${RAWHIDE}

    # Clean up after ourselves
    $ sudo docker rmi fedora-docker-base-rawhide-20170310.n.0.x86_64
    Untagged: fedora-docker-base-rawhide-20170310.n.0.x86_64:latest
    $ for i in $(sudo docker images -q -f 'dangling=true'); do sudo docker rmi $i; done

Update sync script
^^^^^^^^^^^^^^^^^^

In releng repository update `script
<https://pagure.io/releng/blob/main/f/scripts/sync-latest-container-base-image.sh#_38>`_.

And set current_rawhide variable.

Consider Before Running
=======================

.. note::
    FIXME: Need some love here



.. _pkgdb-proxy role:
    https://pagure.io/fedora-infra/ansible/blob/main/f/roles/pkgdb-proxy
.. _packages3 role:
    https://pagure.io/fedora-infra/ansible/blob/main/f/roles/packages3
.. _bodhi2 role:
    https://pagure.io/fedora-infra/ansible/blob/main/f/roles/bodhi2
.. _greenwave openshift role:
    https://pagure.io/fedora-infra/ansible/blob/main/f/roles/openshift-apps/greenwave
.. _mbs role:
    https://pagure.io/fedora-infra/ansible/blob/main/f/roles/mbs
.. _releng role:
    https://pagure.io/fedora-infra/ansible/blob/main/f/roles/releng
.. _robosignatory role:
    https://pagure.io/fedora-infra/ansible/blob/main/f/roles/robosignatory
.. _make-koji-release-tags:
    https://pagure.io/releng/blob/main/f/scripts/branching/make-koji-release-tags
.. _pagure releng:
    https://pagure.io/releng
.. _create_emtpy_repos.sh:
    https://pagure.io/releng/blob/main/f/scripts/branching/create_empty_repos.sh
.. _Fedora Layered Image Build System:
    https://docs.pagure.org/releng/layered_image_build_service.html
.. _fedscm-admin commit:
    https://pagure.io/fedscm-admin/c/7862d58b5982803dbe4c47e0262c6ce78bc903db?branch=main
.. _block_retired.py:
    https://pagure.io/releng/blob/main/f/scripts/block_retired.py
.. _block_retired.py commit:
    https://pagure.io/releng/c/9eb97f491f7a767ab8b90498adfa3b34ee235247?branch=main
.. _fedora infra ticket:
    https://pagure.io/fedora-infrastructure/issue/9239#comment-671446