Skip to content

Commit

Permalink
Add django ansible base (#2048)
Browse files Browse the repository at this point in the history
* Add django ansible base
* Bump to python 3.9


No-Issue
  • Loading branch information
newswangerd authored Jan 31, 2024
1 parent bfd6fe1 commit 1b7dbbb
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

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

- name: Install python dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
fetch-depth: 1
- uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
# lint_requirements contains tools needed for flake8, etc.
- name: Install requirements
run: pip3 install -r lint_requirements.txt
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:

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

- name: Install httpie
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

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

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

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

- uses: ruby/setup-ruby@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:

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

- name: Untar repository
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
steps:
- uses: actions/setup-python@v4
with:
python-version: "3.8"
python-version: "3.9"
- name: Configure Git with ansible name and email
run: |
git config --global user.name 'ansible'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

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

- name: Install python dependencies
run: |
Expand Down
5 changes: 5 additions & 0 deletions profiles/dab/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# galaxy_ng/dab

## Usage

This profile is used for running Galaxy NG with the JWT authentication integrations provided by django-ansible-base
1 change: 1 addition & 0 deletions profiles/dab/profile_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
galaxy_ng/base
5 changes: 5 additions & 0 deletions profiles/dab/pulp_config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PULP_GALAXY_AUTHENTICATION_CLASSES="['ansible_base.jwt_consumer.hub.auth.HubJWTAuth', 'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.TokenAuthentication', 'rest_framework.authentication.BasicAuthentication']"

PULP_ANSIBLE_BASE_JWT_VALIDATE_CERT=false
PULP_ANSIBLE_BASE_JWT_KEY=https://localhost
PULP_CSRF_TRUSTED_ORIGINS = ['https://localhost']
16 changes: 15 additions & 1 deletion requirements/requirements.common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ click==8.1.3
cryptography==41.0.1
# via
# ansible-core
# django-ansible-base
# pulpcore
# pyjwt
# social-auth-core
Expand All @@ -92,7 +93,9 @@ distro==1.8.0
# galaxy-ng (setup.py)
django==4.2.7
# via
# django-ansible-base
# django-auth-ldap
# django-crum
# django-filter
# django-guid
# django-import-export
Expand All @@ -104,8 +107,12 @@ django==4.2.7
# insights-analytics-collector
# pulpcore
# social-auth-app-django
django-ansible-base[jwt_consumer] @ git+https://github.com/ansible/django-ansible-base@devel
# via galaxy-ng (setup.py)
django-auth-ldap==4.0.0
# via galaxy-ng (setup.py)
django-crum==0.7.9
# via django-ansible-base
django-filter==23.2
# via pulpcore
django-guid==3.3.0
Expand All @@ -120,8 +127,11 @@ django-picklefield==3.1
# via galaxy-ng (setup.py)
django-prometheus==2.3.1
# via galaxy-ng (setup.py)
django-split-settings==1.2.0
# via django-ansible-base
djangorestframework==3.14.0
# via
# django-ansible-base
# drf-access-policy
# drf-nested-routers
# drf-spectacular
Expand Down Expand Up @@ -179,7 +189,9 @@ importlib-metadata==6.0.1
# opentelemetry-api
# pulpcore
inflection==0.5.1
# via drf-spectacular
# via
# django-ansible-base
# drf-spectacular
insights-analytics-collector==0.3.2
# via galaxy-ng (setup.py)
jinja2==3.1.2
Expand Down Expand Up @@ -349,6 +361,7 @@ pyjwkest==1.4.2
# via pulp-container
pyjwt[crypto]==2.7.0
# via
# django-ansible-base
# pulp-container
# social-auth-core
pyparsing==3.1.1
Expand Down Expand Up @@ -380,6 +393,7 @@ redis==4.5.5
# via pulpcore
requests==2.31.0
# via
# django-ansible-base
# galaxy-importer
# insights-analytics-collector
# opentelemetry-exporter-otlp-proto-http
Expand Down
16 changes: 15 additions & 1 deletion requirements/requirements.insights.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ click==8.1.3
cryptography==41.0.1
# via
# ansible-core
# django-ansible-base
# pulpcore
# pyjwt
# social-auth-core
Expand All @@ -98,7 +99,9 @@ distro==1.8.0
# galaxy-ng (setup.py)
django==4.2.7
# via
# django-ansible-base
# django-auth-ldap
# django-crum
# django-filter
# django-guid
# django-import-export
Expand All @@ -111,8 +114,12 @@ django==4.2.7
# insights-analytics-collector
# pulpcore
# social-auth-app-django
django-ansible-base[jwt_consumer] @ git+https://github.com/ansible/django-ansible-base@devel
# via galaxy-ng (setup.py)
django-auth-ldap==4.0.0
# via galaxy-ng (setup.py)
django-crum==0.7.9
# via django-ansible-base
django-filter==23.2
# via pulpcore
django-guid==3.3.0
Expand All @@ -127,10 +134,13 @@ django-picklefield==3.1
# via galaxy-ng (setup.py)
django-prometheus==2.3.1
# via galaxy-ng (setup.py)
django-split-settings==1.2.0
# via django-ansible-base
django-storages[boto3]==1.14.2
# via -r requirements/requirements.insights.in
djangorestframework==3.14.0
# via
# django-ansible-base
# drf-access-policy
# drf-nested-routers
# drf-spectacular
Expand Down Expand Up @@ -188,7 +198,9 @@ importlib-metadata==6.0.1
# opentelemetry-api
# pulpcore
inflection==0.5.1
# via drf-spectacular
# via
# django-ansible-base
# drf-spectacular
insights-analytics-collector==0.3.2
# via galaxy-ng (setup.py)
jinja2==3.1.2
Expand Down Expand Up @@ -360,6 +372,7 @@ pyjwkest==1.4.2
# via pulp-container
pyjwt[crypto]==2.7.0
# via
# django-ansible-base
# pulp-container
# social-auth-core
pyparsing==3.1.1
Expand Down Expand Up @@ -391,6 +404,7 @@ redis==4.5.5
# via pulpcore
requests==2.31.0
# via
# django-ansible-base
# galaxy-importer
# insights-analytics-collector
# opentelemetry-exporter-otlp-proto-http
Expand Down
16 changes: 15 additions & 1 deletion requirements/requirements.standalone.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ click==8.1.3
cryptography==41.0.1
# via
# ansible-core
# django-ansible-base
# pulpcore
# pyjwt
# social-auth-core
Expand All @@ -92,7 +93,9 @@ distro==1.8.0
# galaxy-ng (setup.py)
django==4.2.7
# via
# django-ansible-base
# django-auth-ldap
# django-crum
# django-filter
# django-guid
# django-import-export
Expand All @@ -104,8 +107,12 @@ django==4.2.7
# insights-analytics-collector
# pulpcore
# social-auth-app-django
django-ansible-base[jwt_consumer] @ git+https://github.com/ansible/django-ansible-base@devel
# via galaxy-ng (setup.py)
django-auth-ldap==4.0.0
# via galaxy-ng (setup.py)
django-crum==0.7.9
# via django-ansible-base
django-filter==23.2
# via pulpcore
django-guid==3.3.0
Expand All @@ -120,8 +127,11 @@ django-picklefield==3.1
# via galaxy-ng (setup.py)
django-prometheus==2.3.1
# via galaxy-ng (setup.py)
django-split-settings==1.2.0
# via django-ansible-base
djangorestframework==3.14.0
# via
# django-ansible-base
# drf-access-policy
# drf-nested-routers
# drf-spectacular
Expand Down Expand Up @@ -179,7 +189,9 @@ importlib-metadata==6.0.1
# opentelemetry-api
# pulpcore
inflection==0.5.1
# via drf-spectacular
# via
# django-ansible-base
# drf-spectacular
insights-analytics-collector==0.3.2
# via galaxy-ng (setup.py)
jinja2==3.1.2
Expand Down Expand Up @@ -349,6 +361,7 @@ pyjwkest==1.4.2
# via pulp-container
pyjwt[crypto]==2.7.0
# via
# django-ansible-base
# pulp-container
# social-auth-core
pyparsing==3.1.1
Expand Down Expand Up @@ -380,6 +393,7 @@ redis==4.5.5
# via pulpcore
requests==2.31.0
# via
# django-ansible-base
# galaxy-importer
# insights-analytics-collector
# opentelemetry-exporter-otlp-proto-http
Expand Down
25 changes: 12 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
class PrepareStaticCommand(Command):
DEV_UI_DOWNLOAD_URL = (
"https://github.com/ansible/ansible-hub-ui/"
"releases/download/dev/automation-hub-ui-dist.tar.gz")
"releases/download/dev/automation-hub-ui-dist.tar.gz"
)

