forked from pulp/pulp_container
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[noissue]
- Loading branch information
Showing
50 changed files
with
2,049 additions
and
629 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ all: | |
pulp: | ||
pulp-fixtures: | ||
minio: | ||
ci-sftp: | ||
vars: | ||
ansible_connection: docker | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import re | ||
import os | ||
import requests | ||
from packaging.version import Version | ||
from git import Repo | ||
|
||
repo = Repo(os.getcwd()) | ||
heads = repo.git.ls_remote("--heads", "https://github.com/pulp/pulp_container.git").split("\n") | ||
branches = [h.split("/")[-1] for h in heads if re.search(r"^([0-9]+)\.([0-9]+)$", h.split("/")[-1])] | ||
branches.sort(key=lambda ver: Version(ver), reverse=True) | ||
|
||
|
||
def get_changelog(branch): | ||
""" | ||
Get changelog file for a given branch. | ||
""" | ||
return requests.get( | ||
f"https://raw.githubusercontent.com/pulp/pulp_container/{branch}/CHANGES.rst" | ||
).text | ||
|
||
|
||
def get_changelog_releases(changelog): | ||
""" | ||
Get all versions in changelog. | ||
""" | ||
versions = re.findall(r"([0-9]+)\.([0-9]+)\.([0-9]+) \(", changelog) | ||
return {".".join(v) for v in versions} | ||
|
||
|
||
def get_changelog_entry(changelog, version): | ||
""" | ||
Get changelog entry for a given version. | ||
""" | ||
entries = changelog.split(f"{version} (")[1].split("=====\n") | ||
header = f"{version} ({entries[0]}=====\n" | ||
text = "\n\n\n".join(entries[1].split("\n\n\n")[0:-1]) | ||
return header + text + "\n\n\n" | ||
|
||
|
||
main_changelog = get_changelog("master") | ||
main_entries = get_changelog_releases(main_changelog) | ||
entries_list = list(main_entries) | ||
to_add = {} | ||
for branch in branches: | ||
changelog = get_changelog(branch) | ||
entries = get_changelog_releases(changelog) | ||
for entry in entries.difference(main_entries): | ||
description = get_changelog_entry(changelog, entry) | ||
entries_list.append(entry) | ||
print(description) | ||
to_add[entry] = description | ||
|
||
entries_list.sort(key=lambda ver: Version(ver), reverse=True) | ||
for version in sorted(to_add, key=lambda ver: Version(ver)): | ||
next_version = entries_list[entries_list.index(version) + 1] | ||
new_changelog = main_changelog.split(f"{next_version} (")[0] + to_add[version] | ||
new_changelog = new_changelog + f"{next_version} (" | ||
new_changelog = new_changelog + main_changelog.split(f"{next_version} (")[1] | ||
main_changelog = new_changelog | ||
|
||
with open("CHANGES.rst", "w") as f: | ||
f.write(main_changelog) | ||
|
||
if to_add: | ||
repo.git.commit("-m", "Update Changelog\n\n[noissue]", "CHANGES.rst") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# WARNING: DO NOT EDIT! | ||
# | ||
# This file was generated by plugin_template, and is managed by it. Please use | ||
# './plugin-template --github pulp_container' to update this file. | ||
# | ||
# For more info visit https://github.com/pulp/plugin_template | ||
|
||
# make sure this script runs at the repo root | ||
cd "$(dirname "$(realpath -e "$0")")"/../.. | ||
|
||
set -uv | ||
|
||
# check for imports not from pulpcore.plugin. exclude tests | ||
MATCHES=$(grep -n -r --include \*.py "_(f") | ||
|
||
if [ $? -ne 1 ]; then | ||
printf "\nERROR: Detected mix of f-strings and gettext:\n" | ||
echo "$MATCHES" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
# WARNING: DO NOT EDIT! | ||
# | ||
# This file was generated by plugin_template, and is managed by it. Please use | ||
# './plugin-template --github pulp_container' to update this file. | ||
# | ||
# For more info visit https://github.com/pulp/plugin_template | ||
|
||
set -e | ||
|
||
if [ ! -d CHANGES ]; then | ||
echo "Error: no CHANGES directory detected. This script must be run from the project root." | ||
exit 1 | ||
fi | ||
|
||
if [ $# -lt 3 ] | ||
then | ||
echo "Usage: .ci/scripts/cherrypick.sh [commit-hash] [original-issue-id] [backport-issue-id]" | ||
echo " ex: .ci/scripts/cherrypick.sh abcd1234 1234 4567" | ||
echo "" | ||
echo "Note: make sure you are on a fork of the release branch before running this script." | ||
exit | ||
fi | ||
|
||
commit="$(git rev-parse $1)" | ||
issue="$2" | ||
backport="$3" | ||
commit_message=$(git log --format=%B -n 1 $commit) | ||
|
||
if ! echo $commit_message | tr '[:upper:]' '[:lower:]' | grep -q "\[noissue\]" | ||
then | ||
if ! echo $commit_message | tr '[:upper:]' '[:lower:]' | grep -q -E "(fixes|closes).*#$issue" | ||
then | ||
echo "Error: issue $issue not detected in commit message." && exit 1 | ||
fi | ||
fi | ||
|
||
if [ "$4" = "--continue" ] | ||
then | ||
echo "Continue after manually resolving conflicts..." | ||
elif [ "$4" = "" ] | ||
then | ||
if ! git cherry-pick --no-commit "$commit" | ||
then | ||
echo "Please resolve and add merge conflicts and restart this command with appended '--continue'." | ||
exit 1 | ||
fi | ||
else | ||
exit 1 | ||
fi | ||
|
||
for file in $(find CHANGES -name "$issue.*") | ||
do | ||
newfile="${file/$issue/$backport}" | ||
git mv "$file" "$newfile" | ||
sed -i -e "\$a (backported from #$issue)" "$newfile" | ||
git add "$newfile" | ||
done | ||
|
||
commit_message="$(printf "$commit_message" | sed -E 's/(fixes|closes)/backports/i')" | ||
commit_message="$commit_message | ||
fixes #$backport | ||
(cherry picked from commit $commit)" | ||
git commit -m "$commit_message" | ||
|
||
printf "\nSuccessfully backported commit $1.\n" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.