diff --git a/releasers.conf.5.asciidoc b/releasers.conf.5.asciidoc index 40077a2..c9381ab 100644 --- a/releasers.conf.5.asciidoc +++ b/releasers.conf.5.asciidoc @@ -80,6 +80,25 @@ The 'placeholder_bz' property can be specified to use if no bugs were found in t required_bz_flags = myos-1.1.0+ pm_ack+ placeholder_bz = 100000 + + +tito.release.CentosGitReleaser:: +Releaser which will checkout your fork in the project in the Centos Stream git using centpkg. +A new branch off your fork is then created for the changes. This is produced in the same way +as the FedoraGitReleaser with a .tar file that is loaded to the lookaside. The branch gets +pushed to the forked repo and tito is done. The process then requires the manual creation of +a merge request against the main repo of the release which is done in the web UI. ++ +The 'required_bz_flags' property can be specified to have tito check Red Hat Bugzilla to see if each bug number extracted from the changelog has appropriate flags. If it does not, it will be skipped in the commit message. If no bugs are found with the required tags, a 'placeholder_bz' can be specified (see below), otherwise the release will abort. ++ +The 'placeholder_bz' property can be specified to use if no bugs were found in the changelog with the required flags. ++ + [centos-git] + releaser = tito.release.CentosGitReleaser + branches = c9s + required_bz_flags = release+ + placeholder_bz = 100000 ++ + If you would like to build (ie - koji) against a different target than what is default for the FedoraGit/DistGit branch currently being worked on it can be done like the following example. diff --git a/src/tito/release/__init__.py b/src/tito/release/__init__.py index 1fdd18d..41f7981 100644 --- a/src/tito/release/__init__.py +++ b/src/tito/release/__init__.py @@ -7,6 +7,6 @@ from tito.release.main import \ KojiReleaser, \ KojiGitReleaser -from tito.release.distgit import FedoraGitReleaser, DistGitReleaser, DistGitMeadReleaser +from tito.release.distgit import FedoraGitReleaser, DistGitReleaser, DistGitMeadReleaser, CentosGitReleaser from tito.release.obs import ObsReleaser from tito.release.copr import CoprReleaser diff --git a/src/tito/release/distgit.py b/src/tito/release/distgit.py index 5c96152..1886001 100644 --- a/src/tito/release/distgit.py +++ b/src/tito/release/distgit.py @@ -10,7 +10,7 @@ # Red Hat trademarks are not licensed under GPLv2. No permission is # granted to use or replicate Red Hat trademarks that are incorporated # in this software or its documentation. - +import datetime import os.path import subprocess import sys @@ -215,7 +215,7 @@ class FedoraGitReleaser(Releaser): os.unlink(commit_msg_file) - cmd = "%s push" % self.cli_tool + cmd = self._push_command() if self.dry_run: self.print_dry_run_warning(cmd) else: @@ -249,6 +249,9 @@ class FedoraGitReleaser(Releaser): print + def _push_command(self): + return "%s push" % self.cli_tool + def _merge(self, main_branch): try: run_command("git merge %s" % main_branch) @@ -424,6 +427,68 @@ class DistGitReleaser(FedoraGitReleaser): self.cli_tool = "rhpkg" +class CentosGitReleaser(FedoraGitReleaser): + """ + This process follows the choreography defined for the Centos9 Stream. + It will create a branch on the user's fork of the main repo. + That branch is merged to the main repo via pull request on the + web interface. There is no build option usable from this process + because it is not synchronous. + + It is limited to only acting on a single Centos stream. Only the first + entry in 'branches' in the conf file will be used. + """ + + def __init__(self, name=None, tag=None, build_dir=None, + config=None, user_config=None, + target=None, releaser_config=None, no_cleanup=False, + test=False, auto_accept=False, **kwargs): + FedoraGitReleaser.__init__(self, name, tag, build_dir, config, + user_config, target, releaser_config, no_cleanup, test, + auto_accept, **kwargs) + # Override the cli_tool config from Fedora: + if "CENTPKG_USER" in user_config: + self.cli_tool = "centpkg --user={user}".format(user=user_config["CENTPKG_USER"]) + self.username = user_config["CENTPKG_USER"] + else: + self.cli_tool = "centpkg" + self.username = getpass.getuser() + + def _git_release(self): + os.makedirs(self.working_dir, exist_ok=True) + with chdir(self.working_dir): + run_command("{cli_tool} clone {project_name}".format(cli_tool=self.cli_tool, + project_name=self.project_name)) + + with chdir(self.package_workdir): + run_command("{cli_tool} fork".format(cli_tool=self.cli_tool)) + run_command("git fetch {username}".format(username=self.username)) + self.new_branch_name = "release-branch-{timestamp}".format( + timestamp=int(datetime.datetime.utcnow().timestamp())) + run_command("git checkout -b {new_branch_name} {username}/{branch}".format( + new_branch_name=self.new_branch_name, + username=self.username, + branch=self.git_branches[0])) + + # Mead builds need to be in the git_root. Other builders are agnostic. + with chdir(self.git_root): + self.builder.tgz() + self.builder.copy_extra_sources() + + if self.test: + self.builder._setup_test_specfile() + + self._git_sync_files(self.package_workdir) + self._git_upload_sources(self.package_workdir) + self.no_build = True + self.git_branches = self.git_branches[:1] + self._git_user_confirm_commit(self.package_workdir) + + def _push_command(self): + return "git push {username} {new_branch_name}".format(username=self.username, + new_branch_name=self.new_branch_name) + + class DistGitMeadReleaser(DistGitReleaser): REQUIRED_CONFIG = ['mead_scm', 'branches']