Skip to content

Commit

Permalink
Disable color logs in CI (#15719)
Browse files Browse the repository at this point in the history
* Disable color logs in CI

* Disable management command color
  • Loading branch information
AlanCoding authored Jan 2, 2025
1 parent 7835e39 commit 2657ea8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .github/actions/run_awx_devel/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ runs:
run: |
DEV_DOCKER_OWNER=${{ github.repository_owner }} \
COMPOSE_TAG=${{ github.base_ref || github.ref_name }} \
COMPOSE_UP_OPTS="-d" \
DJANGO_COLORS=nocolor \
SUPERVISOR_ARGS="-n -t" \
COMPOSE_UP_OPTS="-d --no-color" \
make docker-compose
- name: Update default AWX password
Expand Down
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,6 @@ migrate:
dbchange:
$(MANAGEMENT_COMMAND) makemigrations

supervisor:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
fi; \
supervisord --pidfile=/tmp/supervisor_pid -n

collectstatic:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
Expand Down
16 changes: 12 additions & 4 deletions tools/docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@ The docker-compose development environment is regularly used and should work on

Use on other platforms is untested, and may require local changes.

## Configuration
### How to Disable Color?

In the [`inventory` file](./inventory), set your `pg_password`, `broadcast_websocket_secret`, `secret_key`, and any other settings you need for your deployment.
There are several layers that might apply color:
- docker compose coloring based on what container log comes from
- supervisord coloring based on what server it comes from
- general coloration from Django management commands

AWX requires access to a PostgreSQL database, and by default, one will be created and deployed in a container, and data will be persisted to a docker volume. When the container is stopped, the database files will still exist in the docker volume. An external database can be used by setting the `pg_host`, `pg_hostname`, and `pg_username`.
These can have color turned off by adding things to the
environment variable to modify the call options.

> If you are coming from a Local Docker installation of AWX, consider migrating your data first, see the [data migration section](#migrating-data-from-local-docker) below.
```
DJANGO_COLORS=nocolor COMPOSE_UP_OPTS="--no-color" SUPERVISOR_ARGS="-n -t" make docker-compose
```

This can be useful if this is ran in CI in any context.

## Starting the Development Environment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
image: "{{ awx_image }}:{{ awx_image_tag }}"
container_name: tools_awx_{{ container_postfix }}
hostname: awx-{{ container_postfix }}
command: launch_awx.sh
command: launch_awx.sh supervisord --pidfile=/tmp/supervisor_pid ${SUPERVISOR_ARGS:--n}
environment:
OS: "{{ os_info.stdout }}"
SDB_HOST: 0.0.0.0
Expand All @@ -41,6 +41,7 @@ services:
AWX_LOGGING_MODE: stdout
DJANGO_SUPERUSER_PASSWORD: {{ admin_password }}
UWSGI_MOUNT_PATH: {{ ingress_path }}
DJANGO_COLORS: "${DJANGO_COLORS:-}"
{% if loop.index == 1 %}
RUN_MIGRATIONS: 1
{% endif %}
Expand Down
5 changes: 3 additions & 2 deletions tools/docker-compose/launch_awx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ set +x
bootstrap_development.sh

cd /awx_devel
# Start the services
exec make supervisor

# Run the given command, usually supervisord
exec "$@"

0 comments on commit 2657ea8

Please sign in to comment.