Repository: rucio/rucio

Issue:
`release-patch-setup`: consider removing from autotests
`release-patch-setup` tests that PR changes can be merged to the latest release branch ([example](https://github.com/rucio/rucio/actions/runs/8202030960/job/22431939561?pr=6539))

We initially discussed that we could make it output a `warning` result when it fails, rather than showing as a `failure`, but GH Actions does not have this feature yet (there is a [feature request for it](https://github.com/orgs/community/discussions/15452), and [this](https://stackoverflow.com/questions/74907704/is-there-a-github-actions-warning-state) is the best alternative I found, which results in the step showing as successful regardless, but prints out a warning in the job summary.)

While this check is useful, it seems that we're mostly ignoring its outcome at the moment, and we're not remediating it when it fails. Even though it executes pretty fast (failed in 17s in the example linked above), it can be a bit annoying to mark a PR as "failed" just because of this check.

I think we could safely remove it from the autotests for now, and possibly add it later on once GH Actions adds the `warning` outcome feature.


Discussion:
`release-patch-test` depends on `release-patch-setup` at the moment: https://github.com/rucio/rucio/blob/master/.github/workflows/autotest.yml#L206 

I think `release-patch-test` can be removed as well; they're the same tests as `test` (https://github.com/rucio/rucio/blob/master/.github/workflows/autotest.yml#L144), but done on the release branch. I feel like it might be unnecessary to run these at the PR level; generally, if tests pass on the master branch, they will likely pass on the release branch too. I also think that, from the contributor's perspective, the only checks should be against the master branch; the cherry-picking/releasing workflow happens in "parallel" to PRs/developing workflow, and I think they should be decoupled.

@bari12 what do you think?
I agree. I think we should just remove both.
There is a small group of errors where the current workflow might give us "early detection" of an issue on the release branch, which a PR author could immediately address. But in any way, we will discover the issue after the merge once the cherry-pick is done, so it is really only an early-detection.

But the much more likely scenario is to have false-positive test failures, which are to no fault of the PR author.

Resolving patch:
diff --git a/tools/github/workflow/mergetest.py b/tools/github/workflow/mergetest.py
deleted file mode 100755
--- a/tools/github/workflow/mergetest.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# Copyright European Organization for Nuclear Research (CERN) since 2012
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import json
-import os
-import pathlib
-import sys
-
-import sh
-from sh import git
-
-
-def get_github_url():
-    return os.environ.get('GITHUB_URL', default='https://github.com')
-
-
-def add_or_set_git_remote(remote_name, remote_uri):
-    if remote_name in str(git.remote()).splitlines(keepends=False):
-        git.remote("set-url", remote_name, remote_uri)
-    else:
-        git.remote.add(remote_name, remote_uri)
-
-
-def set_git_author_info(name: str, email: str):
-    git.config("user.name", name)
-    git.config("user.email", email)
-
-
-def main():
-    options = json.load(sys.stdin)
-
-    github_remote_url = f"{get_github_url()}/{options['target_remote']}.git"
-    if len(list(pathlib.Path('.').iterdir())) > 0:
-        print("Found existing files in work directory", file=sys.stderr)
-        assert pathlib.Path('.git').exists(), "if files are present in the work dir, it must be a git work tree"
-        remote = "origin"
-        if options["source_remote_name"] == remote:
-            remote = remote + "2"
-        add_or_set_git_remote(remote, github_remote_url)
-        print(f"Fetching from {github_remote_url}", file=sys.stderr)
-        git.fetch(remote)
-        print(f"Checking out {options['target_branch']} from {remote}/{options['target_branch']}", file=sys.stderr)
-        git.checkout("-B", options['target_branch'], f"{remote}/{options['target_branch']}")
-        print(f"Cleaning work tree", file=sys.stderr)
-        git.reset("--hard", "HEAD")
-        git.clean("-fdx")
-    else:
-        print(f"Cloning {options['target_branch']} from {github_remote_url}", file=sys.stderr)
-        git.clone("--branch", options['target_branch'], github_remote_url, ".")
-
-    if options['target_remote'] != options['source_remote']:
-        source_remote_name = options['source_remote_name']
-        add_or_set_git_remote(source_remote_name, f"{get_github_url()}/{options['source_remote']}.git")
-        print(f"Fetching from {get_github_url()}/{options['source_remote']}.git", file=sys.stderr)
-        git.fetch(source_remote_name)
-
-    set_git_author_info(f"GitHub Action {os.environ['GITHUB_ACTION']}", "action@localhost")
-
-    try:
-        git("cherry-pick", options['source_commits'])
-        print(f"Source commits ({options['source_commits']}) were successfully cherry-picked "
-              f"onto {options['target_remote']}:{options['target_branch']}", file=sys.stderr)
-    except sh.ErrorReturnCode:
-        print(f"Source commits ({options['source_commits']}) could not be cherry-picked "
-              f"onto {options['target_remote']}:{options['target_branch']}", file=sys.stderr)
-        raise
-
-
-if __name__ == "__main__":
-    main()
diff --git a/tools/github/workflow/prcommits.py b/tools/github/workflow/prcommits.py
deleted file mode 100755
--- a/tools/github/workflow/prcommits.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# Copyright European Organization for Nuclear Research (CERN) since 2012
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import json
-import sys
-import urllib.request
-
-from util import req_json, get_next_link
-
-
-def main():
-    commits_url = sys.stdin.read().strip()
-
-    def allcommits():
-        next_link = commits_url
-        while next_link:
-            with urllib.request.urlopen(req_json(next_link)) as answer:
-                commits = json.load(answer)
-                shalist = map(lambda c: c["sha"], commits)
-                next_link = get_next_link(answer)
-            yield from shalist
-
-    commit_list = list(allcommits())
-    print(f"{commit_list[0]}^..{commit_list[-1]}")
-
-
-if __name__ == "__main__":
-    main()


Test patch: