Skip to content

Commit

Permalink
Improve python version flexibility
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
dralley committed Feb 15, 2024
1 parent 8ecb63d commit b6a3912
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.11"
- name: "Bootstrap catdog plugin"
working-directory: "plugin_template"
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fetch-depth: 0
- uses: "actions/setup-python@v4"
with:
python-version: "3.8"
python-version: "3.11"
- name: "Bootstrap catdog plugin"
working-directory: "plugin_template"
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fetch-depth: 0
- uses: "actions/setup-python@v4"
with:
python-version: "3.8"
python-version: "3.11"
- name: "Lint plugin_template"
working-directory: "plugin_template"
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- uses: "actions/setup-python@v4"
with:
python-version: "3.8"
python-version: "3.11"

- name: "Bootstrap catdog plugin"
working-directory: "plugin_template"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ The following settings are stored in `template_config.yml`.
pydocstyle Boolean, whether to have flake8 use pydocstyle to check for compliance with
Python docstring conventions.

python_version Python version to use in the CI. Currently only 3.6 and 3.8 are supported.
python_version Python version to use in the CI. This does not affect the python version
inside the CI container.

release_user The GitHub user that is associated with the RELEASE_TOKEN secret on GitHub.
The username and token are used to push the Changelog and version bump commits
Expand Down
4 changes: 2 additions & 2 deletions plugin-template
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ DEFAULT_SETTINGS = {
"check_stray_pulpcore_imports": True,
"cli_package": "pulp-cli",
"cli_repo": "https://github.com/pulp/pulp-cli.git",
"ci_base_image": "ghcr.io/pulp/pulp-ci-centos",
"ci_base_image": "ghcr.io/pulp/pulp-ci-centos9",
"ci_env": {},
"ci_trigger": "{pull_request: {branches: ['*']}}",
"ci_update_docs": False,
Expand Down Expand Up @@ -67,7 +67,6 @@ DEFAULT_SETTINGS = {
"pulp_settings": None,
"pulp_settings_s3": None,
"pydocstyle": True,
"python_version": "3.8",
"release_email": "pulp-infra@redhat.com",
"release_user": "pulpbot",
"stalebot_days_until_close": 30,
Expand Down Expand Up @@ -416,6 +415,7 @@ def write_template_section(config, name, plugin_root_dir, verbose=False):
"section": name,
"gitref": gitref,
"ci_update_branches": ci_update_branches,
"python_version": "3.11",
**config,
}

Expand Down
8 changes: 6 additions & 2 deletions templates/bootstrap/setup.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ setup(
name="{{ plugin_name | dash }}",
version="0.1.0a1.dev",
description="{{ plugin_name | dash }} plugin for the Pulp Project",
long_description="{{ plugin_name | dash }} plugin for the Pulp Project",
long_description_content_type="text/markdown",
license="GPLv2+",
author="AUTHOR",
author_email="author@email.here",
url="http://example.com/",
python_requires=">=3.8",
python_requires=">=3.9",
install_requires=requirements,
extra_require={"ci": []},
include_package_data=True,
Expand All @@ -24,8 +26,10 @@ setup(
"Framework :: Django",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
entry_points={"pulpcore.plugin": ["{{ plugin_name | snake }} = {{ plugin_name | snake }}:default_app_config"]},
)
2 changes: 1 addition & 1 deletion templates/github/.github/workflows/create-branch.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
{{ checkout(depth=0, path=plugin_name) | indent(6) }}

{{ setup_python(pyversion="3.8") | indent(6) }}
{{ setup_python() | indent(6) }}

{{ install_python_deps(["bump2version", "jinja2", "pyyaml", "packaging"]) | indent(6) }}

Expand Down
6 changes: 3 additions & 3 deletions templates/github/.github/workflows/publish.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
name: "plugin_package"
path: "{{ plugin_name }}/dist/"

{{ setup_python(pyversion="3.8") | indent(6) }}
{{ setup_python() | indent(6) }}

{{ install_python_deps(["twine"]) | indent(6) }}

Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
tar -xvf {{ plugin.app_label }}-python-client.tar
{%- endfor %}

{{ setup_python(pyversion="3.8") | indent(6) }}
{{ setup_python() | indent(6) }}

{{ install_python_deps(["twine"]) | indent(6) }}

Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
steps:
{{ checkout(depth=1, path=plugin_name) | indent(6) }}

{{ setup_python(pyversion="3.8") | indent(6) }}
{{ setup_python() | indent(6) }}

{{ install_python_deps(["packaging~=21.3", "requests"]) | indent(6) }}

Expand Down
2 changes: 1 addition & 1 deletion templates/github/.github/workflows/release.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
steps:
{{ checkout(depth=0, path=plugin_name, use_release_token=true) | indent(6) }}

{{ setup_python(pyversion="3.8") | indent(6) }}
{{ setup_python() | indent(6) }}

{{ install_python_deps(["bump2version", "towncrier"]) | indent(6) }}

Expand Down
9 changes: 8 additions & 1 deletion templates/github/.github/workflows/scripts/install.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,18 @@ sudo update-ca-certificates
echo ::endgroup::
{%- endif %}

# Add our azcert.crt certificate to the container image along with the certificates from certifi
# so that we can use HTTPS with our fake Azure CI. certifi is self-contained and doesn't allow
# extension or modification of the trust store, so we do a weird and hacky thing (above) where we just
# overwrite or append to certifi's trust store behind it's back.
#
# We do this for both the CI host and the CI image.
if [[ "$TEST" = "azure" ]]; then
{%- if pulp_scheme == "https" %}
AZCERTIFI=$(/opt/az/bin/python3 -c 'import certifi; print(certifi.where())')
PULPCERTIFI=$(cmd_prefix python3 -c 'import certifi; print(certifi.where())')
cat /usr/local/share/ca-certificates/azcert.crt >> $AZCERTIFI
cat /usr/local/share/ca-certificates/azcert.crt | cmd_stdin_prefix tee -a /usr/local/lib/python3.8/site-packages/certifi/cacert.pem > /dev/null
cat /usr/local/share/ca-certificates/azcert.crt | cmd_stdin_prefix tee -a "$PULPCERTIFI" > /dev/null
cat /usr/local/share/ca-certificates/azcert.crt | cmd_stdin_prefix tee -a /etc/pki/tls/cert.pem > /dev/null
{%- endif %}
AZURE_STORAGE_CONNECTION_STRING='DefaultEndpointsProtocol={{ pulp_scheme }};AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint={{ pulp_scheme }}://ci-azurite:10000/devstoreaccount1;'
Expand Down

0 comments on commit b6a3912

Please sign in to comment.