2022-01-08 03:50:17 +03:00
PYTHON ?= python3.9
2023-02-15 14:51:36 +03:00
DOCKER_COMPOSE ?= docker-compose
2014-04-29 19:19:14 +04:00
OFFICIAL ?= no
2015-02-09 22:29:48 +03:00
NODE ?= node
2015-09-11 02:03:41 +03:00
NPM_BIN ?= npm
2020-05-19 16:21:03 +03:00
CHROMIUM_BIN = /tmp/chrome-linux/chrome
2015-11-06 23:19:35 +03:00
GIT_BRANCH ?= $( shell git rev-parse --abbrev-ref HEAD)
2017-07-18 18:16:18 +03:00
MANAGEMENT_COMMAND ?= awx-manage
2022-06-27 16:22:25 +03:00
VERSION := $( shell $( PYTHON) tools/scripts/scm_version.py)
2022-12-21 00:06:25 +03:00
# ansible-test requires semver compatable version, so we allow overrides to hack it
COLLECTION_VERSION ?= $( shell $( PYTHON) tools/scripts/scm_version.py | cut -d . -f 1-3)
2022-12-21 17:53:18 +03:00
# args for the ansible-test sanity command
COLLECTION_SANITY_ARGS ?= --docker
# collection unit testing directories
COLLECTION_TEST_DIRS ?= awx_collection/test/awx
# collection integration test directories (defaults to all)
COLLECTION_TEST_TARGET ?=
# args for collection install
COLLECTION_PACKAGE ?= awx
COLLECTION_NAMESPACE ?= awx
COLLECTION_INSTALL = ~/.ansible/collections/ansible_collections/$( COLLECTION_NAMESPACE) /$( COLLECTION_PACKAGE)
COLLECTION_TEMPLATE_VERSION ?= false
2016-08-25 18:57:31 +03:00
# NOTE: This defaults the container image version to the branch that's active
2016-12-06 21:32:33 +03:00
COMPOSE_TAG ?= $( GIT_BRANCH)
2021-08-26 20:37:13 +03:00
MAIN_NODE_TYPE ?= hybrid
2022-01-11 00:52:44 +03:00
# If set to true docker-compose will also start a keycloak instance
KEYCLOAK ?= false
2022-03-10 18:29:04 +03:00
# If set to true docker-compose will also start an ldap instance
LDAP ?= false
2022-05-09 16:50:28 +03:00
# If set to true docker-compose will also start a splunk instance
SPLUNK ?= false
2022-06-16 22:46:42 +03:00
# If set to true docker-compose will also start a prometheus instance
PROMETHEUS ?= false
# If set to true docker-compose will also start a grafana instance
GRAFANA ?= false
2016-09-08 20:37:53 +03:00
2021-10-02 21:22:14 +03:00
VENV_BASE ?= /var/lib/awx/venv
2016-03-09 22:33:42 +03:00
2022-03-22 15:05:28 +03:00
DEV_DOCKER_TAG_BASE ?= ghcr.io/ansible
2021-01-27 19:01:17 +03:00
DEVEL_IMAGE_NAME ?= $( DEV_DOCKER_TAG_BASE) /awx_devel:$( COMPOSE_TAG)
2021-11-19 22:00:23 +03:00
RECEPTOR_IMAGE ?= quay.io/ansible/receptor:devel
2016-07-05 18:44:27 +03:00
# Python packages to install only from source (not from binary wheels)
# Comma separated list
2021-05-18 22:27:04 +03:00
SRC_ONLY_PKGS ?= cffi,pycparser,psycopg2,twilio
2019-12-16 16:24:33 +03:00
# These should be upgraded in the AWX and Ansible venv before attempting
# to install the actual requirements
2022-11-29 18:41:52 +03:00
VENV_BOOTSTRAP ?= pip = = 21.2.4 setuptools = = 65.6.3 setuptools_scm[ toml] = = 7.0.5 wheel = = 0.38.4
2016-07-05 18:44:27 +03:00
2017-08-03 17:39:04 +03:00
NAME ?= awx
2017-08-03 23:19:27 +03:00
2014-10-17 17:01:45 +04:00
# TAR build parameters
2018-09-27 02:53:35 +03:00
SDIST_TAR_NAME = $( NAME) -$( VERSION)
2017-06-30 23:21:03 +03:00
2017-06-23 15:48:39 +03:00
SDIST_COMMAND ?= sdist
2017-06-14 16:28:39 +03:00
SDIST_TAR_FILE ?= $( SDIST_TAR_NAME) .tar.gz
2017-06-30 23:21:03 +03:00
2017-07-27 23:30:03 +03:00
I18N_FLAG_FILE = .i18n_built
2018-04-25 18:55:57 +03:00
.PHONY : awx -link clean clean -tmp clean -venv requirements requirements_dev \
2021-03-04 20:24:01 +03:00
develop refresh adduser migrate dbchange \
2019-04-12 18:54:51 +03:00
receiver test test_unit test_coverage coverage_html \
2022-06-27 16:22:25 +03:00
sdist \
2021-03-04 20:24:01 +03:00
ui-release ui-devel \
2022-02-07 23:42:35 +03:00
VERSION PYTHON_VERSION docker-compose-sources \
2023-02-02 23:27:18 +03:00
.git/hooks/pre-commit github_ci_setup github_ci_runner
2016-10-19 19:35:59 +03:00
2016-04-20 20:49:18 +03:00
clean-tmp :
rm -rf tmp/
2016-08-19 23:28:09 +03:00
clean-venv :
rm -rf venv/
2017-03-29 17:57:34 +03:00
clean-dist :
rm -rf dist
2018-11-16 00:25:13 +03:00
clean-schema :
rm -rf swagger.json
rm -rf schema.json
rm -rf reference-schema.json
2019-07-26 03:47:35 +03:00
clean-languages :
rm -f $( I18N_FLAG_FILE)
2021-07-20 00:40:26 +03:00
find ./awx/locale/ -type f -regex " .*\.mo $" -delete
2019-07-26 03:47:35 +03:00
2022-08-17 03:36:47 +03:00
## Remove temporary build files, compiled Python files.
2019-11-25 23:55:22 +03:00
clean : clean -ui clean -api clean -awxkit clean -dist
2016-10-27 17:17:37 +03:00
rm -rf awx/public
2015-08-10 18:02:51 +03:00
rm -rf awx/lib/site-packages
2016-11-11 22:39:23 +03:00
rm -rf awx/job_status
2016-11-23 16:55:55 +03:00
rm -rf awx/job_output
2016-11-11 22:39:23 +03:00
rm -rf reports
2015-10-05 22:24:43 +03:00
rm -rf tmp
2017-07-17 04:08:04 +03:00
rm -rf $( I18N_FLAG_FILE)
2015-10-05 22:24:43 +03:00
mkdir tmp
2019-08-27 18:02:15 +03:00
clean-api :
2014-10-23 00:41:24 +04:00
rm -rf build $( NAME) -$( VERSION) *.egg-info
2022-10-27 00:51:29 +03:00
rm -rf .tox
2013-03-13 21:09:36 +04:00
find . -type f -regex " .*\.py[co] $$ " -delete
2016-11-11 22:39:23 +03:00
find . -type d -name "__pycache__" -delete
2019-08-27 18:02:15 +03:00
rm -f awx/awx_test.sqlite3*
rm -rf requirements/vendor
2019-12-05 00:50:05 +03:00
rm -rf awx/projects
2013-03-13 21:09:36 +04:00
2019-11-25 23:55:22 +03:00
clean-awxkit :
2019-12-19 05:15:25 +03:00
rm -rf awxkit/*.egg-info awxkit/.tox awxkit/build/*
2019-11-25 23:55:22 +03:00
2022-08-17 03:36:47 +03:00
## convenience target to assert environment variables are defined
2015-09-24 23:30:27 +03:00
guard-% :
2016-11-02 20:46:49 +03:00
@if [ " $$ { $* } " = "" ] ; then \
2015-09-24 23:30:27 +03:00
echo " The required environment variable ' $* ' is not set " ; \
exit 1; \
fi
2021-03-04 19:02:37 +03:00
virtualenv : virtualenv_awx
2019-01-17 01:14:08 +03:00
2019-12-18 21:22:20 +03:00
# flit is needed for offline install of certain packages, specifically ptyprocess
# it is needed for setup, but not always recognized as a setup dependency
2019-12-16 16:24:33 +03:00
# similar to pip, setuptools, and wheel, these are all needed here as a bootstrapping issues
2017-07-18 18:16:18 +03:00
virtualenv_awx :
2016-04-18 19:36:15 +03:00
if [ " $( VENV_BASE) " ] ; then \
if [ ! -d " $( VENV_BASE) " ] ; then \
mkdir $( VENV_BASE) ; \
fi ; \
2017-07-18 18:16:18 +03:00
if [ ! -d " $( VENV_BASE) /awx " ] ; then \
2020-12-07 15:00:49 +03:00
$( PYTHON) -m venv $( VENV_BASE) /awx; \
2020-02-18 19:08:54 +03:00
$( VENV_BASE) /awx/bin/pip install $( PIP_OPTIONS) $( VENV_BOOTSTRAP) ; \
2016-04-18 19:36:15 +03:00
fi ; \
fi
2022-11-15 23:22:05 +03:00
## Install third-party requirements needed for AWX's environment.
2019-12-16 16:24:33 +03:00
# this does not use system site packages intentionally
2017-07-18 18:16:18 +03:00
requirements_awx : virtualenv_awx
2017-03-29 18:08:03 +03:00
if [ [ " $( PIP_OPTIONS) " = = *"--no-index" * ] ] ; then \
2019-12-16 16:24:33 +03:00
cat requirements/requirements.txt requirements/requirements_local.txt | $( VENV_BASE) /awx/bin/pip install $( PIP_OPTIONS) -r /dev/stdin ; \
2017-03-29 18:08:03 +03:00
else \
2019-11-18 23:12:45 +03:00
cat requirements/requirements.txt requirements/requirements_git.txt | $( VENV_BASE) /awx/bin/pip install $( PIP_OPTIONS) --no-binary $( SRC_ONLY_PKGS) -r /dev/stdin ; \
2017-03-29 18:08:03 +03:00
fi
2019-10-16 20:48:59 +03:00
$( VENV_BASE) /awx/bin/pip uninstall --yes -r requirements/requirements_tower_uninstall.txt
2016-03-09 22:33:42 +03:00
2017-07-18 18:16:18 +03:00
requirements_awx_dev :
$( VENV_BASE) /awx/bin/pip install -r requirements/requirements_dev.txt
2013-06-20 23:53:10 +04:00
2021-03-04 19:02:37 +03:00
requirements : requirements_awx
2016-03-25 20:10:47 +03:00
2021-03-04 19:02:37 +03:00
requirements_dev : requirements_awx requirements_awx_dev
2016-03-25 20:10:47 +03:00
2016-12-14 18:30:28 +03:00
requirements_test : requirements
2016-04-07 03:33:44 +03:00
2022-08-17 03:36:47 +03:00
## "Install" awx package in development mode.
2013-05-25 01:55:03 +04:00
develop :
2013-09-25 05:40:53 +04:00
@if [ " $( VIRTUAL_ENV) " ] ; then \
2014-01-29 22:49:29 +04:00
pip uninstall -y awx; \
2013-09-25 05:40:53 +04:00
$( PYTHON) setup.py develop; \
else \
2016-09-19 17:54:39 +03:00
pip uninstall -y awx; \
$( PYTHON) setup.py develop; \
2014-11-11 23:18:39 +03:00
fi
2015-08-05 15:10:16 +03:00
version_file :
2017-11-10 01:17:30 +03:00
mkdir -p /var/lib/awx/; \
if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /awx/bin/activate; \
fi ; \
2020-12-07 15:00:49 +03:00
$( PYTHON) -c "import awx; print(awx.__version__)" > /var/lib/awx/.awx_version; \
2015-08-05 15:10:16 +03:00
2022-08-17 03:36:47 +03:00
## Refresh development environment after pulling new code.
2015-08-05 15:10:16 +03:00
refresh : clean requirements_dev version_file develop migrate
2013-05-22 01:39:34 +04:00
2022-08-17 03:36:47 +03:00
## Create Django superuser.
2013-03-14 01:20:50 +04:00
adduser :
2017-07-18 18:16:18 +03:00
$( MANAGEMENT_COMMAND) createsuperuser
2013-03-14 01:20:50 +04:00
2022-08-17 03:36:47 +03:00
## Create database tables and apply any new migrations.
2016-02-02 22:50:42 +03:00
migrate :
2016-03-09 22:33:42 +03:00
if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-03-09 22:33:42 +03:00
fi ; \
2018-04-02 22:34:39 +03:00
$( MANAGEMENT_COMMAND) migrate --noinput
2013-03-13 23:15:35 +04:00
2022-08-17 03:36:47 +03:00
## Run after making changes to the models to create a new migration.
2013-06-20 23:53:10 +04:00
dbchange :
2017-07-18 18:16:18 +03:00
$( MANAGEMENT_COMMAND) makemigrations
2013-06-20 23:53:10 +04:00
2017-02-13 00:13:15 +03:00
supervisor :
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2017-02-13 00:13:15 +03:00
fi ; \
2019-09-12 22:22:16 +03:00
supervisord --pidfile= /tmp/supervisor_pid -n
2015-08-04 22:26:27 +03:00
2016-10-18 19:15:01 +03:00
collectstatic :
2016-10-14 08:43:14 +03:00
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-10-14 08:43:14 +03:00
fi ; \
2022-10-27 00:51:29 +03:00
$( PYTHON) manage.py collectstatic --clear --noinput > /dev/null 2>& 1
2016-10-18 19:15:01 +03:00
2022-04-14 16:16:18 +03:00
DEV_RELOAD_COMMAND ?= supervisorctl restart tower-processes:*
2021-01-25 20:25:37 +03:00
2016-10-18 19:15:01 +03:00
uwsgi : collectstatic
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-10-18 19:15:01 +03:00
fi ; \
2023-02-23 20:21:02 +03:00
uwsgi /etc/tower/uwsgi.ini
2022-04-14 16:16:18 +03:00
awx-autoreload :
2022-06-13 23:08:20 +03:00
@/awx_devel/tools/docker-compose/awx-autoreload /awx_devel/awx " $( DEV_RELOAD_COMMAND) "
2016-10-14 08:43:14 +03:00
daphne :
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-10-14 08:43:14 +03:00
fi ; \
2019-09-12 22:22:16 +03:00
daphne -b 127.0.0.1 -p 8051 awx.asgi:channel_layer
2016-10-14 08:43:14 +03:00
2020-02-15 00:12:04 +03:00
wsbroadcast :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-03-09 22:33:42 +03:00
fi ; \
2020-02-15 00:12:04 +03:00
$( PYTHON) manage.py run_wsbroadcast
2013-06-20 23:53:10 +04:00
2022-08-17 03:36:47 +03:00
## Run to start the background task dispatcher for development.
2018-08-08 20:41:07 +03:00
dispatcher :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-03-09 22:33:42 +03:00
fi ; \
2019-09-12 22:22:16 +03:00
$( PYTHON) manage.py run_dispatcher
2018-08-08 20:41:07 +03:00
2013-06-20 23:53:10 +04:00
2022-08-17 03:36:47 +03:00
## Run to start the zeromq callback receiver
2014-02-19 00:16:39 +04:00
receiver :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-03-09 22:33:42 +03:00
fi ; \
2019-09-12 22:22:16 +03:00
$( PYTHON) manage.py run_callback_receiver
2014-02-19 00:16:39 +04:00
2016-10-18 21:19:18 +03:00
nginx :
nginx -g "daemon off;"
2017-12-06 07:46:18 +03:00
jupyter :
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /awx/bin/activate; \
fi ; \
2019-09-12 22:22:16 +03:00
$( MANAGEMENT_COMMAND) shell_plus --notebook
2017-12-06 07:46:18 +03:00
2015-05-20 22:26:44 +03:00
reports :
mkdir -p $@
2014-04-23 21:55:09 +04:00
2021-03-19 19:44:51 +03:00
black : reports
2021-03-26 23:52:19 +03:00
@command -v black >/dev/null 2>& 1 || { echo "could not find black on your PATH, you may need to \`pip install black\`, or set AWX_IGNORE_BLACK=1" && exit 1; }
@( set -o pipefail && $@ $( BLACK_ARGS) awx awxkit awx_collection | tee reports/$@ .report)
2015-05-20 22:26:44 +03:00
2021-03-23 16:49:13 +03:00
.git/hooks/pre-commit :
2021-05-18 20:20:55 +03:00
@echo "if [ -x pre-commit.sh ]; then" > .git/hooks/pre-commit
@echo " ./pre-commit.sh;" >> .git/hooks/pre-commit
@echo "fi" >> .git/hooks/pre-commit
2021-03-26 23:52:19 +03:00
@chmod +x .git/hooks/pre-commit
2021-03-23 16:49:13 +03:00
2018-09-18 20:03:38 +03:00
genschema : reports
2019-06-06 17:03:11 +03:00
$( MAKE) swagger PYTEST_ARGS = "--genschema --create-db "
2019-05-22 02:15:21 +03:00
mv swagger.json schema.json
2018-09-18 20:03:38 +03:00
2018-02-01 18:52:14 +03:00
swagger : reports
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /awx/bin/activate; \
fi ; \
2018-11-06 23:22:07 +03:00
( set -o pipefail && py.test $( PYTEST_ARGS) awx/conf/tests/functional awx/main/tests/functional/api awx/main/tests/docs --release= $( VERSION_TARGET) | tee reports/$@ .report)
2018-02-01 18:52:14 +03:00
2021-03-19 19:44:51 +03:00
check : black
2016-03-02 20:09:15 +03:00
2021-06-15 18:02:32 +03:00
api-lint :
BLACK_ARGS = "--check" make black
flake8 awx
yamllint -s .
2018-04-25 18:55:57 +03:00
awx-link :
2022-06-27 21:15:32 +03:00
[ -d "/awx_devel/awx.egg-info" ] || $( PYTHON) /awx_devel/tools/scripts/egg_info_dev
2022-02-07 23:42:35 +03:00
cp -f /tmp/awx.egg-link /var/lib/awx/venv/awx/lib/$( PYTHON) /site-packages/awx.egg-link
2018-04-25 18:55:57 +03:00
2018-07-25 00:40:45 +03:00
TEST_DIRS ?= awx/main/tests/unit awx/main/tests/functional awx/conf/tests awx/sso/tests
Consume control capacity (#11665)
* Select control node before start task
Consume capacity on control nodes for controlling tasks and consider
remainging capacity on control nodes before selecting them.
This depends on the requirement that control and hybrid nodes should all
be in the instance group named 'controlplane'. Many tests do not satisfy that
requirement. I'll update the tests in another commit.
* update tests to use controlplane
We don't start any tasks if we don't have a controlplane instance group
Due to updates to fixtures, update tests to set node type and capacity
explicitly so they get expected result.
* Fixes for accounting of control capacity consumed
Update method is used to account for currently consumed capacity for
instance groups in the in-memory capacity tracking data structure we initialize in
after_lock_init and then update via calculate_capacity_consumed (both in
task_manager.py)
Also update fit_task_to_instance to consider control impact on instances
Trust that these functions do the right thing looking for a
node with capacity, and cut out redundant check for the whole group's
capacity per Alan's reccomendation.
* Refactor now redundant code
Deal with control type tasks before we loop over the preferred instance
groups, which cuts out the need for some redundant logic.
Also, fix a bug where I was missing assigning the execution node in one case!
* set job explanation on tasks that need capacity
move the job explanation for jobs that need capacity to a function
so we can re-use it in the three places we need it.
* project updates always run on the controlplane
Instance group ordering makes no sense on project updates because they
always need to run on the control plane.
Also, since hybrid nodes should always run the control processes for the
jobs running on them as execution nodes, account for this when looking for a
execution node.
* fix misleading message
the variables and wording were both misleading, fix to be more accurate
description in the two different cases where this log may be emitted.
* use settings correctly
use settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME instead of a hardcoded
name
cache the controlplane_ig object during the after lock init to avoid
an uneccesary query
eliminate mistakenly duplicated AWX_CONTROL_PLANE_TASK_IMPACT and use
only AWX_CONTROL_NODE_TASK_IMPACT
* add test for control capacity consumption
add test to verify that when there are 2 jobs and only capacity for one
that one will move into waiting and the other stays in pending
* add test for hybrid node capacity consumption
assert that the hybrid node is used for both control and execution and
capacity is deducted correctly
* add test for task.capacity_type = control
Test that control type tasks have the right capacity consumed and
get assigned to the right instance group
Also fix lint in the tests
* jobs_running not accurate for control nodes
We can either NOT use "idle instances" for control nodes, or we need
to update the jobs_running property on the Instance model to count
jobs where the node is the controller_node.
I didn't do that because it may be an expensive query, and it would be
hard to make it match with jobs_running on the InstanceGroup which
filters on tasks assigned to the instance group.
This change chooses to stop considering "idle" control nodes an option,
since we can't acurrately identify them.
The way things are without any change, is we are continuing to over consume capacity on control nodes
because this method sees all control nodes as "idle" at the beginning
of the task manager run, and then only counts jobs started in that run
in the in-memory tracking. So jobs which last over a number of task
manager runs build up consuming capacity, which is accurately reported
via Instance.consumed_capacity
* Reduce default task impact for control nodes
This is something we can experiment with as far as what users
want at install time, but start with just 1 for now.
* update capacity docs
Describe usage of the new setting and the concept of control impact.
Co-authored-by: Alan Rominger <arominge@redhat.com>
Co-authored-by: Rebeccah <rhunter@redhat.com>
2022-02-14 18:13:22 +03:00
PYTEST_ARGS ?= -n auto
2022-08-17 03:36:47 +03:00
## Run all API unit tests.
2018-04-16 16:49:45 +03:00
test :
2020-06-16 03:54:14 +03:00
if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-08-23 22:35:43 +03:00
fi ; \
Consume control capacity (#11665)
* Select control node before start task
Consume capacity on control nodes for controlling tasks and consider
remainging capacity on control nodes before selecting them.
This depends on the requirement that control and hybrid nodes should all
be in the instance group named 'controlplane'. Many tests do not satisfy that
requirement. I'll update the tests in another commit.
* update tests to use controlplane
We don't start any tasks if we don't have a controlplane instance group
Due to updates to fixtures, update tests to set node type and capacity
explicitly so they get expected result.
* Fixes for accounting of control capacity consumed
Update method is used to account for currently consumed capacity for
instance groups in the in-memory capacity tracking data structure we initialize in
after_lock_init and then update via calculate_capacity_consumed (both in
task_manager.py)
Also update fit_task_to_instance to consider control impact on instances
Trust that these functions do the right thing looking for a
node with capacity, and cut out redundant check for the whole group's
capacity per Alan's reccomendation.
* Refactor now redundant code
Deal with control type tasks before we loop over the preferred instance
groups, which cuts out the need for some redundant logic.
Also, fix a bug where I was missing assigning the execution node in one case!
* set job explanation on tasks that need capacity
move the job explanation for jobs that need capacity to a function
so we can re-use it in the three places we need it.
* project updates always run on the controlplane
Instance group ordering makes no sense on project updates because they
always need to run on the control plane.
Also, since hybrid nodes should always run the control processes for the
jobs running on them as execution nodes, account for this when looking for a
execution node.
* fix misleading message
the variables and wording were both misleading, fix to be more accurate
description in the two different cases where this log may be emitted.
* use settings correctly
use settings.DEFAULT_CONTROL_PLANE_QUEUE_NAME instead of a hardcoded
name
cache the controlplane_ig object during the after lock init to avoid
an uneccesary query
eliminate mistakenly duplicated AWX_CONTROL_PLANE_TASK_IMPACT and use
only AWX_CONTROL_NODE_TASK_IMPACT
* add test for control capacity consumption
add test to verify that when there are 2 jobs and only capacity for one
that one will move into waiting and the other stays in pending
* add test for hybrid node capacity consumption
assert that the hybrid node is used for both control and execution and
capacity is deducted correctly
* add test for task.capacity_type = control
Test that control type tasks have the right capacity consumed and
get assigned to the right instance group
Also fix lint in the tests
* jobs_running not accurate for control nodes
We can either NOT use "idle instances" for control nodes, or we need
to update the jobs_running property on the Instance model to count
jobs where the node is the controller_node.
I didn't do that because it may be an expensive query, and it would be
hard to make it match with jobs_running on the InstanceGroup which
filters on tasks assigned to the instance group.
This change chooses to stop considering "idle" control nodes an option,
since we can't acurrately identify them.
The way things are without any change, is we are continuing to over consume capacity on control nodes
because this method sees all control nodes as "idle" at the beginning
of the task manager run, and then only counts jobs started in that run
in the in-memory tracking. So jobs which last over a number of task
manager runs build up consuming capacity, which is accurately reported
via Instance.consumed_capacity
* Reduce default task impact for control nodes
This is something we can experiment with as far as what users
want at install time, but start with just 1 for now.
* update capacity docs
Describe usage of the new setting and the concept of control impact.
Co-authored-by: Alan Rominger <arominge@redhat.com>
Co-authored-by: Rebeccah <rhunter@redhat.com>
2022-02-14 18:13:22 +03:00
PYTHONDONTWRITEBYTECODE = 1 py.test -p no:cacheprovider $( PYTEST_ARGS) $( TEST_DIRS)
2020-06-18 22:31:35 +03:00
cd awxkit && $( VENV_BASE) /awx/bin/tox -re py3
2020-08-03 22:30:37 +03:00
awx-manage check_migrations --dry-run --check -n 'missing_migration_file'
2013-05-22 01:39:34 +04:00
2023-02-03 19:06:08 +03:00
## Login to Github container image registry, pull image, then build image.
2023-02-02 23:27:18 +03:00
github_ci_setup :
2023-02-03 19:06:08 +03:00
# GITHUB_ACTOR is automatic github actions env var
# CI_GITHUB_TOKEN is defined in .github files
echo $( CI_GITHUB_TOKEN) | docker login ghcr.io -u $( GITHUB_ACTOR) --password-stdin
2023-02-02 23:27:18 +03:00
docker pull $( DEVEL_IMAGE_NAME) || : # Pre-pull image to warm build cache
2023-02-03 19:06:08 +03:00
make docker-compose-build
2023-02-02 23:27:18 +03:00
2023-02-03 19:06:08 +03:00
## Runs AWX_DOCKER_CMD inside a new docker container.
docker-runner :
docker run -u $( shell id -u) --rm -v $( shell pwd ) :/awx_devel/:Z --workdir= /awx_devel $( DEVEL_IMAGE_NAME) $( AWX_DOCKER_CMD)
## Builds image and runs AWX_DOCKER_CMD in it, mainly for .github checks.
github_ci_runner : github_ci_setup docker -runner
2023-02-02 23:27:18 +03:00
2019-09-17 22:48:00 +03:00
test_collection :
2020-06-16 03:54:14 +03:00
rm -f $( shell ls -d $( VENV_BASE) /awx/lib/python* | head -n 1) /no-global-site-packages.txt
if [ " $( VENV_BASE) " ] ; then \
2019-08-31 00:11:01 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2021-02-08 23:50:06 +03:00
fi && \
2022-12-21 00:06:25 +03:00
if ! [ -x " $( shell command -v ansible-playbook) " ] ; then pip install ansible-core; fi
ansible --version
2020-06-16 03:54:14 +03:00
py.test $( COLLECTION_TEST_DIRS) -v
2020-05-07 21:52:39 +03:00
# The python path needs to be modified so that the tests can find Ansible within the container
# First we will use anything expility set as PYTHONPATH
# Second we will load any libraries out of the virtualenv (if it's unspecified that should be ok because python should not load out of an empty directory)
# Finally we will add the system path so that the tests can find the ansible libraries
2019-08-31 00:11:01 +03:00
2021-03-19 19:44:51 +03:00
test_collection_all : test_collection
2019-09-17 22:48:00 +03:00
2020-02-20 23:05:58 +03:00
# WARNING: symlinking a collection is fundamentally unstable
# this is for rapid development iteration with playbooks, do not use with other test targets
symlink_collection :
2020-03-04 04:19:41 +03:00
rm -rf $( COLLECTION_INSTALL)
mkdir -p ~/.ansible/collections/ansible_collections/$( COLLECTION_NAMESPACE) # in case it does not exist
ln -s $( shell pwd ) /awx_collection $( COLLECTION_INSTALL)
2019-10-03 19:04:59 +03:00
2022-03-01 00:29:25 +03:00
awx_collection_build : $( shell find awx_collection -type f )
2021-10-19 17:25:31 +03:00
ansible-playbook -i localhost, awx_collection/tools/template_galaxy.yml \
-e collection_package = $( COLLECTION_PACKAGE) \
-e collection_namespace = $( COLLECTION_NAMESPACE) \
-e collection_version = $( COLLECTION_VERSION) \
2022-06-02 19:28:57 +03:00
-e '{"awx_template_version": $(COLLECTION_TEMPLATE_VERSION)}'
2020-06-10 14:14:34 +03:00
ansible-galaxy collection build awx_collection_build --force --output-path= awx_collection_build
2019-12-20 23:24:06 +03:00
2022-03-01 00:29:25 +03:00
build_collection : awx_collection_build
2019-12-20 23:24:06 +03:00
install_collection : build_collection
2020-03-04 04:19:41 +03:00
rm -rf $( COLLECTION_INSTALL)
2021-10-19 17:25:31 +03:00
ansible-galaxy collection install awx_collection_build/$( COLLECTION_NAMESPACE) -$( COLLECTION_PACKAGE) -$( COLLECTION_VERSION) .tar.gz
2019-08-31 00:11:01 +03:00
2022-12-21 00:06:25 +03:00
test_collection_sanity :
rm -rf awx_collection_build/
rm -rf $( COLLECTION_INSTALL)
if ! [ -x " $( shell command -v ansible-test) " ] ; then pip install ansible-core; fi
ansible --version
COLLECTION_VERSION = 1.0.0 make install_collection
2022-12-21 17:53:18 +03:00
cd $( COLLECTION_INSTALL) && ansible-test sanity $( COLLECTION_SANITY_ARGS)
2020-03-04 04:19:41 +03:00
test_collection_integration : install_collection
2020-03-24 05:47:30 +03:00
cd $( COLLECTION_INSTALL) && ansible-test integration $( COLLECTION_TEST_TARGET)
2020-03-04 04:19:41 +03:00
2016-01-27 19:38:56 +03:00
test_unit :
2016-08-23 22:35:43 +03:00
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-08-23 22:35:43 +03:00
fi ; \
2018-07-25 00:40:45 +03:00
py.test awx/main/tests/unit awx/conf/tests/unit awx/sso/tests/unit
2016-01-27 19:38:56 +03:00
2022-08-17 03:36:47 +03:00
## Run all API unit tests with coverage enabled.
2013-05-22 03:08:46 +04:00
test_coverage :
2016-08-23 22:35:43 +03:00
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-08-23 22:35:43 +03:00
fi ; \
2016-04-20 18:48:09 +03:00
py.test --create-db --cov= awx --cov-report= xml --junitxml= ./reports/junit.xml $( TEST_DIRS)
2013-05-22 03:08:46 +04:00
2022-08-17 03:36:47 +03:00
## Output test coverage as HTML (into htmlcov directory).
2013-05-22 03:08:46 +04:00
coverage_html :
coverage html
2022-08-17 03:36:47 +03:00
## Run API unit tests across multiple Python/Django versions with Tox.
2013-09-25 05:40:53 +04:00
test_tox :
tox -v
2022-08-17 03:36:47 +03:00
2017-01-03 17:09:43 +03:00
DATA_GEN_PRESET = ""
2022-08-17 03:36:47 +03:00
## Make fake data
2016-12-22 20:03:56 +03:00
bulk_data :
2016-12-22 21:53:19 +03:00
@if [ " $( VENV_BASE) " ] ; then \
2017-07-18 18:16:18 +03:00
. $( VENV_BASE) /awx/bin/activate; \
2016-12-22 21:53:19 +03:00
fi ; \
2017-01-03 17:09:43 +03:00
$( PYTHON) tools/data_generators/rbac_dummy_data_generator.py --preset= $( DATA_GEN_PRESET)
2016-12-22 20:03:56 +03:00
2015-07-28 22:55:00 +03:00
2020-11-24 21:58:19 +03:00
# UI TASKS
2019-06-28 19:11:07 +03:00
# --------------------------------------
2020-12-23 01:16:11 +03:00
2021-07-22 19:34:07 +03:00
UI_BUILD_FLAG_FILE = awx/ui/.ui-built
2020-12-23 01:16:11 +03:00
2020-11-24 21:58:19 +03:00
clean-ui :
rm -rf node_modules
2021-07-22 19:34:07 +03:00
rm -rf awx/ui/node_modules
rm -rf awx/ui/build
rm -rf awx/ui/src/locales/_build
2020-12-23 01:16:11 +03:00
rm -rf $( UI_BUILD_FLAG_FILE)
2022-10-27 00:51:29 +03:00
# the collectstatic command doesn't like it if this dir doesn't exist.
mkdir -p awx/ui/build/static
2020-06-19 00:28:44 +03:00
2021-07-22 19:34:07 +03:00
awx/ui/node_modules :
2022-09-26 22:34:54 +03:00
NODE_OPTIONS = --max-old-space-size= 6144 $( NPM_BIN) --prefix awx/ui --loglevel warn --force ci
2020-12-22 22:05:03 +03:00
2022-08-30 19:36:25 +03:00
$(UI_BUILD_FLAG_FILE) :
$( MAKE) awx/ui/node_modules
2021-07-20 00:40:26 +03:00
$( PYTHON) tools/scripts/compilemessages.py
2021-07-22 19:34:07 +03:00
$( NPM_BIN) --prefix awx/ui --loglevel warn run compile-strings
$( NPM_BIN) --prefix awx/ui --loglevel warn run build
2020-12-22 22:05:03 +03:00
touch $@
2020-06-19 00:28:44 +03:00
2021-10-13 01:57:29 +03:00
ui-release : $( UI_BUILD_FLAG_FILE )
2020-12-23 01:16:11 +03:00
2021-07-22 19:34:07 +03:00
ui-devel : awx /ui /node_modules
2020-12-23 01:16:11 +03:00
@$( MAKE) -B $( UI_BUILD_FLAG_FILE)
2023-03-09 03:33:37 +03:00
@if [ -d "/var/lib/awx" ] ; then \
mkdir -p /var/lib/awx/public/static/css; \
mkdir -p /var/lib/awx/public/static/js; \
mkdir -p /var/lib/awx/public/static/media; \
cp -r awx/ui/build/static/css/* /var/lib/awx/public/static/css; \
cp -r awx/ui/build/static/js/* /var/lib/awx/public/static/js; \
cp -r awx/ui/build/static/media/* /var/lib/awx/public/static/media; \
fi
2020-12-23 01:16:11 +03:00
2021-07-22 19:34:07 +03:00
ui-devel-instrumented : awx /ui /node_modules
$( NPM_BIN) --prefix awx/ui --loglevel warn run start-instrumented
2021-01-27 19:01:17 +03:00
2021-07-22 19:34:07 +03:00
ui-devel-test : awx /ui /node_modules
$( NPM_BIN) --prefix awx/ui --loglevel warn run start
2021-01-27 19:01:17 +03:00
2021-07-17 18:59:49 +03:00
ui-lint :
2021-07-22 19:34:07 +03:00
$( NPM_BIN) --prefix awx/ui install
$( NPM_BIN) run --prefix awx/ui lint
$( NPM_BIN) run --prefix awx/ui prettier-check
2021-07-17 18:59:49 +03:00
ui-test :
2021-07-22 19:34:07 +03:00
$( NPM_BIN) --prefix awx/ui install
2022-03-03 23:38:12 +03:00
$( NPM_BIN) run --prefix awx/ui test
2019-10-07 21:49:13 +03:00
2022-03-03 23:38:12 +03:00
ui-test-screens :
$( NPM_BIN) --prefix awx/ui install
$( NPM_BIN) run --prefix awx/ui pretest
$( NPM_BIN) run --prefix awx/ui test-screens --runInBand
2020-11-24 21:58:19 +03:00
2022-03-03 23:38:12 +03:00
ui-test-general :
$( NPM_BIN) --prefix awx/ui install
$( NPM_BIN) run --prefix awx/ui pretest
$( NPM_BIN) run --prefix awx/ui/ test-general --runInBand
2022-03-22 15:05:28 +03:00
2021-10-13 01:57:29 +03:00
HEADLESS ?= no
i f e q ( $( HEADLESS ) , y e s )
dist/$(SDIST_TAR_FILE) :
e l s e
dist/$(SDIST_TAR_FILE) : $( UI_BUILD_FLAG_FILE )
e n d i f
2022-06-27 16:22:25 +03:00
$( PYTHON) -m build -s
2021-10-13 01:57:29 +03:00
ln -sf $( SDIST_TAR_FILE) dist/awx.tar.gz
2014-05-22 19:25:50 +04:00
2015-09-23 23:10:40 +03:00
sdist : dist /$( SDIST_TAR_FILE )
2021-10-13 01:57:29 +03:00
echo $( HEADLESS)
2015-09-23 23:10:40 +03:00
@echo "#############################################"
@echo "Artifacts:"
@echo dist/$( SDIST_TAR_FILE)
@echo "#############################################"
2013-06-15 12:10:11 +04:00
2019-12-05 00:50:05 +03:00
# This directory is bind-mounted inside of the development container and
# needs to be pre-created for permissions to be set correctly. Otherwise,
# Docker will create this directory as root.
awx/projects :
@mkdir -p $@
2020-10-22 23:49:13 +03:00
COMPOSE_UP_OPTS ?=
2021-08-19 19:30:38 +03:00
COMPOSE_OPTS ?=
2021-07-23 02:30:00 +03:00
CONTROL_PLANE_NODE_COUNT ?= 1
2022-11-15 23:22:05 +03:00
EXECUTION_NODE_COUNT ?= 0
2021-07-13 07:36:19 +03:00
MINIKUBE_CONTAINER_GROUP ?= false
2022-09-27 20:15:59 +03:00
MINIKUBE_SETUP ?= false # if false, run minikube separately
2022-08-26 20:07:46 +03:00
EXTRA_SOURCES_ANSIBLE_OPTS ?=
i f n e q ( $( ADMIN_PASSWORD ) , )
EXTRA_SOURCES_ANSIBLE_OPTS := -e admin_password = $( ADMIN_PASSWORD) $( EXTRA_SOURCES_ANSIBLE_OPTS)
e n d i f
2020-10-22 17:56:26 +03:00
2021-03-23 16:49:13 +03:00
docker-compose-sources : .git /hooks /pre -commit
2021-07-19 18:05:05 +03:00
@if [ $( MINIKUBE_CONTAINER_GROUP) = true ] ; then \
2022-09-27 20:15:59 +03:00
ansible-playbook -i tools/docker-compose/inventory -e minikube_setup = $( MINIKUBE_SETUP) tools/docker-compose-minikube/deploy.yml; \
2021-07-13 07:36:19 +03:00
fi ;
2021-01-27 19:01:17 +03:00
ansible-playbook -i tools/docker-compose/inventory tools/docker-compose/ansible/sources.yml \
-e awx_image = $( DEV_DOCKER_TAG_BASE) /awx_devel \
2021-03-04 03:41:50 +03:00
-e awx_image_tag = $( COMPOSE_TAG) \
2021-11-19 22:00:23 +03:00
-e receptor_image = $( RECEPTOR_IMAGE) \
2021-07-23 02:30:00 +03:00
-e control_plane_node_count = $( CONTROL_PLANE_NODE_COUNT) \
-e execution_node_count = $( EXECUTION_NODE_COUNT) \
2022-01-11 00:52:44 +03:00
-e minikube_container_group = $( MINIKUBE_CONTAINER_GROUP) \
2022-03-10 18:29:04 +03:00
-e enable_keycloak = $( KEYCLOAK) \
2022-05-09 16:50:28 +03:00
-e enable_ldap = $( LDAP) \
2022-06-16 17:25:02 +03:00
-e enable_splunk = $( SPLUNK) \
-e enable_prometheus = $( PROMETHEUS) \
2022-08-26 20:07:46 +03:00
-e enable_grafana = $( GRAFANA) $( EXTRA_SOURCES_ANSIBLE_OPTS)
2021-07-13 07:36:19 +03:00
2021-01-27 19:01:17 +03:00
2021-10-03 20:40:26 +03:00
docker-compose : awx /projects docker -compose -sources
2023-02-15 14:51:36 +03:00
$( DOCKER_COMPOSE) -f tools/docker-compose/_sources/docker-compose.yml $( COMPOSE_OPTS) up $( COMPOSE_UP_OPTS) --remove-orphans
2016-09-08 17:18:14 +03:00
2021-10-03 20:40:26 +03:00
docker-compose-credential-plugins : awx /projects docker -compose -sources
2019-02-28 21:10:44 +03:00
echo -e "\033[0;31mTo generate a CyberArk Conjur API key: docker exec -it tools_conjur_1 conjurctl account create quick-start\033[0m"
2023-02-15 14:51:36 +03:00
$( DOCKER_COMPOSE) -f tools/docker-compose/_sources/docker-compose.yml -f tools/docker-credential-plugins-override.yml up --no-recreate awx_1 --remove-orphans
2019-01-22 02:20:24 +03:00
2021-10-03 20:40:26 +03:00
docker-compose-test : awx /projects docker -compose -sources
2023-02-15 14:51:36 +03:00
$( DOCKER_COMPOSE) -f tools/docker-compose/_sources/docker-compose.yml run --rm --service-ports awx_1 /bin/bash
2015-09-29 17:45:25 +03:00
2021-01-27 19:01:17 +03:00
docker-compose-runtest : awx /projects docker -compose -sources
2023-02-15 14:51:36 +03:00
$( DOCKER_COMPOSE) -f tools/docker-compose/_sources/docker-compose.yml run --rm --service-ports awx_1 /start_tests.sh
2018-10-03 18:32:54 +03:00
2021-01-27 19:01:17 +03:00
docker-compose-build-swagger : awx /projects docker -compose -sources
2023-02-15 14:51:36 +03:00
$( DOCKER_COMPOSE) -f tools/docker-compose/_sources/docker-compose.yml run --rm --service-ports --no-deps awx_1 /start_tests.sh swagger
2018-10-10 16:37:36 +03:00
2022-02-08 01:54:01 +03:00
SCHEMA_DIFF_BASE_BRANCH ?= devel
2019-05-22 02:15:21 +03:00
detect-schema-change : genschema
2022-02-08 01:54:01 +03:00
curl https://s3.amazonaws.com/awx-public-ci-files/$( SCHEMA_DIFF_BASE_BRANCH) /schema.json -o reference-schema.json
2018-11-16 17:47:33 +03:00
# Ignore differences in whitespace with -b
2018-12-20 23:05:01 +03:00
diff -u -b reference-schema.json schema.json
2018-11-16 00:25:13 +03:00
2019-12-05 00:50:05 +03:00
docker-compose-clean : awx /projects
2023-02-15 14:51:36 +03:00
$( DOCKER_COMPOSE) -f tools/docker-compose/_sources/docker-compose.yml rm -sf
2018-09-24 17:53:55 +03:00
2021-07-13 07:36:19 +03:00
docker-compose-container-group-clean :
2021-07-23 16:08:17 +03:00
@if [ -f "tools/docker-compose-minikube/_sources/minikube" ] ; then \
tools/docker-compose-minikube/_sources/minikube delete; \
fi
2021-07-13 07:36:19 +03:00
rm -rf tools/docker-compose-minikube/_sources/
2022-08-17 03:36:47 +03:00
## Base development image build
2020-05-14 20:21:46 +03:00
docker-compose-build :
2021-11-19 22:00:23 +03:00
ansible-playbook tools/ansible/dockerfile.yml -e build_dev = True -e receptor_image = $( RECEPTOR_IMAGE)
2021-02-23 17:32:00 +03:00
DOCKER_BUILDKIT = 1 docker build -t $( DEVEL_IMAGE_NAME) \
2021-01-26 18:23:13 +03:00
--build-arg BUILDKIT_INLINE_CACHE = 1 \
--cache-from= $( DEV_DOCKER_TAG_BASE) /awx_devel:$( COMPOSE_TAG) .
2017-06-14 18:47:30 +03:00
2016-03-16 20:06:54 +03:00
docker-clean :
2023-02-14 18:06:15 +03:00
-$( foreach container_id,$( shell docker ps -f name = tools_awx -aq && docker ps -f name = tools_receptor -aq) ,docker stop $( container_id) ; docker rm -f $( container_id) ; )
-$( foreach image_id,$( shell docker images --filter= reference = '*awx_devel*' -aq) ,docker rmi --force $( image_id) ; )
2020-04-06 20:06:18 +03:00
2021-07-13 07:36:19 +03:00
docker-clean-volumes : docker -compose -clean docker -compose -container -group -clean
2022-06-16 21:03:22 +03:00
docker volume rm -f tools_awx_db tools_grafana_storage tools_prometheus_storage $( docker volume ls --filter name = tools_redis_socket_ -q)
2016-03-16 20:06:54 +03:00
docker-refresh : docker -clean docker -compose
2016-02-01 19:30:43 +03:00
2022-08-17 03:36:47 +03:00
## Docker Development Environment with Elastic Stack Connected
2021-10-03 20:40:26 +03:00
docker-compose-elk : awx /projects docker -compose -sources
2023-02-15 14:51:36 +03:00
$( DOCKER_COMPOSE) -f tools/docker-compose/_sources/docker-compose.yml -f tools/elastic/docker-compose.logstash-link.yml -f tools/elastic/docker-compose.elastic-override.yml up --no-recreate
2016-10-17 22:00:38 +03:00
2021-10-03 20:40:26 +03:00
docker-compose-cluster-elk : awx /projects docker -compose -sources
2023-02-15 14:51:36 +03:00
$( DOCKER_COMPOSE) -f tools/docker-compose/_sources/docker-compose.yml -f tools/elastic/docker-compose.logstash-link-cluster.yml -f tools/elastic/docker-compose.elastic-override.yml up --no-recreate
2016-10-17 22:00:38 +03:00
2021-07-13 07:36:19 +03:00
docker-compose-container-group :
MINIKUBE_CONTAINER_GROUP = true make docker-compose
2016-10-17 22:00:38 +03:00
clean-elk :
docker stop tools_kibana_1
docker stop tools_logstash_1
docker stop tools_elasticsearch_1
docker rm tools_logstash_1
docker rm tools_elasticsearch_1
docker rm tools_kibana_1
2015-10-09 19:03:25 +03:00
psql-container :
2020-12-15 23:03:18 +03:00
docker run -it --net tools_default --rm postgres:12 sh -c 'exec psql -h "postgres" -p "5432" -U postgres'
2017-07-25 17:54:42 +03:00
VERSION :
2018-09-27 02:53:35 +03:00
@echo " awx: $( VERSION) "
2020-12-26 21:01:25 +03:00
2022-02-07 23:42:35 +03:00
PYTHON_VERSION :
@echo " $( PYTHON) " | sed 's:python::'
2023-02-28 04:53:07 +03:00
.PHONY : Dockerfile
2021-01-27 19:01:17 +03:00
Dockerfile : tools /ansible /roles /dockerfile /templates /Dockerfile .j 2
2021-11-19 22:00:23 +03:00
ansible-playbook tools/ansible/dockerfile.yml -e receptor_image = $( RECEPTOR_IMAGE)
2021-01-25 20:25:37 +03:00
2021-01-27 19:01:17 +03:00
Dockerfile.kube-dev : tools /ansible /roles /dockerfile /templates /Dockerfile .j 2
ansible-playbook tools/ansible/dockerfile.yml \
2021-01-25 20:25:37 +03:00
-e dockerfile_name = Dockerfile.kube-dev \
-e kube_dev = True \
2021-11-19 22:00:23 +03:00
-e template_dest = _build_kube_dev \
-e receptor_image = $( RECEPTOR_IMAGE)
2021-01-25 20:25:37 +03:00
2022-08-30 23:19:36 +03:00
## Build awx_kube_devel image for development on local Kubernetes environment.
2021-01-25 20:25:37 +03:00
awx-kube-dev-build : Dockerfile .kube -dev
2022-03-22 15:05:28 +03:00
DOCKER_BUILDKIT = 1 docker build -f Dockerfile.kube-dev \
2021-01-26 18:23:13 +03:00
--build-arg BUILDKIT_INLINE_CACHE = 1 \
2022-03-22 15:05:28 +03:00
--cache-from= $( DEV_DOCKER_TAG_BASE) /awx_kube_devel:$( COMPOSE_TAG) \
2021-01-25 20:25:37 +03:00
-t $( DEV_DOCKER_TAG_BASE) /awx_kube_devel:$( COMPOSE_TAG) .
2021-01-26 20:20:19 +03:00
2022-08-30 23:19:36 +03:00
## Build awx image for deployment on Kubernetes environment.
awx-kube-build : Dockerfile
DOCKER_BUILDKIT = 1 docker build -f Dockerfile \
--build-arg VERSION = $( VERSION) \
--build-arg SETUPTOOLS_SCM_PRETEND_VERSION = $( VERSION) \
--build-arg HEADLESS = $( HEADLESS) \
-t $( DEV_DOCKER_TAG_BASE) /awx:$( COMPOSE_TAG) .
2021-01-26 20:20:19 +03:00
# Translation TASKS
# --------------------------------------
2022-08-17 03:36:47 +03:00
## generate UI .pot file, an empty template of strings yet to be translated
2021-01-26 20:20:19 +03:00
pot : $( UI_BUILD_FLAG_FILE )
2021-07-22 19:34:07 +03:00
$( NPM_BIN) --prefix awx/ui --loglevel warn run extract-template --clean
2021-06-08 16:58:51 +03:00
2022-08-17 03:36:47 +03:00
## generate UI .po files for each locale (will update translated strings for `en`)
2021-06-08 16:58:51 +03:00
po : $( UI_BUILD_FLAG_FILE )
2021-07-22 19:34:07 +03:00
$( NPM_BIN) --prefix awx/ui --loglevel warn run extract-strings -- --clean
2021-01-26 20:20:19 +03:00
2022-08-17 03:36:47 +03:00
## generate API django .pot .po
2021-01-26 20:20:19 +03:00
messages :
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /awx/bin/activate; \
fi ; \
2022-12-02 18:46:16 +03:00
$( PYTHON) manage.py makemessages -l en_us --keep-pot
2022-03-01 00:29:25 +03:00
print-% :
@echo $( $* )
2022-08-17 03:36:47 +03:00
# HELP related targets
# --------------------------------------
HELP_FILTER = .PHONY
## Display help targets
help :
@printf "Available targets:\n"
@make -s help/generate | grep -vE " \w( $( HELP_FILTER) ) "
## Display help for all targets
help/all :
@printf "Available targets:\n"
@make -s help/generate
## Generate help output from MAKEFILE_LIST
help/generate :
@awk ' /^[ -a-zA-Z_0-9%:\\ \. \/ ] +:/ { \
helpMessage = match( lastLine, /^## ( .*) /) ; \
if ( helpMessage) { \
helpCommand = $$ 1; \
helpMessage = substr( lastLine, RSTART + 3, RLENGTH) ; \
gsub( "\\\\" , "" , helpCommand) ; \
gsub( " :+ $$ " , "" , helpCommand) ; \
printf " \x1b[32;01m%-35s\x1b[0m %s\n" , helpCommand, helpMessage; \
} else { \
helpCommand = $$ 1; \
gsub( "\\\\" , "" , helpCommand) ; \
gsub( " :+ $$ " , "" , helpCommand) ; \
printf " \x1b[32;01m%-35s\x1b[0m %s\n" , helpCommand, "No help available" ; \
} \
} \
{ lastLine = $$ 0 } ' $( MAKEFILE_LIST) | sort -u
2022-10-27 00:51:29 +03:00
@printf "\n"