Skip to content

Commit 798c49e

Browse files
committed
Update Travis config
[noissue]
1 parent 9bd04fd commit 798c49e

15 files changed

+242
-32
lines changed

.travis.yml

-4
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,12 @@ env:
1919
- TEST=pulp
2020
- TEST=docs
2121
services:
22-
- postgresql
23-
- redis-server
2422
- docker
2523
addons:
2624
apt:
2725
packages:
2826
- httpie
2927
- jq
30-
# postgres versions provided by el7 RHSCL (lowest supportable version)
31-
postgresql: '9.6'
3228
before_install: .travis/before_install.sh
3329
install: .travis/install.sh
3430
before_script: .travis/before_script.sh

.travis/Containerfile.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN pip3 install python-dateutil rhsm
1515
{% if item.source.startswith("./") %}
1616
ADD {{ item.source }} {{ item.source }}
1717
{% endif %}
18-
RUN pip3 install {{ item.source }}
18+
RUN pip3 install "{{ item.source }}"
1919
RUN mkdir -p /etc/nginx/pulp/
2020
RUN ln /usr/local/lib/python3.7/site-packages/{{ item.name }}/app/webserver_snippets/nginx.conf /etc/nginx/pulp/{{ item.name }}.conf || true
2121
{% endfor %}

.travis/before_install.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ pip install -r dev_requirements.txt
5252
# Lint code.
5353
flake8 --config flake8.cfg
5454

55+
# check for any files unintentionally left out of MANIFEST.in
56+
check-manifest
57+
5558
# check for imports from pulpcore that aren't pulpcore.plugin
5659
./.travis/check_pulpcore_imports.sh
5760

@@ -101,13 +104,9 @@ fi
101104

102105

103106
# Intall requirements for ansible playbooks
104-
pip install docker netaddr boto3
107+
pip install docker netaddr boto3 ansible
105108

106-
# Install ansible with the boto3 tags to dict fix
107-
# There is a PR for this issue:
108-
# https://github.com/ansible-collections/amazon.aws/pull/37
109-
# Be aware, that the code will have moved to that collection with upcoming releases of ansible
110-
pip install git+https://github.com/mdellweg/ansible.git@fix_boto3_tags_dict
109+
ansible-galaxy collection install amazon.aws
111110

112111
cd pulp_python
113112

.travis/check_commit.sh

+2-12
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,8 @@ if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
1414
exit 0
1515
fi
1616

17-
if [ "$TRAVIS_COMMIT_RANGE" != "" ]; then
18-
RANGE=$TRAVIS_COMMIT_RANGE
19-
elif [ "$TRAVIS_COMMIT" != "" ]; then
20-
RANGE=$TRAVIS_COMMIT
21-
fi
22-
23-
# Travis sends the ranges with 3 dots. Git only wants two.
24-
if [[ "$RANGE" == *...* ]]; then
25-
RANGE=`echo $TRAVIS_COMMIT_RANGE | sed 's/\.\.\./../'`
26-
else
27-
RANGE="$RANGE~..$RANGE"
28-
fi
17+
# Switch to using ".." for git log to capture only PR commits
18+
RANGE=`echo $TRAVIS_COMMIT_RANGE | sed 's/\.\.\./../'`
2919

3020
for sha in `git log --format=oneline --no-merges "$RANGE" | cut '-d ' -f1`
3121
do

