diff --git a/.compose.env.example b/.compose.env.example index e240e8278e..cba13a9470 100644 --- a/.compose.env.example +++ b/.compose.env.example @@ -3,8 +3,13 @@ COMPOSE_PROFILE=standalone # Add extra paths to run project dependencies from local filesystem in editable mode +# The order of repositories in the list is important, it is `:` separated. +# DEV_SOURCE_PATH='pulpcore:pulp_ansible:galaxy_ng' DEV_SOURCE_PATH='galaxy_ng' +# set to `0` to bypass requirements and install only from setup.py for each DEV_SOURCE_PATH +LOCK_REQUIREMENTS=1 + # If you want to run the UI, clone https://github.com/ansible/ansible-hub-ui # and set this to the path for the UI # ANSIBLE_HUB_UI_PATH='/absolute/path/to/ansible-hub-ui' diff --git a/CHANGES/257.misc b/CHANGES/257.misc new file mode 100644 index 0000000000..8a0926d608 --- /dev/null +++ b/CHANGES/257.misc @@ -0,0 +1 @@ +Add a new dev environment variable to bypass the installation of requirement lock files. diff --git a/compose b/compose index 0a0554187d..24e3a8676a 100755 --- a/compose +++ b/compose @@ -42,5 +42,6 @@ fi declare -xr DEV_SOURCE_PATH=${DEV_SOURCE_PATH:-galaxy_ng} declare -xr COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-galaxy_ng}" declare -xr COMPOSE_CONTEXT=".." +declare -xr LOCK_REQUIREMENTS="${LOCK_REQUIREMENTS:-1}" exec docker-compose "${compose_args[@]}" "$@" diff --git a/dev/Dockerfile.base b/dev/Dockerfile.base index 7b8be898d6..bfc9740e7a 100644 --- a/dev/Dockerfile.base +++ b/dev/Dockerfile.base @@ -4,11 +4,13 @@ ARG USER_ID=1000 ARG USER_NAME=galaxy ARG USER_GROUP=galaxy ARG COMPOSE_PROFILE +ARG LOCK_REQUIREMENTS ENV LANG=en_US.UTF-8 \ PYTHONUNBUFFERED=1 \ PULP_SETTINGS=/etc/pulp/settings.py \ - DJANGO_SETTINGS_MODULE=pulpcore.app.settings + DJANGO_SETTINGS_MODULE=pulpcore.app.settings \ + LOCK_REQUIREMENTS="${LOCK_REQUIREMENTS}" RUN set -ex; \ id --group "${USER_GROUP}" &>/dev/null \ @@ -42,7 +44,8 @@ COPY ./requirements/requirements.common.txt /tmp/requirements.txt RUN set -ex; \ pip install --no-cache-dir --upgrade pip \ - && pip install --no-cache-dir --requirement /tmp/requirements.txt + && if [[ "${LOCK_REQUIREMENTS}" -eq "1" ]]; then \ + pip install --no-cache-dir --requirement /tmp/requirements.txt; fi # Install application COPY . /app diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml index b6867541ae..9c371b2575 100644 --- a/dev/docker-compose.yml +++ b/dev/docker-compose.yml @@ -6,6 +6,8 @@ services: build: context: "${COMPOSE_CONTEXT}" dockerfile: "dev/Dockerfile.base" + args: + LOCK_REQUIREMENTS: "${LOCK_REQUIREMENTS}" image: "localhost/galaxy_ng/galaxy_ng:base" entrypoint: "/bin/true" tmpfs: @@ -17,12 +19,15 @@ services: build: context: "${COMPOSE_CONTEXT}" dockerfile: "dev/${COMPOSE_PROFILE}/Dockerfile" + args: + LOCK_REQUIREMENTS: "${LOCK_REQUIREMENTS}" image: "localhost/galaxy_ng/galaxy_ng:${COMPOSE_PROFILE}" command: ['run', 'api-reload'] ports: - "5001:8000" environment: - "WITH_DEV_INSTALL=1" + - "LOCK_REQUIREMENTS=${LOCK_REQUIREMENTS}" - "DEV_SOURCE_PATH=${DEV_SOURCE_PATH}" env_file: - './common/galaxy_ng.env' @@ -42,6 +47,7 @@ services: command: ['run', 'resource-manager'] environment: - "WITH_DEV_INSTALL=1" + - "LOCK_REQUIREMENTS=${LOCK_REQUIREMENTS}" - "DEV_SOURCE_PATH=${DEV_SOURCE_PATH}" env_file: - './common/galaxy_ng.env' @@ -61,6 +67,7 @@ services: command: ['run', 'worker'] environment: - "WITH_DEV_INSTALL=1" + - "LOCK_REQUIREMENTS=${LOCK_REQUIREMENTS}" - "DEV_SOURCE_PATH=${DEV_SOURCE_PATH}" env_file: - './common/galaxy_ng.env' @@ -82,6 +89,7 @@ services: - "24816:24816" environment: - "WITH_DEV_INSTALL=1" + - "LOCK_REQUIREMENTS=${LOCK_REQUIREMENTS}" - "DEV_SOURCE_PATH=${DEV_SOURCE_PATH}" env_file: - './common/galaxy_ng.env' diff --git a/dev/standalone/Dockerfile b/dev/standalone/Dockerfile index d46fd77bdf..9ee6874324 100644 --- a/dev/standalone/Dockerfile +++ b/dev/standalone/Dockerfile @@ -3,4 +3,6 @@ FROM localhost/galaxy_ng/galaxy_ng:base COPY requirements/requirements.standalone.txt /tmp/requirements.standalone.txt RUN set -ex; \ - pip install --no-cache-dir --requirement /tmp/requirements.standalone.txt + if [[ "${LOCK_REQUIREMENTS}" -eq "1" ]]; then \ + pip install --no-cache-dir --requirement /tmp/requirements.standalone.txt; \ + fi diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 3687697a71..abf1db490f 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -7,6 +7,7 @@ set -o pipefail readonly WITH_MIGRATIONS="${WITH_MIGRATIONS:-0}" readonly WITH_DEV_INSTALL="${WITH_DEV_INSTALL:-0}" readonly DEV_SOURCE_PATH="${DEV_SOURCE_PATH:-}" +readonly LOCK_REQUIREMENTS="${LOCK_REQUIREMENTS:-1}" log_message() { @@ -23,7 +24,13 @@ install_local_deps() { src_path="/src/${item}" if [[ -d "$src_path" ]]; then log_message "Installing path ${item} in editable mode." - pip install --no-cache-dir --no-deps --editable "$src_path" >/dev/null + + if [[ "${LOCK_REQUIREMENTS}" -eq "1" ]]; then + pip install --no-cache-dir --no-deps --editable "$src_path" >/dev/null + else + pip install --no-cache-dir --editable "$src_path" >/dev/null + fi + else log_message "WARNING: Source path ${item} is not a directory." fi