ALTERNATE_UI_DOWNLOAD_URL = os.environ.get("ALTERNATE_UI_DOWNLOAD_URL")

Expand All @@ -31,9 +32,9 @@ class PrepareStaticCommand(Command):

user_options = [
(
'force-download-ui',
"force-download-ui",
None,
'Replace any existing static files with the ones downloaded from github.'
"Replace any existing static files with the ones downloaded from github.",
),
]

Expand Down Expand Up @@ -76,13 +77,13 @@ def _download_tarball(self, url, download_file):

class SDistCommand(_SDistCommand):
def run(self):
self.run_command('prepare_static')
self.run_command("prepare_static")
return super().run()


class BuildPyCommand(_BuildPyCommand):
def run(self):
self.run_command('prepare_static')
self.run_command("prepare_static")
return super().run()


Expand All @@ -105,8 +106,7 @@ def _format_pulp_requirement(plugin, specifier=None, ref=None, gh_namespace="pul
else:
repo = plugin.replace("-", "_")
return (
f"{plugin}@git+https://[email protected]/"
f"{gh_namespace}/{repo}.git@{ref}#egg={plugin}"
f"{plugin}@git+https://[email protected]/" f"{gh_namespace}/{repo}.git@{ref}#egg={plugin}"
)


Expand All @@ -124,6 +124,7 @@ def _format_pulp_requirement(plugin, specifier=None, ref=None, gh_namespace="pul
"insights_analytics_collector>=0.3.0",
"boto3",
"distro",
"django-ansible-base[jwt_consumer] @ git+https://github.com/ansible/django-ansible-base@devel", # noqa 501
# From vendored automated_logging
"marshmallow<4.0.0,>=3.6.1",
"django-picklefield<4.0.0,>=3.0.1",
Expand All @@ -133,7 +134,7 @@ def _format_pulp_requirement(plugin, specifier=None, ref=None, gh_namespace="pul

# https://softwareengineering.stackexchange.com/questions/223634/what-is-meant-by-now-you-have-two-problems
def strip_package_name(spec):
operators = ['=', '>', '<', '~', '!', '^', '@']
operators = ["=", ">", "<", "~", "!", "^", "@"]
for idc, char in enumerate(spec):
if char in operators:
return spec[:idc]
Expand All @@ -152,13 +153,11 @@ def strip_package_name(spec):
#steps-to-run-dev-environment-with-specific-upstream-branch
"""
DEV_SOURCE_PATH = os.getenv(
"DEV_SOURCE_PATH",
default="pulpcore:pulp_ansible:pulp_container:galaxy_importer"
"DEV_SOURCE_PATH", default="pulpcore:pulp_ansible:pulp_container:galaxy_importer"
).split(":")
DEV_SOURCE_PATH += [path.replace("_", "-") for path in DEV_SOURCE_PATH]
requirements = [
strip_package_name(req)
if req.lower().startswith(tuple(DEV_SOURCE_PATH)) else req
strip_package_name(req) if req.lower().startswith(tuple(DEV_SOURCE_PATH)) else req
for req in requirements
]
print("Installing with unpinned DEV_SOURCE_PATH requirements", requirements)
Expand All @@ -171,7 +170,7 @@ def strip_package_name(spec):
author="Red Hat, Inc.",
author_email="[email protected]",
url="https://github.com/ansible/galaxy_ng/",
python_requires=">=3.8",
python_requires=">=3.9",
setup_requires=["wheel"],
install_requires=requirements,
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion template_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pulp_settings_s3: null
pulpprojectdotorg_key_id: null
pydocstyle: true
pypi_username: null
python_version: '3.8'
python_version: '3.9'
release_email: [email protected]
release_user: ansible
run_pulpcore_tests_for_plugins: false
Expand Down

0 comments on commit 1b7dbbb

Please sign in to comment.