.travis/docs-builder.py

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
#!/usr/bin/env python
2+
3+
import argparse
4+
import subprocess
5+
import os
6+
import re
7+
from shutil import rmtree
8+
import tempfile
9+
10+
WORKING_DIR = os.environ["TRAVIS_BUILD_DIR"]
11+
12+
VERSION_REGEX = r"(\s*)(version)(\s*)(=)(\s*)(['\"])(.*)(['\"])(.*)"
13+
RELEASE_REGEX = r"(\s*)(release)(\s*)(=)(\s*)(['\"])(.*)(['\"])(.*)"
14+
15+
USERNAME = "doc_builder_pulp_python"
16+
HOSTNAME = "8.43.85.236"
17+
18+
SITE_ROOT = "/var/www/docs.pulpproject.org/pulp_python/"
19+
20+
21+
def make_directory_with_rsync(remote_paths_list):
22+
"""
23+
Ensure the remote directory path exists.
24+
25+
:param remote_paths_list: The list of parameters. e.g. ['en', 'latest'] to be en/latest on the
26+
remote.
27+
:type remote_paths_list: a list of strings, with each string representing a directory.
28+
"""
29+
try:
30+
tempdir_path = tempfile.mkdtemp()
31+
cwd = os.getcwd()
32+
os.chdir(tempdir_path)
33+
os.makedirs(os.sep.join(remote_paths_list))
34+
remote_path_arg = "%s@%s:%s%s" % (USERNAME, HOSTNAME, SITE_ROOT, remote_paths_list[0])
35+
local_path_arg = tempdir_path + os.sep + remote_paths_list[0] + os.sep
36+
rsync_command = ["rsync", "-avzh", local_path_arg, remote_path_arg]
37+
exit_code = subprocess.call(rsync_command)
38+
if exit_code != 0:
39+
raise RuntimeError("An error occurred while creating remote directories.")
40+
finally:
41+
rmtree(tempdir_path)
42+
os.chdir(cwd)
43+
44+
45+
def ensure_dir(target_dir, clean=True):
46+
"""
47+
Ensure that the directory specified exists and is empty.
48+
49+
By default this will delete the directory if it already exists
50+
51+
:param target_dir: The directory to process
52+
:type target_dir: str
53+
:param clean: Whether or not the directory should be removed and recreated
54+
:type clean: bool
55+
"""
56+
if clean:
57+
rmtree(target_dir, ignore_errors=True)
58+
try:
59+
os.makedirs(target_dir)
60+
except OSError:
61+
pass
62+
63+
64+
def main():
65+
"""
66+
Builds documentation using the 'make html' command and rsyncs to docs.pulpproject.org.
67+
"""
68+
parser = argparse.ArgumentParser()
69+
parser.add_argument("--build-type", required=True, help="Build type: nightly or beta.")
70+
parser.add_argument("--branch", required=True, help="Branch or tag name.")
71+
opts = parser.parse_args()
72+
if opts.build_type not in ["nightly", "tag"]:
73+
raise RuntimeError("Build type must be either 'nightly' or 'tag'.")
74+
75+
build_type = opts.build_type
76+
77+
branch = opts.branch
78+
79+
ga_build = False
80+
81+
if not re.search("[a-zA-Z]", branch) and len(branch.split(".")) > 2:
82+
ga_build = True
83+
84+
# build the docs via the Pulp project itself
85+
print("Building the docs")
86+
docs_directory = os.sep.join([WORKING_DIR, "docs"])
87+
88+
make_command = ["make", "PULP_URL=http://pulp", "diagrams", "html"]
89+
exit_code = subprocess.call(make_command, cwd=docs_directory)
90+
if exit_code != 0:
91+
raise RuntimeError("An error occurred while building the docs.")
92+
# rsync the docs
93+
local_path_arg = os.sep.join([docs_directory, "_build", "html"]) + os.sep
94+
if build_type != "tag":
95+
# This is a nightly build
96+
remote_path_arg = "%s@%s:%sen/%s/%s/" % (USERNAME, HOSTNAME, SITE_ROOT, branch, build_type)
97+
make_directory_with_rsync(["en", branch, build_type])
98+
rsync_command = ["rsync", "-avzh", "--delete", local_path_arg, remote_path_arg]
99+
exit_code = subprocess.call(rsync_command, cwd=docs_directory)
100+
if exit_code != 0:
101+
raise RuntimeError("An error occurred while pushing docs.")
102+
elif ga_build:
103+
# This is a GA build.
104+
# publish to the root of docs.pulpproject.org
105+
version_components = branch.split(".")
106+
x_y_version = "{}.{}".format(version_components[0], version_components[1])
107+
remote_path_arg = "%s@%s:%s" % (USERNAME, HOSTNAME, SITE_ROOT)
108+
rsync_command = [
109+
"rsync",
110+
"-avzh",
111+
"--delete",
112+
"--exclude",
113+
"en",
114+
"--omit-dir-times",
115+
local_path_arg,
116+
remote_path_arg,
117+
]
118+
exit_code = subprocess.call(rsync_command, cwd=docs_directory)
119+
if exit_code != 0:
120+
raise RuntimeError("An error occurred while pushing docs.")
121+
# publish to docs.pulpproject.org/en/3.y/
122+
make_directory_with_rsync(["en", x_y_version])
123+
remote_path_arg = "%s@%s:%sen/%s/" % (USERNAME, HOSTNAME, SITE_ROOT, x_y_version)
124+
rsync_command = [
125+
"rsync",
126+
"-avzh",
127+
"--delete",
128+
"--omit-dir-times",
129+
local_path_arg,
130+
remote_path_arg,
131+
]
132+
exit_code = subprocess.call(rsync_command, cwd=docs_directory)
133+
if exit_code != 0:
134+
raise RuntimeError("An error occurred while pushing docs.")
135+
# publish to docs.pulpproject.org/en/3.y.z/
136+
make_directory_with_rsync(["en", branch])
137+
remote_path_arg = "%s@%s:%sen/%s/" % (USERNAME, HOSTNAME, SITE_ROOT, branch)
138+
rsync_command = [
139+
"rsync",
140+
"-avzh",
141+
"--delete",
142+
"--omit-dir-times",
143+
local_path_arg,
144+
remote_path_arg,
145+
]
146+
exit_code = subprocess.call(rsync_command, cwd=docs_directory)
147+
if exit_code != 0:
148+
raise RuntimeError("An error occurred while pushing docs.")
149+
else:
150+
# This is a pre-release
151+
make_directory_with_rsync(["en", branch])
152+
remote_path_arg = "%s@%s:%sen/%s/%s/" % (USERNAME, HOSTNAME, SITE_ROOT, branch, build_type)
153+
rsync_command = [
154+
"rsync",
155+
"-avzh",
156+
"--delete",
157+
"--exclude",
158+
"nightly",
159+
"--exclude",
160+
"testing",
161+
local_path_arg,
162+
remote_path_arg,
163+
]
164+
exit_code = subprocess.call(rsync_command, cwd=docs_directory)
165+
if exit_code != 0:
166+
raise RuntimeError("An error occurred while pushing docs.")
167+
168+
169+
if __name__ == "__main__":
170+
main()

