Skip to content

Commit 4de2a01

Browse files
committed
Update CI files
1 parent 8b99c2e commit 4de2a01

File tree

9 files changed

+82
-26
lines changed

9 files changed

+82
-26
lines changed

.ci/ansible/Containerfile.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ FROM {{ ci_base | default(pulp_default_container) }}
55
ADD ./{{ item.name }} ./{{ item.name }}
66
{% endfor %}
77

8-
# Install python packages
9-
# S3 botocore needs to be patched to handle responses from minio during 0-byte uploads
10-
# Hacking botocore (https://github.com/boto/botocore/pull/1990)
8+
{% for item in extra_files | default([]) %}
9+
ADD ./{{ item.origin }} {{ item.destination }}
10+
{% endfor %}
1111

1212
# This MUST be the ONLY call to pip install in inside the container.
1313
RUN pip3 install --upgrade pip setuptools wheel && \

.ci/scripts/calc_constraints.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def to_upper_bound(req):
5353
if requirement.name == "pulpcore":
5454
# An exception to allow for pulpcore deprecation policy.
5555
return fetch_pulpcore_upper_bound(requirement)
56+
# skip requirement with environment scopes. E.g 'foo==1.0.0;python_version>=3.9'
57+
if requirement.marker:
58+
return f"# ENVIRONMENT IS UNTRACKABLE: {req}"
5659
for spec in requirement.specifier:
5760
if spec.operator == "~=":
5861
return f"# NO BETTER CONSTRAINT: {req}"

.ci/scripts/collect_changes.py

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@
77
# For more info visit https://github.com/pulp/plugin_template
88

99
import itertools
10+
import json
1011
import os
1112
import re
1213
import tomllib
14+
import urllib.request
15+
from pathlib import Path
1316

1417
from git import GitCommandError, Repo
1518
from packaging.version import parse as parse_version
1619

20+
21+
PYPI_PROJECT = "pulp_container"
22+
1723
# Read Towncrier settings
18-
with open("pyproject.toml", "rb") as fp:
19-
tc_settings = tomllib.load(fp)["tool"]["towncrier"]
24+
tc_settings = tomllib.loads(Path("pyproject.toml").read_text())["tool"]["towncrier"]
2025

