Skip to content

Commit

Permalink
Allow plugins to configure python_version
Browse files Browse the repository at this point in the history
fixes pulp#457
  • Loading branch information
David Davis committed Jul 26, 2021
1 parent 72ba7e7 commit 16a91e9
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES/457.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added python_version option.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ The following settings are stored in `template_config.yml`.
is required unless deploy_client_to_pypi and deploy_daily_client_to_pypi
and deploy_to_pypi are specified.

python_version Python version to use in the CI. Currently only 3.6 and 3.8 are supported.

redmine_project A string that corresponds to the redmine identifier for the repo's project.
This is used during commit validation to make sure the commit is attached to
an issue in the correct project.
Expand Down
1 change: 1 addition & 0 deletions plugin-template
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ DEFAULT_SETTINGS = {
'pulpprojectdotorg_key_id': None,
'pydocstyle': True,
'pypi_username': None,
'python_version': "3.8",
'redmine_project': None,
'release_user': 'pulpbot',
'sync_ci': True,
Expand Down
3 changes: 2 additions & 1 deletion templates/github/.ci/ansible/Containerfile.j2.copy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ RUN pip3 install \

RUN mkdir -p /etc/nginx/pulp/
{% for item in plugins %}
RUN ln /usr/local/lib/python3.8/site-packages/{{ item.name }}/app/webserver_snippets/nginx.conf /etc/nginx/pulp/{{ item.name }}.conf || true
RUN export plugin_path="$(pip show {{ item.name }} | sed -n -e "s/Location: //p")/{{ item.name }}"
RUN ln "$plugin_path/app/webserver_snippets/nginx.conf /etc/nginx/pulp/{{ item.name }}.conf" || true
{% endfor %}

ENTRYPOINT ["/init"]
6 changes: 3 additions & 3 deletions templates/github/.github/workflows/ci.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "{{ python_version }}"

# dev_requirements contains tools needed for flake8, etc.
- name: Install requirements
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "{{ python_version }}"

{%- if test_bindings %}
- uses: actions/setup-ruby@v1
Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "{{ python_version }}"

- name: Install httpie
run: |
Expand Down
6 changes: 3 additions & 3 deletions templates/github/.github/workflows/nightly.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "{{ python_version }}"

- name: Install httpie
run: |
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "{{ python_version }}"

- uses: actions/setup-ruby@v1
with:
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "{{ python_version }}"

- name: Install httpie
run: |
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 @@ -90,7 +90,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "{{ python_version }}"

{%- if test_bindings or deploy_client_to_rubygems %}
- uses: actions/setup-ruby@v1
Expand Down
4 changes: 4 additions & 0 deletions templates/github/.github/workflows/scripts/install.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ VARSYAML
cat >> vars/main.yaml << VARSYAML
pulp_settings: {{ pulp_settings | tojson }}
pulp_scheme: {{ pulp_scheme }}
{%- if python_version == "3.6" -%}
pulp_container_tag: python36
{%- else -%}
pulp_container_tag: {{ 'https' if pulp_scheme == 'https' else 'latest' }}
{%- endif -%}
VARSYAML

{%- if docker_fixtures %}
Expand Down
2 changes: 1 addition & 1 deletion templates/github/.github/workflows/scripts/script.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ echo "Checking for uncommitted migrations..."
cmd_prefix bash -c "django-admin makemigrations --check --dry-run"

# Run unit tests.
cmd_prefix bash -c "PULP_DATABASES__default__USER=postgres django-admin test --noinput /usr/local/lib/python3.8/site-packages/{{ plugin_snake }}/tests/unit/"
cmd_prefix bash -c "PULP_DATABASES__default__USER=postgres django-admin test --noinput /usr/local/lib/python{{ python_version }}/site-packages/{{ plugin_snake }}/tests/unit/"

# Run functional tests
{%- if plugin_name == 'pulpcore' %}
Expand Down

0 comments on commit 16a91e9

Please sign in to comment.