.travis/publish_docs.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -euv
4+
5+
openssl aes-256-cbc -K $encrypted_None_key -iv $encrypted_None_iv -in .travis/pulp-infra.enc -out ~/.ssh/pulp-infra -d
6+
sudo chmod 600 ~/.ssh/pulp-infra
7+
8+
echo "docs.pulpproject.org,8.43.85.236 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGXG+8vjSQvnAkq33i0XWgpSrbco3rRqNZr0SfVeiqFI7RN/VznwXMioDDhc+hQtgVhd6TYBOrV07IMcKj+FAzg=" >> /home/travis/.ssh/known_hosts
9+
chmod 644 /home/travis/.ssh/known_hosts
10+
11+
pip3 install -r doc_requirements.txt
12+
13+
cd .travis
14+
15+
export PYTHONUNBUFFERED=1
16+
export DJANGO_SETTINGS_MODULE=pulpcore.app.settings
17+
export PULP_SETTINGS=$TRAVIS_BUILD_DIR/.travis/settings/settings.py
18+
19+
eval "$(ssh-agent -s)" #start the ssh agent
20+
ssh-add ~/.ssh/pulp-infra
21+
22+
python3 docs-builder.py --build-type $1 --branch $TRAVIS_BRANCH

.travis/release.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def validate_redmine_data(redmine_query_url, redmine_issues):
2626
project_set = set()
2727
stats = defaultdict(list)
2828
milestone_url = "\n[noissue]"
29+
milestone_id = None
2930
for issue in redmine_issues:
3031
redmine_issue = redmine.issue.get(int(issue))
3132

@@ -37,6 +38,9 @@ def validate_redmine_data(redmine_query_url, redmine_issues):
3738
if "CLOSE" not in status and status != "MODIFIED":
3839
stats["status_not_modified"].append(issue)
3940

41+
if milestone_id is not None:
42+
milestone_url = f"Redmine Milestone: {REDMINE_URL}/versions/{milestone_id}.json\n[noissue]"
43+
4044
print(f"\n\nRedmine stats: {json.dumps(stats, indent=2)}")
4145
error_messages = []
4246
if stats.get("status_not_modified"):
@@ -98,15 +102,15 @@ def validate_redmine_data(redmine_query_url, redmine_issues):
98102
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description=helper)
99103

100104
parser.add_argument(
101-
"release_type", type=str, help="Whether the release should be major, minor or patch.",
105+
"release_type", type=str, help="Whether the release should be major, minor or patch."
102106
)
103107

104108
parser.add_argument(
105-
"--lower", type=str, required=False, help="Lower bound of pulpcore requirement.",
109+
"--lower", type=str, required=False, help="Lower bound of pulpcore requirement."
106110
)
107111

