-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move from travis to Github Actions CI (#873)
Workflow is now managed by pulp/plugin-template Issue: AAH-460
- Loading branch information
1 parent
4c90fd1
commit 953b89f
Showing
73 changed files
with
2,387 additions
and
753 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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
Empty file.
Empty file.
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,7 @@ | ||
{ | ||
"default_options": [ | ||
"--ignore-stdin", | ||
"--pretty=format", | ||
"--traceback" | ||
] | ||
} |
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,4 @@ | ||
bump2version | ||
gitpython | ||
python-redmine | ||
towncrier |
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 galaxy_ng' 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
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 galaxy_ng' 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 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,35 @@ | ||
# WARNING: DO NOT EDIT! | ||
# | ||
# This file was generated by plugin_template, and is managed by it. Please use | ||
# './plugin-template --github galaxy_ng' to update this file. | ||
# | ||
# For more info visit https://github.com/pulp/plugin_template | ||
|
||
import os | ||
import sys | ||
|
||
from redminelib import Redmine | ||
|
||
REDMINE_API_KEY = os.environ["REDMINE_API_KEY"] | ||
REDMINE_QUERY_URL = sys.argv[1] | ||
MILESTONE_URL = sys.argv[2] | ||
RELEASE = sys.argv[3] | ||
CLOSED_CURRENTRELEASE = 11 | ||
|
||
redmine = Redmine(REDMINE_QUERY_URL.split("issues")[0], key=REDMINE_API_KEY) | ||
query_issues = REDMINE_QUERY_URL.split("=")[-1].split(",") | ||
milestone_name = redmine.version.get(MILESTONE_URL.split("/")[-1].split(".")[0]).name | ||
if milestone_name != RELEASE: | ||
raise RuntimeError(f"Milestone name, '{milestone_name}', does not match version, '{RELEASE}'.") | ||
|
||
to_update = [] | ||
for issue in query_issues: | ||
status = redmine.issue.get(int(issue)).status.name | ||
if "CLOSE" not in status and status != "MODIFIED": | ||
raise ValueError("One or more issues are not MODIFIED") | ||
if status == "MODIFIED": # Removing the already closed | ||
to_update.append(int(issue)) | ||
|
||
for issue in to_update: | ||
print(f"Closing #{issue}") | ||
redmine.issue.update(issue, status_id=CLOSED_CURRENTRELEASE) |
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,23 @@ | ||
""" | ||
Customizing OpenAPI validation. | ||
OpenAPI requires paths to start with slashes: | ||
https://spec.openapis.org/oas/v3.0.3#patterned-fields | ||
But some pulp paths start with curly brackets e.g. {artifact_href} | ||
This script modifies drf-spectacular schema validation to accept slashes and curly brackets. | ||
""" | ||
import json | ||
from drf_spectacular.validation import JSON_SCHEMA_SPEC_PATH | ||
|
||
with open(JSON_SCHEMA_SPEC_PATH) as fh: | ||
openapi3_schema_spec = json.load(fh) | ||
|
||
properties = openapi3_schema_spec["definitions"]["Paths"]["patternProperties"] | ||
# Making OpenAPI validation to accept paths starting with / and { | ||
if "^\\/|{" not in properties: | ||
properties["^\\/|{"] = properties["^\\/"] | ||
del properties["^\\/"] | ||
|
||
with open(JSON_SCHEMA_SPEC_PATH, "w") as fh: | ||
json.dump(openapi3_schema_spec, fh) |
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,26 @@ | ||
#!/bin/bash | ||
|
||
# WARNING: DO NOT EDIT! | ||
# | ||
# This file was generated by plugin_template, and is managed by it. Please use | ||
# './plugin-template --github galaxy_ng' 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 -euv | ||
|
||
export COMMIT_MSG=$(git log --format=%B --no-merges -1) | ||
export RELEASE=$(echo $COMMIT_MSG | awk '{print $2}') | ||
export MILESTONE_URL=$(echo $COMMIT_MSG | grep -o "Redmine Milestone: .*" | awk '{print $3}') | ||
export REDMINE_QUERY_URL=$(echo $COMMIT_MSG | grep -o "Redmine Query: .*" | awk '{print $3}') | ||
|
||
echo "Releasing $RELEASE" | ||
echo "Milestone URL: $MILESTONE_URL" | ||
echo "Query: $REDMINE_QUERY_URL" | ||
|
||
pip install python-redmine httpie | ||
|
||
python3 .ci/scripts/redmine.py $REDMINE_QUERY_URL $MILESTONE_URL $RELEASE |
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
File renamed without changes.
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,18 @@ | ||
update_manifest: | ||
|
||
runs-on: ubuntu-latest | ||
needs: test | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: {{ "${{ github.event.after }}" }} # for PR avoids checking out merge commit | ||
fetch-depth: 0 # include all history | ||
|
||
- name: Update Manifest for Ansible Hub UI | ||
env: | ||
GITHUB_PULL_REQUEST: {{ "${{ github.event.number }}" }} | ||
GITHUB_BRANCH: {{ "${{ github.head_ref }}" }} | ||
GITHUB_REPO_SLUG: {{ "${{ github.repository }}" }} | ||
run: .github/workflows/scripts/update_manifest.sh | ||
shell: bash |
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,17 @@ | ||
check_commit: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: {{ "${{ github.event.after }}" }} # for PR avoids checking out merge commit | ||
fetch-depth: 0 # include all history | ||
|
||
- name: Run script to validate commits for both pull request and a push | ||
env: | ||
GITHUB_PR_COMMITS_URL: {{ "${{ github.event.pull_request.commits_url }}" }} | ||
START_COMMIT: {{ "${{ github.event.before }}" }} | ||
END_COMMIT: {{ "${{ github.event.after }}" }} | ||
run: | | ||
python .ci/scripts/validate_commit_message_custom.py |
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 @@ | ||
2021.04.08-88-ga67f224-dirty |
Oops, something went wrong.