Skip to content

Commit 35ad509

Browse files
authored
Merge pull request #325 from gerrod3/banderpin
Removed travis, updated CI, and pinned Bandersnatch==4.4.0
2 parents 722b807 + bc6dd04 commit 35ad509

39 files changed

Lines changed: 71 additions & 1700 deletions

.ci/scripts/cherrypick.py

Lines changed: 0 additions & 128 deletions
This file was deleted.

.ci/scripts/cherrypick.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

.ci/scripts/docs-builder.py

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
import re
1414
from shutil import rmtree
1515
import tempfile
16+
import requests
17+
import json
18+
from packaging import version
1619

1720
WORKING_DIR = os.environ["WORKSPACE"]
1821

@@ -90,8 +93,17 @@ def main():
9093

9194
ga_build = False
9295

96+
publish_at_root = False
97+
9398
if (not re.search("[a-zA-Z]", branch) or "post" in branch) and len(branch.split(".")) > 2:
9499
ga_build = True
100+
# Only publish docs at the root if this is the latest version
101+
r = requests.get("https://pypi.org/pypi/pulp-python/json")
102+
latest_version = version.parse(json.loads(r.text)["info"]["version"])
103+
docs_version = version.parse(branch)
104+
if latest_version == docs_version:
105+
publish_at_root = True
106+
# Post releases should use the x.y.z part of the version string to form a path
95107
if "post" in branch:
96108
branch = ".".join(branch.split(".")[:-1])
97109

@@ -122,22 +134,23 @@ def main():
122134
elif ga_build:
123135
# This is a GA build.
124136
# publish to the root of docs.pulpproject.org
125-
version_components = branch.split(".")
126-
x_y_version = "{}.{}".format(version_components[0], version_components[1])
127-
remote_path_arg = "%s@%s:%s" % (USERNAME, HOSTNAME, SITE_ROOT)
128-
rsync_command = [
129-
"rsync",
130-
"-avzh",
131-
"--delete",
132-
"--exclude",
133-
"en",
134-
"--omit-dir-times",
135-
local_path_arg,
136-
remote_path_arg,
137-
]
138-
exit_code = subprocess.call(rsync_command, cwd=docs_directory)
139-
if exit_code != 0:
140-
raise RuntimeError("An error occurred while pushing docs.")
137+
if publish_at_root:
138+
version_components = branch.split(".")
139+
x_y_version = "{}.{}".format(version_components[0], version_components[1])
140+
remote_path_arg = "%s@%s:%s" % (USERNAME, HOSTNAME, SITE_ROOT)
141+
rsync_command = [
142+
"rsync",
143+
"-avzh",
144+
"--delete",
145+
"--exclude",
146+
"en",
147+
"--omit-dir-times",
148+
local_path_arg,
149+
remote_path_arg,
150+
]
151+
exit_code = subprocess.call(rsync_command, cwd=docs_directory)
152+
if exit_code != 0:
153+
raise RuntimeError("An error occurred while pushing docs.")
141154
# publish to docs.pulpproject.org/en/3.y/
142155
make_directory_with_rsync(["en", x_y_version])
143156
remote_path_arg = "%s@%s:%sen/%s/" % (

.ci/scripts/release.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import argparse
99
import json
10+
import re
1011
import os
1112
import textwrap
1213
from collections import defaultdict
@@ -74,11 +75,12 @@ def validate_redmine_data(redmine_query_url, redmine_issues):
7475
with open(f"{plugin_path}/setup.py") as fp:
7576
for line in fp.readlines():
7677
if "version=" in line:
77-
version = line.split('"')[1]
78+
version = re.split("\"|'", line)[1]
7879
if not version:
7980
raise RuntimeError("Could not detect existing version ... aborting.")
8081
release_version = version.replace(".dev", "")
8182

83+
8284
issues_to_close = []
8385
for filename in Path(f"{plugin_path}/CHANGES").rglob("*"):
8486
if filename.stem.isdigit():
@@ -185,7 +187,7 @@ def validate_redmine_data(redmine_query_url, redmine_issues):
185187
with open(f"{plugin_path}/setup.py") as fp:
186188
for line in fp.readlines():
187189
if "version=" in line:
188-
new_dev_version = line.split('"')[1]
190+
new_dev_version = re.split("\"|'", line)[1]
189191
if not new_dev_version:
190192
raise RuntimeError("Could not detect new dev version ... aborting.")
191193

.ci/scripts/schema.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Customizing OpenAPI validation.
3+
4+
OpenAPI requires paths to start with slashes:
5+
https://spec.openapis.org/oas/v3.0.3#patterned-fields
6+
7+
But some pulp paths start with curly brackets e.g. {artifact_href}
8+
This script modifies drf-spectacular schema validation to accept slashes and curly brackets.
9+
"""
10+
import json
11+
from drf_spectacular.validation import JSON_SCHEMA_SPEC_PATH
12+
13+
with open(JSON_SCHEMA_SPEC_PATH) as fh:
14+
openapi3_schema_spec = json.load(fh)
15+
16+
properties = openapi3_schema_spec["definitions"]["Paths"]["patternProperties"]
17+
# Making OpenAPI validation to accept paths starting with / and {
18+
if "^\\/|{" not in properties:
19+
properties["^\\/|{"] = properties["^\\/"]
20+
del properties["^\\/"]
21+
22+
with open(JSON_SCHEMA_SPEC_PATH, "w") as fh:
23+
json.dump(openapi3_schema_spec, fh)

.github/workflows/scripts/script.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ if [[ "$TEST" = "docs" || "$TEST" = "publish" ]]; then
3131
make PULP_URL="http://pulp" html
3232
cd ..
3333

34+
echo "Validating OpenAPI schema..."
35+
cat $PWD/.ci/scripts/schema.py | cmd_stdin_prefix bash -c "cat > /tmp/schema.py"
36+
cmd_prefix bash -c "python /tmp/schema.py"
37+
cmd_prefix bash -c "pulpcore-manager spectacular --file pulp_schema.yml --validate"
38+
3439
if [ -f $POST_DOCS_TEST ]; then
3540
source $POST_DOCS_TEST
3641
fi
@@ -90,6 +95,15 @@ cmd_prefix bash -c "PULP_DATABASES__default__USER=postgres django-admin test --n
9095
# Run functional tests
9196
export PYTHONPATH=$REPO_ROOT:$REPO_ROOT/../pulpcore${PYTHONPATH:+:${PYTHONPATH}}
9297

98+
if [[ "$TEST" == "performance" ]]; then
99+
if [[ -z ${PERFORMANCE_TEST+x} ]]; then
100+
pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulp_python.tests.performance
101+
else
102+
pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulp_python.tests.performance.test_$PERFORMANCE_TEST
103+
fi
104+
exit
105+
fi
106+
93107
if [ -f $FUNC_TEST_SCRIPT ]; then
94108
source $FUNC_TEST_SCRIPT
95109
else

.travis.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.travis/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.travis/Containerfile.j2

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)