108112
parser.add_argument(
109-
"--upper", type=str, required=False, help="Upper bound of pulpcore requirement.",
113+
"--upper", type=str, required=False, help="Upper bound of pulpcore requirement."
110114
)
111115

112116
args = parser.parse_args()
@@ -148,7 +152,7 @@ def validate_redmine_data(redmine_query_url, redmine_issues):
148152
git.add(f"{plugin_path}/requirements.txt")
149153
git.add(f"{plugin_path}/.bumpversion.cfg")
150154
git.commit(
151-
"-m", f"Releasing {release_version}\n\nRedmineQuery: {redmine_final_query}\n{milestone_url}"
155+
"-m", f"Release {release_version}\n\nRedmine Query: {redmine_final_query}\n{milestone_url}"
152156
)
153157

154158
sha = repo.head.object.hexsha

.travis/release_requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bump2version
22
gitpython
33
python-redmine
4+
towncrier

.travis/start_container.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
become: true
5959

6060
- name: "Create Pulp Bucket"
61-
s3_bucket:
61+
amazon.aws.s3_bucket:
6262
aws_access_key: "{{ minio_access_key }}"
6363
aws_secret_key: "{{ minio_secret_key }}"
6464
s3_url: "http://minio:9000"

.travis/update_redmine.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -euv
44

55
export COMMIT_MSG=$(git log --format=%B --no-merges -1)
66
export RELEASE=$(echo $COMMIT_MSG | awk '{print $2}')
7-
export MILESTONE_URL=$(echo $COMMIT_MSG | awk '{print $6}')
8-
export REDMINE_QUERY_URL=$(echo $COMMIT_MSG | awk '{print $4}')
7+
export MILESTONE_URL=$(echo $COMMIT_MSG | grep -o "Redmine Milestone: .*" | awk '{print $3}')
8+
export REDMINE_QUERY_URL=$(echo $COMMIT_MSG | grep -o "Redmine Query: .*" | awk '{print $3}')
99

1010
echo "Releasing $RELEASE"
1111
echo "Milestone URL: $MILESTONE_URL"

.travis/validate_commit_message.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
NO_ISSUE = "[noissue]"
1616
STATUSES = ["NEW", "ASSIGNED", "POST", "MODIFIED"]
1717
REDMINE_URL = "https://pulp.plan.io"
18-
CHANGELOG_EXTS = [".feature", ".bugfix", ".doc", ".removal", ".misc"]
18+
CHANGELOG_EXTS = [".feature", ".bugfix", ".doc", ".removal", ".misc", ".deprecation"]
1919

2020
sha = sys.argv[1]
2121
project = ""
@@ -54,7 +54,7 @@ def __check_changelog(issue):
5454

5555
# validate the issue attached to the commit
5656
regex = r"(?:{keywords})[\s:]+#(\d+)".format(keywords=("|").join(KEYWORDS))
57-
pattern = re.compile(regex)
57+
pattern = re.compile(regex, re.IGNORECASE)
5858

5959
issues = pattern.findall(message)
6060

MANIFEST.in

+7
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
include LICENSE
22
include requirements.txt
3+
include pyproject.toml
4+
include CHANGES.rst
5+
include COMMITMENT
6+
include COPYRIGHT
7+
include functest_requirements.txt
8+
include test_requirements.txt
9+
include unittest_requirements.txt

dev_requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
black
2+
check-manifest
23
flake8
34
flake8-docstrings
45
flake8-tuple

pyproject.toml

+17
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,20 @@ directory = "CHANGES/"
55
title_format = "{version} ({project_date})"
66
template = "CHANGES/.TEMPLATE.rst"
77
issue_format = "`#{issue} <https://pulp.plan.io/issues/{issue}>`_"
8+
9+
[tool.check-manifest]
10+
ignore = [
11+
".bumpversion.cfg",
12+
".pep8speaks.yml",
13+
"CHANGES/**",
14+
"CONTRIBUTING.rst",
15+
"HISTORY.rst",
16+
"dev_requirements.txt",
17+
"doc_requirements.txt",
18+
"docs/**",
19+
"flake8.cfg",
20+
"template_config.yml",
21+
".travis/**",
22+
".travis.yml",
23+
"shelf_reader-0.1-py2-none-any.whl",
24+
]

0 commit comments

Comments
 (0)