2126
CHANGELOG_FILE = tc_settings.get("filename", "NEWS.rst")
2227
START_STRING = tc_settings.get(
@@ -35,7 +40,7 @@
3540
# see help(re.split) for more info.
3641
NAME_REGEX = r".*"
3742
VERSION_REGEX = r"[0-9]+\.[0-9]+\.[0-9][0-9ab]*"
38-
VERSION_CAPTURE_REGEX = rf"({VERSION_REGEX})"
43+
VERSION_CAPTURE_REGEX = rf"(?:YANKED )?({VERSION_REGEX})"
3944
DATE_REGEX = r"[0-9]{4}-[0-9]{2}-[0-9]{2}"
4045
TITLE_REGEX = (
4146
"("
@@ -75,6 +80,20 @@ def main():
7580
branches.sort(key=lambda ref: parse_version(ref.remote_head), reverse=True)
7681
branches = [ref.name for ref in branches]
7782

83+
changed = False
84+
85+
try:
86+
response = urllib.request.urlopen(f"https://pypi.org/pypi/{PYPI_PROJECT}/json")
87+
pypi_record = json.loads(response.read())
88+
yanked_versions = {
89+
parse_version(version): release[0]["yanked_reason"]
90+
for version, release in pypi_record["releases"].items()
91+
if release[0]["yanked"] is True
92+
}
93+
except Exception:
94+
# If something failed, just don't mark anything as yanked.
95+
yanked_versions = {}
96+
7897
with open(CHANGELOG_FILE, "r") as f:
7998
main_changelog = f.read()
8099
preamble, main_changes = split_changelog(main_changelog)
@@ -95,9 +114,19 @@ def main():
95114
if left[0] != right[0]:
96115
main_changes.append(right)
97116

117+
if yanked_versions:
118+
for change in main_changes:
119+
if change[0] in yanked_versions and "YANKED" not in change[1].split("\n")[0]:
120+
reason = yanked_versions[change[0]]
121+
version = str(change[0])
122+
change[1] = change[1].replace(version, "YANKED " + version, count=1)
123+
if reason:
124+
change[1] = change[1].replace("\n", f"\n\nYank reason: {reason}\n", count=1)
125+
changed = True
126+
98127
new_length = len(main_changes)
99-
if old_length < new_length:
100-
print(f"{new_length - old_length} new versions have been added.")
128+
if old_length < new_length or changed:
129+
print(f"{new_length - old_length} new versions have been added (or something has changed).")
101130
with open(CHANGELOG_FILE, "w") as fp:
102131
fp.write(preamble)
103132
for change in main_changes:

.github/workflows/create-branch.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222

23+
permissions:
24+
contents: write
25+
2326
steps:
2427
- uses: "actions/checkout@v4"
2528
with:

.github/workflows/docs.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
# For more info visit https://github.com/pulp/plugin_template
77

88
---
9-
name: "Docs"
9+
name: "Docs CI"
1010
on:
1111
workflow_call:
1212

1313
jobs:
14-
test:
14+
changelog:
1515
if: "endsWith(github.base_ref, 'main')"
1616
runs-on: "ubuntu-latest"
1717
defaults:
@@ -22,28 +22,22 @@ jobs:
2222
with:
2323
fetch-depth: 1
2424
path: "pulp_container"
25-
- uses: "actions/checkout@v4"
26-
with:
27-
fetch-depth: 0
28-
repository: "pulp/pulp-docs"
29-
path: "pulp-docs"
30-
ref: "rewrite-as-mkdocs-plugin"
3125
- uses: "actions/setup-python@v5"
3226
with:
3327
python-version: "3.12"
3428
- name: "Install python dependencies"
3529
run: |
3630
echo ::group::PYDEPS
37-
pip install ../pulp-docs towncrier
31+
pip install towncrier
3832
echo ::endgroup::
3933
- name: "Build changelog"
4034
run: |
4135
towncrier build --yes --version 4.0.0.ci
42-
- name: "Build docs"
43-
working-directory: "pulp-docs"
44-
run: |
45-
pulp-docs fetch --dest ..
46-
pulp-docs build
36+
docs:
37+
if: "endsWith(github.base_ref, 'main')"
38+
uses: 'pulp/pulp-docs/.github/workflows/docs-ci.yml@rewrite-as-mkdocs-plugin'
39+
with:
40+
pulpdocs_ref: 'rewrite-as-mkdocs-plugin'
4741

4842
no-test:
4943
if: "!endsWith(github.base_ref, 'main')"

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
- uses: "actions/setup-python@v5"
4545
with:
46-
python-version: "3.11"
46+
python-version: "3.13"
4747

4848
- name: "Install python dependencies"
4949
run: |

.github/workflows/publish.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,36 @@ jobs:
146146
- "publish-python-bindings"
147147
- "publish-ruby-bindings"
148148

149+
permissions:
150+
contents: write
151+
152+
env:
153+
TAG_NAME: "${{ github.ref_name }}"
154+
149155
steps:
156+
- uses: "actions/checkout@v4"
157+
with:
158+
fetch-depth: 0
159+
path: "pulp_container"
160+
161+
- uses: "actions/setup-python@v5"
162+
with:
163+
python-version: "3.11"
164+
165+
- name: "Install towncrier"
166+
run: |
167+
pip install towncrier
168+
169+
- name: "Get release notes"
170+
id: get_release_notes
171+
run: |
172+
NOTES=$(towncrier build --draft --version $TAG_NAME)
173+
echo "body<<EOF" >> $GITHUB_OUTPUT
174+
echo "$NOTES" >> $GITHUB_OUTPUT
175+
echo "EOF" >> $GITHUB_OUTPUT
176+
150177
- name: "Create release on GitHub"
151178
uses: "actions/github-script@v7"
152-
env:
153-
TAG_NAME: "${{ github.ref_name }}"
154179
with:
155180
script: |
156181
const { TAG_NAME } = process.env;
@@ -159,5 +184,6 @@ jobs:
159184
owner: context.repo.owner,
160185
repo: context.repo.repo,
161186
tag_name: TAG_NAME,
187+
body: `${{ steps.get_release_notes.outputs.body }}`,
162188
make_latest: "legacy",
163189
});

doc_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
#
66
# For more info visit https://github.com/pulp/plugin_template
77
towncrier
8-
pulp-docs @ git+https://github.com/pulp/pulp-docs@main
8+
pulp-docs @ git+https://github.com/pulp/pulp-docs@rewrite-as-mkdocs-plugin

template_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ deploy_client_to_rubygems: true
2020
deploy_to_pypi: true
2121
disabled_redis_runners: []
2222
docker_fixtures: false
23+
extra_files: []
2324
flake8: true
2425
flake8_ignore: []
2526
github_org: pulp

0 commit comments

Comments
 (0)