Skip to content

Convert Docker startup scripts to python#375

Closed
MoralCode wants to merge 68 commits into
mainfrom
env/entrypoints
Closed

Convert Docker startup scripts to python#375
MoralCode wants to merge 68 commits into
mainfrom
env/entrypoints

Conversation

@MoralCode

Copy link
Copy Markdown
Contributor

Description
This is a followup to #311 to address the uses of environment variables that are present in scripts like entrypoint.sh init.sh and config.sh that are part of the docker startup process for CollectOSS.

These bash scripts would be very difficult to hack in support for reading from two different variable prefixes, and I decided it was a better use of effort to move the behaviors of these scripts into python.

This PR is that last piece last piece of fixing the environment variable naming subtask of #279

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

MoralCode and others added 30 commits June 10, 2026 09:02
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
…ode slowly over time

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Co-authored-by: Shlok Gilda <gildashlok@hotmail.com>
Signed-off-by: Adrian Edwards <17362949+MoralCode@users.noreply.github.com>
Co-authored-by: Shlok Gilda <gildashlok@hotmail.com>
Signed-off-by: Adrian Edwards <17362949+MoralCode@users.noreply.github.com>
Co-authored-by: Shlok Gilda <gildashlok@hotmail.com>
Signed-off-by: Adrian Edwards <17362949+MoralCode@users.noreply.github.com>
impact: low due to the new env variable interpretation layer

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
…s where env vars are explicitly needed in the CLI

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
MoralCode added 25 commits June 10, 2026 09:02
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
itll start as deprecated since there are already plans to make this better.

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
…d from two places in the CLI

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
…autoimport locations

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
so it doesn't import CollectOSS

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
github keys being put in wrong places

Signed-off-by: Adrian Edwards <adredwar@redhat.com>
Signed-off-by: Adrian Edwards <adredwar@redhat.com>
from pathlib import Path
import os
import getpass
import subprocess
import os
import getpass
import subprocess
from subprocess import check_call
"""
pass
# alembic upgrade head, unless theres an env var preventing automatic migration
check_call(["alembic", "upgrade", "head"])
"""
pass
# alembic upgrade head, unless theres an env var preventing automatic migration
check_call(["alembic", "upgrade", "head"])
with git_credentials.open("w", encoding="utf-8") as c:
c.writelines(credentials)

subprocess.call(["git", "config", "--global", "credential.helper", f"store --file {str(git_credentials)}"])
with git_credentials.open("w", encoding="utf-8") as c:
c.writelines(credentials)

subprocess.call(["git", "config", "--global", "credential.helper", f"store --file {str(git_credentials)}"])
@@ -130,7 +147,7 @@ def start(ctx, disable_collection, development, pidfile, port):
processes = start_celery_worker_processes((core_worker_count, secondary_worker_count, facade_worker_count), disable_collection)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
W0621: Redefining name 'processes' from outer scope (line 412) (redefined-outer-name)

@@ -15,6 +15,7 @@
import requests
from redis.exceptions import ConnectionError as RedisConnectionError

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
W0611: Unused ConnectionError imported from redis.exceptions as RedisConnectionError (unused-import)

import sqlalchemy as s

from collectoss.util.startup import check_init_schema, check_update_schema, collect_env_variables, print_platform_information, setup_facade_directory, warn_import_repos, merge_config
from keyman.KeyClient import KeyClient, KeyPublisher

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
W0611: Unused KeyClient imported from keyman.KeyClient (unused-import)

import platform
import sys

from sqlalchemy.orm.attributes import get_history

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pylint] reported by reviewdog 🐶
W0611: Unused get_history imported from sqlalchemy.orm.attributes (unused-import)

@MoralCode

Copy link
Copy Markdown
Contributor Author

Just kidding. Without this PR, the CI is failing for the PR this depends on. ill just do them together

@MoralCode MoralCode closed this Jun 10, 2026
@MoralCode MoralCode deleted the env/entrypoints branch June 10, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants