2015-09-13 22:40:32 +03:00
PYTHON = python
2016-01-29 17:03:03 +03:00
PYTHON_VERSION = $( shell $( PYTHON) -c "from distutils.sysconfig import get_python_version; print get_python_version()" )
2013-06-15 12:10:11 +04:00
SITELIB = $( shell $( PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" )
2014-04-29 19:19:14 +04:00
OFFICIAL ?= no
2014-01-07 23:14:07 +04:00
PACKER ?= packer
2015-11-06 23:19:35 +03:00
PACKER_BUILD_OPTS ?= -var 'official=$(OFFICIAL)' -var 'aw_repo_url=$(AW_REPO_URL)'
2014-03-19 19:29:02 +04:00
GRUNT ?= $( shell [ -t 0 ] && echo "grunt" || echo "grunt --no-color" )
2015-07-08 22:38:58 +03:00
TESTEM ?= ./node_modules/.bin/testem
2015-07-16 23:03:46 +03:00
BROCCOLI_BIN ?= ./node_modules/.bin/broccoli
2015-12-05 00:05:21 +03:00
MOCHA_BIN ?= ./node_modules/.bin/_mocha
ISTANBUL_BIN ?= ./node_modules/.bin/istanbul
BROWSER_SYNC_BIN ?= ./node_modules/.bin/browser-sync
2015-02-09 22:29:48 +03:00
NODE ?= node
2015-09-11 02:03:41 +03:00
NPM_BIN ?= npm
2015-09-04 21:08:35 +03:00
DEPS_SCRIPT ?= packaging/bundle/deps.py
2015-11-06 23:19:35 +03:00
GIT_BRANCH ?= $( shell git rev-parse --abbrev-ref HEAD)
2013-06-24 21:03:33 +04:00
2016-03-09 22:33:42 +03:00
VENV_BASE ?= /tower_devel/venv
2016-03-11 00:44:31 +03:00
SCL_PREFIX ?=
2016-03-09 22:33:42 +03:00
2015-07-20 18:56:02 +03:00
CLIENT_TEST_DIR ?= build_test
2015-07-16 23:03:46 +03:00
2015-09-04 04:33:55 +03:00
# Determine appropriate shasum command
UNAME_S := $( shell uname -s)
i f e q ( $( UNAME_S ) , L i n u x )
SHASUM_BIN ?= sha256sum
e n d i f
i f e q ( $( UNAME_S ) , D a r w i n )
SHASUM_BIN ?= shasum -a 256
e n d i f
2013-06-24 21:03:33 +04:00
# Get the branch information from git
GIT_DATE := $( shell git log -n 1 --format= "%ai" )
2013-06-26 03:46:12 +04:00
DATE := $( shell date -u +%Y%m%d%H%M)
2013-06-24 21:03:33 +04:00
2014-10-17 17:01:45 +04:00
NAME = ansible-tower
VERSION = $( shell $( PYTHON) -c "from awx import __version__; print(__version__.split('-')[0])" )
GIT_REMOTE_URL = $( shell git config --get remote.origin.url)
2014-10-28 22:20:33 +03:00
BUILD = 0.git$( DATE)
i f e q ( $( OFFICIAL ) , y e s )
RELEASE ?= 1
2015-11-06 23:19:35 +03:00
AW_REPO_URL ?= http://releases.ansible.com/ansible-tower
2014-10-28 22:20:33 +03:00
e l s e
RELEASE ?= $( BUILD)
2015-11-06 23:19:35 +03:00
AW_REPO_URL ?= http://jenkins.testing.ansible.com/ansible-tower_nightlies_RTYUIOPOIUYTYU/$( GIT_BRANCH)
2014-10-28 22:20:33 +03:00
e n d i f
2014-01-28 18:58:44 +04:00
2014-02-03 22:22:58 +04:00
# Allow AMI license customization
2015-04-24 17:44:22 +03:00
AWS_INSTANCE_COUNT ?= 0
2014-01-28 18:58:44 +04:00
2015-05-26 18:03:36 +03:00
# GPG signature parameters (BETA key not yet used)
2015-09-04 04:33:55 +03:00
GPG_BIN ?= gpg
2015-05-26 18:03:36 +03:00
GPG_RELEASE = 442667A9
2015-09-10 23:26:59 +03:00
GPG_RELEASE_FILE = GPG-KEY-ansible-release
2015-05-26 18:03:36 +03:00
GPG_BETA = D7B00447
2015-09-10 23:26:59 +03:00
GPG_BETA_FILE = GPG-KEY-ansible-beta
2015-05-26 18:03:36 +03:00
2015-09-08 20:02:15 +03:00
# Determine GPG key for package signing
2015-05-26 18:03:36 +03:00
i f e q ( $( OFFICIAL ) , y e s )
GPG_KEY = $( GPG_RELEASE)
GPG_FILE = $( GPG_RELEASE_FILE)
e n d i f
2014-10-17 17:01:45 +04:00
# TAR build parameters
2015-05-26 18:03:36 +03:00
i f e q ( $( OFFICIAL ) , y e s )
2014-10-17 17:01:45 +04:00
SETUP_TAR_NAME = $( NAME) -setup-$( VERSION)
SDIST_TAR_NAME = $( NAME) -$( VERSION)
2015-05-26 18:03:36 +03:00
e l s e
2015-09-04 04:33:55 +03:00
SETUP_TAR_NAME = $( NAME) -setup-$( VERSION) -$( RELEASE)
SDIST_TAR_NAME = $( NAME) -$( VERSION) -$( RELEASE)
2013-06-24 21:03:33 +04:00
e n d i f
2014-10-17 17:01:45 +04:00
SDIST_TAR_FILE = $( SDIST_TAR_NAME) .tar.gz
2014-10-28 22:20:33 +03:00
SETUP_TAR_FILE = $( SETUP_TAR_NAME) .tar.gz
2014-11-18 17:31:43 +03:00
SETUP_TAR_LINK = $( NAME) -setup-latest.tar.gz
2015-09-04 04:33:55 +03:00
SETUP_TAR_CHECKSUM = $( NAME) -setup-CHECKSUM
2014-10-17 17:01:45 +04:00
# DEB build parameters
DEBUILD_BIN ?= debuild
DEBUILD_OPTS = --source-option= "-I"
DPUT_BIN ?= dput
2015-09-13 22:40:32 +03:00
DPUT_OPTS ?= -c .dput.cf -u
2015-09-24 23:30:27 +03:00
REPREPRO_BIN ?= reprepro
REPREPRO_OPTS ?= -b reprepro --export= force
DEB_DIST ?=
2014-10-17 17:01:45 +04:00
i f e q ( $( OFFICIAL ) , y e s )
2015-09-08 20:02:15 +03:00
# Sign official builds
2015-09-10 23:26:59 +03:00
DEBUILD_OPTS += -k$( GPG_KEY)
2015-09-24 23:30:27 +03:00
REPREPRO_OPTS += --ask-passphrase
2014-10-17 17:01:45 +04:00
e l s e
# Do not sign development builds
DEBUILD_OPTS += -uc -us
e n d i f
DEBUILD = $( DEBUILD_BIN) $( DEBUILD_OPTS)
2015-09-13 22:40:32 +03:00
DEB_PPA ?= mini_dinstall
2015-08-26 18:49:09 +03:00
DEB_ARCH ?= amd64
2015-09-13 22:40:32 +03:00
DEB_NVR = $( NAME) _$( VERSION) -$( RELEASE) ~$( DEB_DIST)
DEB_NVRA = $( DEB_NVR) _$( DEB_ARCH)
DEB_NVRS = $( DEB_NVR) _source
DEB_TAR_NAME = $( NAME) -$( VERSION)
DEB_TAR_FILE = $( NAME) _$( VERSION) .orig.tar.gz
# pbuilder parameters
PBUILDER_CACHE_DIR = /var/cache/pbuilder
PBUILDER_BIN ?= pbuilder
PBUILDER_OPTS ?= --debootstrapopts --variant= buildd --distribution $( DEB_DIST) --architecture $( DEB_ARCH) --basetgz $( PBUILDER_CACHE_DIR) /$( DEB_DIST) -$( DEB_ARCH) -base.tgz --buildresult $( PWD) /deb-build
2014-10-17 17:01:45 +04:00
# RPM build parameters
2015-09-04 04:33:55 +03:00
MOCK_BIN ?= mock
MOCK_CFG ?=
2014-10-17 17:01:45 +04:00
RPM_SPECDIR = packaging/rpm
RPM_SPEC = $( RPM_SPECDIR) /$( NAME) .spec
2014-10-21 23:50:24 +04:00
RPM_DIST ?= $( shell rpm --eval '%{?dist}' 2>/dev/null)
2016-03-11 00:44:31 +03:00
2015-09-24 23:30:27 +03:00
# Provide a fallback value for RPM_DIST
2015-09-04 03:42:43 +03:00
i f e q ( $( RPM_DIST ) , )
2015-09-24 23:30:27 +03:00
RPM_DIST = .el6
2015-09-04 03:42:43 +03:00
e n d i f
2015-08-26 18:49:09 +03:00
RPM_ARCH ?= $( shell rpm --eval '%{_arch}' 2>/dev/null)
2015-09-24 23:30:27 +03:00
# Provide a fallback value for RPM_ARCH
2015-09-04 03:42:43 +03:00
i f e q ( $( RPM_ARCH ) , )
2015-09-24 23:30:27 +03:00
RPM_ARCH = $( shell uname -m)
2015-09-04 03:42:43 +03:00
e n d i f
2016-03-11 00:44:31 +03:00
# Software collections settings if on EL6
i f e q ( $( RPM_DIST ) , . e l 6 )
SCL_PREFIX = python27-
SCL_DEFINES = --define 'scl python27'
e l s e
SCL_PREFIX =
SCL_DEFINES =
e n d i f
RPM_NVR = $( SCL_PREFIX) $( NAME) -$( VERSION) -$( RELEASE) $( RPM_DIST)
2014-05-09 16:59:02 +04:00
2015-09-04 04:33:55 +03:00
# TAR Bundle build parameters
2015-08-31 20:16:59 +03:00
DIST = $( shell echo $( RPM_DIST) | sed -e 's|^\.\(el\)\([0-9]\).*|\1|' )
DIST_MAJOR = $( shell echo $( RPM_DIST) | sed -e 's|^\.\(el\)\([0-9]\).*|\2|' )
2015-08-31 19:01:15 +03:00
DIST_FULL = $( DIST) $( DIST_MAJOR)
2015-09-05 15:39:32 +03:00
OFFLINE_TAR_NAME = $( NAME) -setup-bundle-$( VERSION) -$( RELEASE) .$( DIST_FULL)
2015-08-31 19:01:15 +03:00
OFFLINE_TAR_FILE = $( OFFLINE_TAR_NAME) .tar.gz
2015-09-05 15:39:32 +03:00
OFFLINE_TAR_LINK = $( NAME) -setup-bundle-latest.$( DIST_FULL) .tar.gz
OFFLINE_TAR_CHECKSUM = $( NAME) -setup-bundle-CHECKSUM
2015-08-20 17:25:34 +03:00
2015-09-13 22:40:32 +03:00
# Detect underlying OS distribution
DISTRO ?=
i f n e q ( , $( wildcard /etc /lsb -release ) )
DISTRO = $( shell . /etc/lsb-release && echo $$ { DISTRIB_ID} | tr '[:upper:]' '[:lower:]' )
e n d i f
i f n e q ( , $( wildcard /etc /os -release ) )
DISTRO = $( shell . /etc/os-release && echo $$ { ID} )
e n d i f
i f n e q ( , $( wildcard /etc /fedora -release ) )
DISTRO = fedora
e n d i f
i f n e q ( , $( wildcard /etc /centos -release ) )
DISTRO = centos
e n d i f
i f n e q ( , $( wildcard /etc /redhat -release ) )
DISTRO = redhat
e n d i f
# Adjust `setup.py install` parameters based on OS distribution
SETUP_INSTALL_ARGS = --skip-build --no-compile --root= $( DESTDIR) -v
2015-08-26 23:15:07 +03:00
i f e q ( $( DISTRO ) , u b u n t u )
2015-09-13 22:40:32 +03:00
SETUP_INSTALL_ARGS += --install-layout= deb
2015-08-26 23:15:07 +03:00
e n d i f
.DEFAULT_GOAL := build
2015-08-11 23:54:52 +03:00
.PHONY : clean rebase push requirements requirements_dev requirements_jenkins \
2016-02-02 22:50:42 +03:00
develop refresh adduser migrate dbchange dbshell runserver celeryd \
2016-01-28 20:01:12 +03:00
receiver test test_unit test_coverage coverage_html test_jenkins dev_build \
2015-05-26 18:03:36 +03:00
release_build release_clean sdist rpmtar mock-rpm mock-srpm rpm-sign \
2015-12-05 00:05:21 +03:00
build-ui sync-ui test-ui build-ui-for-coverage test-ui-for-coverage \
build-ui-for-browser-tests test-ui-debug jshint ngdocs \
websocket-proxy browser-sync browser-sync-reload brocolli-watcher \
devjs minjs testjs_ci \
2015-09-13 22:40:32 +03:00
deb deb-src debian debsign pbuilder reprepro setup_tarball \
2015-08-11 23:04:36 +03:00
virtualbox-ovf virtualbox-centos-7 virtualbox-centos-6 \
2015-09-04 04:33:55 +03:00
clean-bundle setup_bundle_tarball
2014-10-28 22:20:33 +03:00
# Remove setup build files
clean-tar :
rm -rf tar-build
2013-06-20 23:53:10 +04:00
2014-10-23 00:41:24 +04:00
# Remove rpm build files
clean-rpm :
rm -rf rpm-build
# Remove debian build files
clean-deb :
rm -rf deb-build reprepro
# Remove grunt build files
clean-grunt :
2015-02-05 23:27:16 +03:00
rm -f package.json Gruntfile.js Brocfile.js bower.json
2014-10-23 00:41:24 +04:00
rm -rf node_modules
2015-04-24 17:44:22 +03:00
# Remove packer artifacts
clean-packer :
rm -rf packer_cache
rm -rf packaging/packer/packer_cache
rm -rf packaging/packer/output-virtualbox-iso/
2015-08-14 03:20:33 +03:00
rm -rf packaging/packer/output-vmware-iso
2015-04-24 17:44:22 +03:00
rm -f packaging/packer/ansible-tower-*.box
rm -rf packaging/packer/ansible-tower*-ova
2015-08-14 03:20:33 +03:00
rm -rf packaging/packer/ansible-tower*-vmx
2015-04-24 17:44:22 +03:00
rm -f Vagrantfile
2015-09-04 04:33:55 +03:00
clean-bundle :
rm -rf setup-bundle-build
2015-08-11 23:04:36 +03:00
2015-12-05 00:05:21 +03:00
# remove ui build artifacts
clean-ui :
rm -rf DEBUG
clean-static :
rm -rf awx/ui/static/
clean-build-test :
rm -rf awx/ui/build_test/
2014-10-23 00:41:24 +04:00
# Remove temporary build files, compiled Python files.
2015-12-05 00:05:21 +03:00
clean : clean -rpm clean -deb clean -grunt clean -ui clean -static clean -build -test clean -tar clean -packer clean -bundle
2015-08-10 18:02:51 +03:00
rm -rf awx/lib/site-packages
2015-10-16 03:30:36 +03:00
rm -rf awx/lib/.deps_built
2014-10-23 00:41:24 +04:00
rm -rf dist/*
2015-10-05 22:24:43 +03:00
rm -rf tmp
mkdir tmp
2014-10-23 00:41:24 +04:00
rm -rf build $( NAME) -$( VERSION) *.egg-info
2013-03-13 21:09:36 +04:00
find . -type f -regex " .*\.py[co] $$ " -delete
2015-09-24 23:30:27 +03:00
# convenience target to assert environment variables are defined
guard-% :
@if [ " ${ ${ * } } " = = "" ] ; then \
echo " The required environment variable ' $* ' is not set " ; \
exit 1; \
fi
2013-06-20 23:53:10 +04:00
# Fetch from origin, rebase local commits on top of origin commits.
2013-03-13 23:28:30 +04:00
rebase :
git pull --rebase origin master
2013-06-20 23:53:10 +04:00
# Push changes to origin.
2013-03-14 00:06:19 +04:00
push :
2013-06-20 23:53:10 +04:00
git push origin master
2013-03-13 23:15:35 +04:00
2016-03-09 22:33:42 +03:00
virtualenv :
if [ " $( VENV_BASE) " ] ; then \
if [ ! -d " $( VENV_BASE) " ] ; then \
mkdir $( VENV_BASE) ; \
fi ; \
if [ ! -d " $( VENV_BASE) /tower " ] ; then \
virtualenv --system-site-packages $( VENV_BASE) /tower; \
fi ; \
if [ ! -d " $( VENV_BASE) /ansible " ] ; then \
virtualenv --system-site-packages $( VENV_BASE) /ansible; \
fi ; \
2016-01-29 17:03:03 +03:00
fi
2013-06-20 23:53:10 +04:00
2016-03-25 20:10:47 +03:00
requirements_ansible :
2016-03-09 22:33:42 +03:00
if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /ansible/bin/activate; \
2016-04-13 18:18:30 +03:00
$( VENV_BASE) /ansible/bin/pip install -U pip = = 8.1.1; \
$( VENV_BASE) /ansible/bin/pip install -r requirements/requirements_ansible.txt ; \
else \
pip install -U pip = = 8.1.1; \
pip install -r requirements/requirements_ansible.txt ; \
fi
2013-06-20 23:53:10 +04:00
2016-03-09 22:33:42 +03:00
# Install third-party requirements needed for Tower's environment.
2016-03-25 20:10:47 +03:00
requirements_tower :
2016-03-09 22:33:42 +03:00
if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
2016-04-13 18:18:30 +03:00
$( VENV_BASE) /tower/bin/pip install -U pip = = 8.1.1; \
$( VENV_BASE) /tower/bin/pip install -r requirements/requirements.txt ; \
else \
pip install -U pip = = 8.1.1; \
pip install -r requirements/requirements.txt ; \
fi
2016-03-09 22:33:42 +03:00
2016-03-25 20:10:47 +03:00
requirements_tower_dev :
2016-03-09 22:33:42 +03:00
if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
2016-04-13 18:18:30 +03:00
$( VENV_BASE) /tower/bin/pip install -r requirements/requirements_dev.txt; \
fi
2013-06-20 23:53:10 +04:00
2014-09-10 23:25:29 +04:00
# Install third-party requirements needed for running unittests in jenkins
2016-03-25 20:10:47 +03:00
requirements_jenkins :
2016-04-07 03:33:44 +03:00
if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
2016-04-13 18:18:30 +03:00
$( VENV_BASE) /tower/bin/pip install -Ir requirements/requirements_jenkins.txt; \
else \
pip install -Ir requirements/requirements_jenkins..txt; \
2016-04-07 03:33:44 +03:00
fi && \
2015-09-11 02:03:41 +03:00
$( NPM_BIN) install csslint jshint
2014-09-10 23:25:29 +04:00
2016-03-25 20:10:47 +03:00
requirements : virtualenv requirements_ansible requirements_tower
2016-04-06 21:28:34 +03:00
requirements_dev : requirements requirements_tower_dev
2016-03-25 20:10:47 +03:00
2016-04-07 03:33:44 +03:00
requirements_test : requirements requirements_jenkins
2015-08-05 15:10:16 +03:00
# "Install" ansible-tower 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 \
2014-01-29 22:49:29 +04:00
sudo pip uninstall -y awx; \
2013-09-25 05:40:53 +04:00
sudo $( PYTHON) setup.py develop; \
2014-11-11 23:18:39 +03:00
fi
2015-08-05 15:10:16 +03:00
version_file :
mkdir -p /var/lib/awx/
python -c "import awx as awx; print awx.__version__" > /var/lib/awx/.tower_version
2014-11-11 23:18:39 +03:00
# Do any one-time init tasks.
init :
2016-03-09 22:33:42 +03:00
if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
fi ; \
2016-04-06 19:24:19 +03:00
tower-manage register_instance --primary --hostname= 127.0.0.1; \
2013-05-25 01:55:03 +04:00
2013-06-20 23:53:10 +04: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
2013-06-20 23:53:10 +04:00
# Create Django superuser.
2013-03-14 01:20:50 +04:00
adduser :
2016-04-13 18:18:30 +03:00
tower-manage createsuperuser
2013-03-14 01:20:50 +04:00
2013-06-20 23:53:10 +04: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 \
. $( VENV_BASE) /tower/bin/activate; \
fi ; \
2016-04-13 18:18:30 +03:00
tower-manage migrate --noinput --fake-initial
2013-03-13 23:15:35 +04:00
2013-06-20 23:53:10 +04:00
# Run after making changes to the models to create a new migration.
dbchange :
2016-04-13 18:18:30 +03:00
tower-manage makemigrations
2013-06-20 23:53:10 +04:00
2013-06-23 21:21:02 +04:00
# access database shell, asks for password
2013-03-13 23:15:35 +04:00
dbshell :
2013-12-21 03:16:52 +04:00
sudo -u postgres psql -d awx-dev
2013-03-01 04:52:14 +04:00
2014-05-02 23:26:05 +04:00
server_noattach :
2014-03-19 21:51:48 +04:00
tmux new-session -d -s tower 'exec make runserver'
tmux rename-window 'Tower'
tmux select -window -t tower:0
tmux split-window -v 'exec make celeryd'
tmux split-window -h 'exec make taskmanager'
2015-04-23 20:34:56 +03:00
tmux new-window 'exec make receiver'
tmux select -window -t tower:1
tmux rename-window 'Extra Services'
tmux split-window -v 'exec make socketservice'
tmux split-window -h 'exec make factcacher'
2014-05-02 23:26:05 +04:00
server : server_noattach
2014-03-19 21:51:48 +04:00
tmux -2 attach-session -t tower
2015-02-13 18:30:01 +03:00
# Use with iterm2's native tmux protocol support
2015-02-10 20:34:52 +03:00
servercc : server_noattach
tmux -2 -CC attach-session -t tower
2015-08-04 22:26:27 +03:00
# Alternate approach to tmux to run all development tasks specified in
# Procfile. https://youtu.be/OPMgaibszjk
honcho :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
fi ; \
2015-08-04 22:26:27 +03:00
honcho start
2013-06-20 23:53:10 +04:00
# Run the built-in development webserver (by default on http://localhost:8013).
runserver :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
fi ; \
2013-09-25 05:40:53 +04:00
$( PYTHON) manage.py runserver
2013-06-20 23:53:10 +04:00
# Run to start the background celery worker for development.
celeryd :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
fi ; \
2014-02-04 02:04:56 +04:00
$( PYTHON) manage.py celeryd -l DEBUG -B --autoscale= 20,2 -Ofair
2013-06-20 23:53:10 +04:00
2014-02-19 00:16:39 +04:00
# Run to start the zeromq callback receiver
receiver :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
fi ; \
2014-02-19 00:16:39 +04:00
$( PYTHON) manage.py run_callback_receiver
2014-03-12 22:09:00 +04:00
taskmanager :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
fi ; \
2014-03-12 22:09:00 +04:00
$( PYTHON) manage.py run_task_system
2014-04-16 23:26:52 +04:00
socketservice :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
fi ; \
2014-04-16 23:26:52 +04:00
$( PYTHON) manage.py run_socketio_service
2015-04-23 20:34:56 +03:00
factcacher :
2016-03-09 22:33:42 +03:00
@if [ " $( VENV_BASE) " ] ; then \
. $( VENV_BASE) /tower/bin/activate; \
fi ; \
2015-04-23 20:34:56 +03:00
$( PYTHON) manage.py run_fact_cache_receiver
2015-05-20 22:26:44 +03:00
reports :
mkdir -p $@
2014-04-23 21:55:09 +04:00
2015-05-20 22:26:44 +03:00
pep8 : reports
@( set -o pipefail && $@ | tee reports/$@ .report)
2014-04-23 21:55:09 +04:00
2015-05-20 22:26:44 +03:00
flake8 : reports
@$@ --output-file= reports/$@ .report
pyflakes : reports
@( set -o pipefail && $@ | tee reports/$@ .report)
pylint : reports
@( set -o pipefail && $@ | reports/$@ .report)
check : flake 8 pep 8 # pyflakes pylint
2016-03-02 20:09:15 +03:00
2013-09-25 05:40:53 +04:00
# Run all API unit tests.
2013-03-01 04:52:14 +04:00
test :
2016-03-22 17:28:05 +03:00
py.test awx/main/tests awx/api/tests
2013-05-22 01:39:34 +04:00
2016-01-27 19:38:56 +03:00
test_unit :
2016-01-28 20:01:12 +03:00
py.test awx/main/tests/unit
2016-01-27 19:38:56 +03:00
2013-09-25 05:40:53 +04:00
# Run all API unit tests with coverage enabled.
2013-05-22 03:08:46 +04:00
test_coverage :
2016-03-22 16:46:46 +03:00
py.test --create-db --cov= awx --cov-report= xml --junitxml= ./reports/junit.xml awx/main/tests awx/api/tests
2013-05-22 03:08:46 +04:00
2013-06-20 23:53:10 +04:00
# Output test coverage as HTML (into htmlcov directory).
2013-05-22 03:08:46 +04:00
coverage_html :
coverage html
2013-09-25 05:40:53 +04:00
# Run API unit tests across multiple Python/Django versions with Tox.
test_tox :
tox -v
# Run unit tests to produce output for Jenkins.
2016-01-28 20:01:12 +03:00
# Alias existing make target so old versions run against Jekins the same way
test_jenkins : test_coverage
2013-09-25 05:40:53 +04:00
2015-07-28 22:55:00 +03:00
# UI TASKS
# --------------------------------------
2015-12-05 00:05:21 +03:00
# begin targets that pull ui files from packaging to the root of the app
2015-07-23 22:38:14 +03:00
Gruntfile.js : packaging /node /Gruntfile .js
2015-02-11 18:15:32 +03:00
cp $< $@
2014-07-07 17:41:44 +04:00
2015-07-23 22:38:14 +03:00
Brocfile.js : packaging /node /Brocfile .js
2015-02-11 18:15:32 +03:00
cp $< $@
2015-02-05 23:27:16 +03:00
2015-07-23 22:38:14 +03:00
bower.json : packaging /node /bower .json
2015-02-11 18:15:32 +03:00
cp $< $@
2014-07-07 17:41:44 +04:00
2015-07-23 22:38:14 +03:00
package.json : packaging /node /package .template
2015-02-11 18:15:32 +03:00
sed -e 's#%NAME%#$(NAME)#;s#%VERSION%#$(VERSION)#;s#%GIT_REMOTE_URL%#$(GIT_REMOTE_URL)#;' $< > $@
2014-02-26 17:36:32 +04:00
2015-08-03 22:33:03 +03:00
testem.yml : packaging /node /testem .yml
cp $< $@
2015-12-05 00:05:21 +03:00
.istanbul.yml : packaging /node /.istanbul .yml
cp $< $@
# end targets that pull ui files from packaging to the root of the app
# update package.json and install npm dependencies
2015-02-11 18:15:32 +03:00
node_modules : package .json
2015-09-11 02:03:41 +03:00
$( NPM_BIN) install
2015-02-11 18:15:32 +03:00
touch $@
2015-08-11 23:54:52 +03:00
2015-12-05 00:05:21 +03:00
# helper tasks to run broccoli build process at awx/ui/<destination_dir>,
# to build the ui, use the build-ui target instead:
# UI_FLAGS=<flags as seen in Brocfile.js and
# packaging/node/tower-app.js>: additional parameters to pass broccoli
# for building
awx/ui/static : node_modules clean -ui clean -static Brocfile .js bower .json
$( BROCCOLI_BIN) build awx/ui/static -- $( UI_FLAGS)
awx/ui/build_test : node_modules clean -ui clean -build -test Brocfile .js bower .json
$( BROCCOLI_BIN) build awx/ui/build_test -- $( UI_FLAGS)
# build the ui to awx/ui/static:
# defaults to standard dev build (concatenated, non-minified, sourcemaps, no
# tests)
# PROD=true: standard prod build (concatenated, minified, no sourcemaps,
# compressed, no tests)
# EXTRA_UI_FLAGS=<flags as seen in Brocfile.js and
# packaging/node/tower-app.js>: additional parameters to pass broccoli
# for building
PROD ?= false
# TODO: Remove after 2.4 (alias for devjs/minjs)
devjs : build -ui
minjs : build -ui
i f e q ( $( MAKECMDGOALS ) , m i n j s )
PROD = true
e n d i f
2014-02-17 19:18:33 +04:00
2015-12-05 00:05:21 +03:00
i f e q ( $( PROD ) , t r u e )
UI_FLAGS = --silent --compress --no-docs --no-debug --no-sourcemaps \
$( EXTRA_UI_FLAGS)
e l s e
UI_FLAGS = $( EXTRA_UI_FLAGS)
e n d i f
2015-07-28 22:55:00 +03:00
2015-12-05 00:05:21 +03:00
build-ui : awx /ui /static
# launch watcher to continuously build the ui to awx/ui/static and run tests
# after changes are made:
# WATCHER_FLAGS: options to be utilized by broccoli timepiece
# UI_FLAGS=<flags as seen in Brocfile.js and
# packaging/node/tower-app.js>: additional parameters to pass broccoli
# for building
# DOCKER_MACHINE_NAME=<name of docker-machine tower is running on>: when
# passed, not only will brocolli rebuild, but browser-sync will proxy
# proxy tower and refresh the ui when a change is made.
DOCKER_MACHINE_NAME ?= none
i f e q ( $( DOCKER_MACHINE_NAME ) , n o n e )
sync-ui: node_modules brocolli-watcher
e l s e
sync-ui: node_modules
tmux new-session -d -s ui_sync 'exec make brocolli-watcher'
tmux rename-window 'UI Sync'
tmux select -window -t ui_sync:0
tmux split-window -v 'exec make browser-sync'
tmux split-window -h 'exec make websocket-proxy'
tmux select -layout main-vertical
tmux attach-session -t ui_sync
e n d i f
websocket-proxy :
docker-machine ssh $( DOCKER_MACHINE_NAME) -L 8080:localhost:8080
browser-sync :
$( BROWSER_SYNC_BIN) start --proxy $( shell docker-machine ip $( DOCKER_MACHINE_NAME) ) :8013 --ws
browser-sync-reload :
$( BROWSER_SYNC_BIN) reload
2015-07-28 22:55:00 +03:00
2015-12-05 00:05:21 +03:00
brocolli-watcher : Brocfile .js testem .yml
$( NODE) tools/ui/timepiece.js awx/ui/static $( WATCHER_FLAGS) -- $( UI_FLAGS)
2015-07-23 00:15:55 +03:00
2015-12-05 00:05:21 +03:00
# run ui unit-tests:
# defaults to a useful dev testing run. Builds the ui to awx/ui/build_test
# and runs mocha (node.js) tests with istanbul coverage (and an html
# coverage report)
2015-12-09 02:35:00 +03:00
# UI_TESTS_TO_RUN=<file>-test.js: Set this to only run a specific test file
2015-12-05 00:05:21 +03:00
# CI=true: Builds the ui to awx/ui/build_test
# and runs mocha (node.js) tests with istanbul coverage (and a cobertura
# coverage report). Also builds the ui to awx/ui/static and runs the
# testem (phantomjs) tests. Outputs these to XUNIT format to be consumed
# and displayed in jenkins
# DEBUG=true: Builds the ui to awx/ui/static and runs testem tests in Chrome
# so you can breakpoint the tests and underlying code to figure out why
# tests are failing.
# TESTEM_DEBUG_BROWSER: the browser to run tests in, default to Chrome
# TODO: deprecated past 2.4
testjs_ci : test -ui # w var UI_TEST_MODE=CI
UI_TEST_MODE ?= DEV
i f e q ( $( UI_TEST_MODE ) , C I )
# ci testing run
# this used to be testjs_ci, sort-of
REPORTER = xunit
test-ui: .istanbul.yml build-ui-for-coverage test-ui-for-coverage
e l s e
i f e q ( $( UI_TEST_MODE ) , D E V _ D E B U G )
# debug (breakpoint) dev testing run
test-ui: build-ui-for-browser-tests test-ui-debug
e l s e
# default dev testing run
test-ui: .istanbul.yml build-ui-for-coverage test-ui-for-coverage
e n d i f
e n d i f
2015-08-27 19:29:44 +03:00
2015-12-05 00:05:21 +03:00
# helper tasks to test ui, don't call directly
build-ui-for-coverage : UI_FLAGS =--node -tests --no -concat --no -styles
build-ui-for-coverage : awx /ui /build_test
2015-07-28 22:55:00 +03:00
2015-12-05 00:05:21 +03:00
REPORTER ?= standard
2015-12-09 02:35:00 +03:00
UI_TESTS_TO_RUN ?= all
2015-12-05 00:05:21 +03:00
i f e q ( $( REPORTER ) , x u n i t )
test-ui-for-coverage:
2015-12-09 18:19:34 +03:00
XUNIT_FILE = reports/test-results-ui.xml NODE_PATH = awx/ui/build_test $( ISTANBUL_BIN) cover --include-all-sources $( MOCHA_BIN) -- --full-trace --reporter xunit-file $( shell find awx/ui/build_test -name '*-test.js' ) ; cp coverage/ui-coverage-report.xml reports/coverage-report-ui.xml
2015-12-05 00:05:21 +03:00
e l s e
2015-12-09 02:35:00 +03:00
i f e q ( $( UI_TESTS_TO_RUN ) , a l l )
2015-12-05 00:05:21 +03:00
test-ui-for-coverage:
2015-12-09 02:35:00 +03:00
NODE_PATH = awx/ui/build_test $( ISTANBUL_BIN) cover --include-all-sources $( MOCHA_BIN) -- --full-trace $( shell find awx/ui/build_test -name '*-test.js' )
e l s e
test-ui-for-coverage :
NODE_PATH = awx/ui/build_test $( ISTANBUL_BIN) cover $( MOCHA_BIN) -- --full-trace $( shell find awx/ui/build_test -name '$(UI_TESTS_TO_RUN)' )
e n d i f
2015-12-05 00:05:21 +03:00
e n d i f
2015-07-20 18:56:02 +03:00
2015-12-09 00:55:43 +03:00
build-ui-for-browser-tests : UI_FLAGS =--no -styles --no -compress --browser -tests --no -node -tests
2015-12-05 00:05:21 +03:00
build-ui-for-browser-tests : awx /ui /static
2015-02-09 17:45:23 +03:00
2015-12-05 00:05:21 +03:00
TESTEM_DEBUG_BROWSER ?= Chrome
test-ui-debug :
2015-08-27 19:29:44 +03:00
PATH = ./node_modules/.bin:$( PATH) $( TESTEM) --file testem.yml -l $( TESTEM_DEBUG_BROWSER)
2015-12-05 00:05:21 +03:00
# lint .js files
2015-02-11 18:15:32 +03:00
jshint : node_modules Gruntfile .js
2014-08-28 20:01:35 +04:00
$( GRUNT) $@
2015-12-05 00:05:21 +03:00
# generate ui docs
ngdocs : build -ui Gruntfile .js
2014-08-28 20:01:35 +04:00
$( GRUNT) $@
2013-09-25 05:40:53 +04:00
2015-07-28 22:55:00 +03:00
# END UI TASKS
# --------------------------------------
2013-06-20 23:53:10 +04:00
# Build a pip-installable package into dist/ with a timestamped version number.
2014-02-17 19:18:33 +04:00
dev_build :
2013-09-25 05:40:53 +04:00
$( PYTHON) setup.py dev_build
2013-05-22 01:39:34 +04:00
2013-06-20 23:53:10 +04:00
# Build a pip-installable package into dist/ with the release version number.
2013-05-22 01:39:34 +04:00
release_build :
2013-09-25 05:40:53 +04:00
$( PYTHON) setup.py release_build
2014-10-28 22:20:33 +03:00
# Build setup tarball
tar-build/$(SETUP_TAR_FILE) :
@mkdir -p tar-build
@cp -a setup tar-build/$( SETUP_TAR_NAME)
2015-09-18 22:38:49 +03:00
@rsync -az docs/licenses tar-build/$( SETUP_TAR_NAME) /
2014-10-28 22:20:33 +03:00
@cd tar-build/$( SETUP_TAR_NAME) && sed -e 's#%NAME%#$(NAME)#;s#%VERSION%#$(VERSION)#;s#%RELEASE%#$(RELEASE)#;' group_vars/all.in > group_vars/all
@cd tar-build && tar -czf $( SETUP_TAR_FILE) --exclude "*/all.in" $( SETUP_TAR_NAME) /
2014-11-18 17:31:43 +03:00
@ln -sf $( SETUP_TAR_FILE) tar-build/$( SETUP_TAR_LINK)
2015-08-31 19:01:15 +03:00
2015-09-04 04:33:55 +03:00
tar-build/$(SETUP_TAR_CHECKSUM) :
@if [ " $( OFFICIAL) " != "yes" ] ; then \
2015-09-05 15:39:32 +03:00
cd tar-build && $( SHASUM_BIN) $( NAME) *.tar.gz > $( notdir $@ ) ; \
2015-09-04 04:33:55 +03:00
else \
2015-09-10 23:26:59 +03:00
cd tar-build && $( SHASUM_BIN) $( NAME) *.tar.gz | $( GPG_BIN) --clearsign --batch --passphrase " $( GPG_PASSPHRASE) " -u " $( GPG_KEY) " -o $( notdir $@ ) - ; \
2015-09-04 04:33:55 +03:00
fi
setup_tarball : tar -build /$( SETUP_TAR_FILE ) tar -build /$( SETUP_TAR_CHECKSUM )
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-09-13 22:40:32 +03:00
@echo "Artifacts:"
2014-10-28 22:20:33 +03:00
@echo tar-build/$( SETUP_TAR_FILE)
2014-11-18 17:31:43 +03:00
@echo tar-build/$( SETUP_TAR_LINK)
2015-09-04 04:33:55 +03:00
@echo tar-build/$( SETUP_TAR_CHECKSUM)
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2013-06-11 01:21:04 +04:00
release_clean :
2013-05-26 19:01:00 +04:00
-( rm *.tar)
2013-06-11 01:21:04 +04:00
-( rm -rf ( $RELEASE ) )
2013-06-15 12:10:11 +04:00
2015-09-23 23:10:40 +03:00
dist/$(SDIST_TAR_FILE) : minjs
2014-10-19 23:05:54 +04:00
BUILD = " $( BUILD) " $( PYTHON) setup.py sdist
2014-05-22 19:25:50 +04:00
2015-09-23 23:10:40 +03:00
sdist : dist /$( SDIST_TAR_FILE )
@echo "#############################################"
@echo "Artifacts:"
@echo dist/$( SDIST_TAR_FILE)
@echo "#############################################"
2013-06-15 12:10:11 +04:00
2015-09-04 04:33:55 +03:00
# Build setup bundle tarball
setup-bundle-build :
2015-08-31 19:01:15 +03:00
mkdir -p $@
# TODO - Somehow share implementation with setup_tarball
2015-09-04 04:33:55 +03:00
setup-bundle-build/$(OFFLINE_TAR_FILE) :
cp -a setup setup-bundle-build/$( OFFLINE_TAR_NAME)
2015-09-18 22:38:49 +03:00
rsync -az docs/licenses setup-bundle-build/$( OFFLINE_TAR_NAME) /
2015-09-04 04:33:55 +03:00
cd setup-bundle-build/$( OFFLINE_TAR_NAME) && sed -e 's#%NAME%#$(NAME)#;s#%VERSION%#$(VERSION)#;s#%RELEASE%#$(RELEASE)#;' group_vars/all.in > group_vars/all
$( PYTHON) $( DEPS_SCRIPT) -d $( DIST) -r $( DIST_MAJOR) -u $( AW_REPO_URL) -s setup-bundle-build/$( OFFLINE_TAR_NAME) -v -v -v
cd setup-bundle-build && tar -czf $( OFFLINE_TAR_FILE) --exclude "*/all.in" $( OFFLINE_TAR_NAME) /
ln -sf $( OFFLINE_TAR_FILE) setup-bundle-build/$( OFFLINE_TAR_LINK)
setup-bundle-build/$(OFFLINE_TAR_CHECKSUM) :
2015-09-05 04:08:49 +03:00
@if [ " $( OFFICIAL) " != "yes" ] ; then \
2015-09-10 20:40:24 +03:00
cd setup-bundle-build && $( SHASUM_BIN) $( NAME) *.tar.gz > $( notdir $@ ) ; \
2015-09-05 04:08:49 +03:00
else \
2015-09-10 23:26:59 +03:00
cd setup-bundle-build && $( SHASUM_BIN) $( NAME) *.tar.gz | $( GPG_BIN) --clearsign --batch --passphrase " $( GPG_PASSPHRASE) " -u " $( GPG_KEY) " -o $( notdir $@ ) - ; \
2015-09-05 04:08:49 +03:00
fi
2015-09-04 04:33:55 +03:00
setup_bundle_tarball : setup -bundle -build setup -bundle -build /$( OFFLINE_TAR_FILE ) setup -bundle -build /$( OFFLINE_TAR_CHECKSUM )
2015-08-31 19:01:15 +03:00
@echo "#############################################"
@echo "Offline artifacts:"
2015-09-04 04:33:55 +03:00
@echo setup-bundle-build/$( OFFLINE_TAR_FILE)
@echo setup-bundle-build/$( OFFLINE_TAR_LINK)
@echo setup-bundle-build/$( OFFLINE_TAR_CHECKSUM)
2015-08-31 19:01:15 +03:00
@echo "#############################################"
2015-08-11 23:04:36 +03:00
2015-05-26 18:03:36 +03:00
rpm-build :
2015-08-31 19:01:15 +03:00
mkdir -p $@
2015-05-26 18:03:36 +03:00
rpm-build/$(SDIST_TAR_FILE) : rpm -build dist /$( SDIST_TAR_FILE )
2014-10-17 17:01:45 +04:00
cp packaging/rpm/$( NAME) .spec rpm-build/
2014-04-23 21:52:08 +04:00
cp packaging/rpm/$( NAME) .te rpm-build/
2014-11-25 17:22:02 +03:00
cp packaging/rpm/$( NAME) .sysconfig rpm-build/
2014-10-20 23:00:00 +04:00
cp packaging/remove_tower_source.py rpm-build/
2013-06-26 16:10:17 +04:00
if [ " $( OFFICIAL) " != "yes" ] ; then \
2014-10-17 17:01:45 +04:00
( cd dist/ && tar zxf $( SDIST_TAR_FILE) ) ; \
( cd dist/ && mv $( NAME) -$( VERSION) -$( BUILD) $( NAME) -$( VERSION) ) ; \
( cd dist/ && tar czf ../rpm-build/$( SDIST_TAR_FILE) $( NAME) -$( VERSION) ) ; \
ln -sf $( SDIST_TAR_FILE) rpm-build/$( NAME) -$( VERSION) .tar.gz ; \
else \
2014-11-15 00:11:39 +03:00
cp -a dist/$( SDIST_TAR_FILE) rpm-build/ ; \
2013-06-26 16:10:17 +04:00
fi
2014-10-17 17:01:45 +04:00
2014-10-23 00:41:24 +04:00
rpmtar : sdist rpm -build /$( SDIST_TAR_FILE )
2014-10-17 17:01:45 +04:00
rpm-build/$(RPM_NVR).src.rpm : /etc /mock /$( MOCK_CFG ) .cfg
$( MOCK_BIN) -r $( MOCK_CFG) --resultdir rpm-build --buildsrpm --spec rpm-build/$( NAME) .spec --sources rpm-build \
2016-03-11 00:44:31 +03:00
--define " tower_version $( VERSION) " --define " tower_release $( RELEASE) " $( SCL_DEFINES)
2015-09-13 22:40:32 +03:00
mock-srpm : rpmtar rpm -build /$( RPM_NVR ) .src .rpm
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-09-13 22:40:32 +03:00
@echo "Artifacts:"
2014-10-17 17:01:45 +04:00
@echo rpm-build/$( RPM_NVR) .src.rpm
@echo "#############################################"
2015-08-26 18:49:09 +03:00
rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm : rpm -build /$( RPM_NVR ) .src .rpm
2014-10-17 17:01:45 +04:00
$( MOCK_BIN) -r $( MOCK_CFG) --resultdir rpm-build --rebuild rpm-build/$( RPM_NVR) .src.rpm \
2016-03-11 00:44:31 +03:00
--define " tower_version $( VERSION) " --define " tower_release $( RELEASE) " $( SCL_DEFINES)
2015-09-13 22:40:32 +03:00
mock-rpm : rpmtar rpm -build /$( RPM_NVR ) .$( RPM_ARCH ) .rpm
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-09-13 22:40:32 +03:00
@echo "Artifacts:"
2015-08-26 18:49:09 +03:00
@echo rpm-build/$( RPM_NVR) .$( RPM_ARCH) .rpm
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-06-01 22:58:07 +03:00
i f e q ( $( OFFICIAL ) , y e s )
2015-06-08 18:38:50 +03:00
rpm-build/$(GPG_FILE) : rpm -build
2015-09-10 23:26:59 +03:00
$( GPG_BIN) --export -a " ${ GPG_KEY } " > " $@ "
2015-05-26 18:03:36 +03:00
2015-08-26 18:49:09 +03:00
rpm-sign : rpm -build /$( GPG_FILE ) rpmtar rpm -build /$( RPM_NVR ) .$( RPM_ARCH ) .rpm
rpm --define "_signature gpg" --define " _gpg_name $( GPG_KEY) " --addsign rpm-build/$( RPM_NVR) .$( RPM_ARCH) .rpm
2015-06-01 22:58:07 +03:00
e n d i f
2015-05-26 18:03:36 +03:00
2015-09-09 05:44:29 +03:00
deb-build :
mkdir -p $@
2015-09-13 22:40:32 +03:00
deb-build/$(DEB_TAR_NAME) : dist /$( SDIST_TAR_FILE )
mkdir -p $( dir $@ )
2015-09-23 23:10:40 +03:00
@if [ " $( OFFICIAL) " != "yes" ] ; then \
tar -C deb-build/ -xvf dist/$( SDIST_TAR_FILE) ; \
mv deb-build/$( SDIST_TAR_NAME) deb-build/$( DEB_TAR_NAME) ; \
cd deb-build && tar czf $( DEB_TAR_FILE) $( DEB_TAR_NAME) ; \
else \
cp -a dist/$( SDIST_TAR_FILE) deb-build/$( DEB_TAR_FILE) ; \
fi
cd deb-build && tar -xf $( DEB_TAR_FILE)
2015-09-13 22:40:32 +03:00
cp -a packaging/debian deb-build/$( DEB_TAR_NAME) /
cp packaging/remove_tower_source.py deb-build/$( DEB_TAR_NAME) /debian/
sed -ie " s#^ $( NAME) (\([^)]*\)) \([^;]*\);# $( NAME) ( $( VERSION) - $( RELEASE) ~ $( DEB_DIST) ) $( DEB_DIST) ;# " deb-build/$( DEB_TAR_NAME) /debian/changelog
2014-10-17 17:01:45 +04:00
2015-09-09 05:44:29 +03:00
i f e q ( $( OFFICIAL ) , y e s )
2015-09-13 22:40:32 +03:00
debian : deb -build /$( DEB_TAR_NAME ) deb -build /$( GPG_FILE )
2015-09-09 05:44:29 +03:00
2015-09-10 23:26:59 +03:00
deb-build/$(GPG_FILE) : deb -build
$( GPG_BIN) --export -a " ${ GPG_KEY } " > " $@ "
2015-09-09 05:44:29 +03:00
e l s e
2015-09-13 22:40:32 +03:00
debian : deb -build /$( DEB_TAR_NAME )
2015-09-09 05:44:29 +03:00
e n d i f
2014-10-17 17:01:45 +04:00
2015-09-13 22:40:32 +03:00
deb-build/$(DEB_NVR).dsc : deb -build /$( DEB_TAR_NAME )
cd deb-build/$( DEB_TAR_NAME) && $( DEBUILD) -S
deb-src : deb -build /$( DEB_NVR ) .dsc
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-09-13 22:40:32 +03:00
@echo "Artifacts:"
@echo deb-build/$( DEB_NVR) .dsc
@echo deb-build/$( DEB_NVRS) .changes
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-09-13 22:40:32 +03:00
$(PBUILDER_CACHE_DIR)/$(DEB_DIST)-$(DEB_ARCH)-base.tgz :
$( PBUILDER_BIN) create $( PBUILDER_OPTS)
2014-10-17 17:01:45 +04:00
2015-09-13 22:40:32 +03:00
pbuilder : $( PBUILDER_CACHE_DIR ) /$( DEB_DIST ) -$( DEB_ARCH ) -base .tgz deb -build /$( DEB_NVRA ) .deb
deb-build/$(DEB_NVRA).deb : deb -build /$( DEB_NVR ) .dsc $( PBUILDER_CACHE_DIR ) /$( DEB_DIST ) -$( DEB_ARCH ) -base .tgz
# cd deb-build/$(DEB_TAR_NAME) && $(DEBUILD) -b
$( PBUILDER_BIN) update $( PBUILDER_OPTS)
$( PBUILDER_BIN) execute $( PBUILDER_OPTS) --save-after-exec packaging/pbuilder/setup.sh $( DEB_DIST)
$( PBUILDER_BIN) build $( PBUILDER_OPTS) deb-build/$( DEB_NVR) .dsc
2014-10-17 17:01:45 +04:00
2015-09-24 23:30:27 +03:00
deb : guard -DEB_DIST deb -build /$( DEB_NVRA ) .deb
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-09-13 22:40:32 +03:00
@echo "Artifacts:"
@echo deb-build/$( DEB_NVRA) .deb
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-09-13 22:40:32 +03:00
deb-upload : deb -build /$( DEB_NVRA ) .changes
$( DPUT_BIN) $( DPUT_OPTS) $( DEB_PPA) deb-build/$( DEB_NVRA) .changes
2014-10-17 17:01:45 +04:00
2015-09-13 22:40:32 +03:00
dput : deb -build /$( DEB_NVRA ) .changes
$( DPUT_BIN) $( DPUT_OPTS) $( DEB_PPA) deb-build/$( DEB_NVRA) .changes
2014-10-17 17:01:45 +04:00
2015-09-13 22:40:32 +03:00
deb-src-upload : deb -build /$( DEB_NVRS ) .changes
$( DPUT_BIN) $( DPUT_OPTS) $( DEB_PPA) deb-build/$( DEB_NVRS) .changes
2014-10-17 17:01:45 +04:00
2015-09-13 22:40:32 +03:00
debsign : deb -build /$( DEB_NVRS ) .changes debian deb -build /$( DEB_NVR ) .dsc
debsign -k$( GPG_KEY) deb-build/$( DEB_NVRS) .changes deb-build/$( DEB_NVR) .dsc
2014-10-17 17:01:45 +04:00
2015-09-13 22:40:32 +03:00
reprepro/conf :
mkdir -p $@
cp -a packaging/reprepro/* $@ /
2015-09-09 06:14:31 +03:00
if [ " $( OFFICIAL) " = "yes" ] ; then \
2015-09-24 03:33:40 +03:00
sed -i -e 's|^\(Codename:\)|SignWith: $(GPG_KEY)\n\1|' $@ /distributions ; \
2015-09-09 17:57:55 +03:00
fi
2015-09-13 22:40:32 +03:00
reprepro : deb -build /$( DEB_NVRA ) .deb reprepro /conf
2015-09-24 23:30:27 +03:00
$( REPREPRO_BIN) $( REPREPRO_OPTS) clearvanished
for COMPONENT in non-free $( VERSION) ; do \
$( REPREPRO_BIN) $( REPREPRO_OPTS) -C $$ COMPONENT remove $( DEB_DIST) $( NAME) ; \
2015-11-25 17:47:29 +03:00
$( REPREPRO_BIN) $( REPREPRO_OPTS) -C $$ COMPONENT --keepunreferencedfiles --ignore= brokenold includedeb $( DEB_DIST) deb-build/$( DEB_NVRA) .deb ; \
2015-09-13 22:40:32 +03:00
done
2013-06-23 23:40:07 +04:00
2015-10-01 19:06:01 +03:00
2015-09-09 05:44:29 +03:00
#
# Packer build targets
#
2015-04-24 17:44:22 +03:00
amazon-ebs :
cd packaging/packer && $( PACKER) build -only $@ $( PACKER_BUILD_OPTS) -var " aws_instance_count= $( AWS_INSTANCE_COUNT) " -var " product_version= $( VERSION) " packer-$( NAME) .json
2015-08-14 03:20:33 +03:00
# virtualbox
2015-04-24 17:44:22 +03:00
virtualbox-ovf : packaging /packer /ansible -tower -$( VERSION ) -virtualbox .box
packaging/packer/ansible-tower-$(VERSION)-virtualbox.box : packaging /packer /output -virtualbox -iso /centos -7.ovf
cd packaging/packer && $( PACKER) build -only virtualbox-ovf $( PACKER_BUILD_OPTS) -var " aws_instance_count= $( AWS_INSTANCE_COUNT) " -var " product_version= $( VERSION) " packer-$( NAME) .json
packaging/packer/output-virtualbox-iso/centos-6.ovf :
cd packaging/packer && $( PACKER) build packer-centos-6.json
packaging/packer/output-virtualbox-iso/centos-7.ovf :
2015-08-14 03:20:33 +03:00
cd packaging/packer && $( PACKER) build -only virtualbox-iso packer-centos-7.json
# virtualbox-iso: packaging/packer/output-virtualbox-iso/centos-6.ovf
virtualbox-iso : packaging /packer /output -virtualbox -iso /centos -7.ovf
# vmware
packaging/packer/output-vmware-iso/centos-7.vmx :
cd packaging/packer && $( PACKER) build -only vmware-iso packer-centos-7.json
vmware-iso : packaging /packer /output -vmware -iso /centos -7.vmx
vmware-vmx : packaging /packer /ansible -tower -$( VERSION ) -vmx /ansible -tower -$( VERSION ) .vmx
2015-04-24 17:44:22 +03:00
2015-08-14 03:20:33 +03:00
packaging/packer/ansible-tower-$(VERSION)-vmx/ansible-tower-$(VERSION).vmx : packaging /packer /output -vmware -iso /centos -7.vmx
cd packaging/packer && $( PACKER) build -only vmware-vmx $( PACKER_BUILD_OPTS) -var " aws_instance_count= $( AWS_INSTANCE_COUNT) " -var " product_version= $( VERSION) " packer-$( NAME) .json
2014-01-07 21:04:25 +04:00
2015-08-26 23:15:07 +03:00
# TODO - figure out how to build the front-end and python requirements with
# 'build'
build :
2016-03-11 00:44:31 +03:00
export SCL_PREFIX
2015-08-26 23:15:07 +03:00
$( PYTHON) setup.py build
2013-06-23 23:40:07 +04:00
install :
2016-03-23 22:46:00 +03:00
export SCL_PREFIX HTTPD_SCL_PREFIX
2015-08-26 23:15:07 +03:00
$( PYTHON) setup.py install $( SETUP_INSTALL_ARGS)
2015-09-10 00:16:35 +03:00
# Docker Compose Development environment
docker-compose :
docker-compose -f tools/docker-compose.yml up --no-recreate
2015-09-29 17:45:25 +03:00
docker-compose-test :
2015-10-09 19:03:25 +03:00
cd tools && docker-compose run --rm --service-ports tower /bin/bash
2015-09-29 17:45:25 +03:00
2016-02-01 19:30:43 +03:00
MACHINE ?= default
2016-03-16 20:06:54 +03:00
docker-clean :
2016-02-01 19:30:43 +03:00
rm -f awx/lib/.deps_built
eval $$ ( docker-machine env $( MACHINE) )
docker stop $$ ( docker ps -a -q)
2016-03-16 20:06:54 +03:00
-docker rm $$ ( docker ps -f name = tools_tower -a -q)
-docker rmi tools_tower
docker-refresh : docker -clean docker -compose
2016-02-01 19:30:43 +03:00
2015-10-09 19:03:25 +03:00
mongo-debug-ui :
docker run -it --rm --name mongo-express --link tools_mongo_1:mongo -e ME_CONFIG_OPTIONS_EDITORTHEME = ambiance -e ME_CONFIG_BASICAUTH_USERNAME = admin -e ME_CONFIG_BASICAUTH_PASSWORD = password -p 8081:8081 knickers/mongo-express
2015-10-09 19:16:49 +03:00
mongo-container :
docker run -it --link tools_mongo_1:mongo --rm mongo sh -c 'exec mongo "$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/system_tracking_dev"'
2015-10-09 19:03:25 +03:00
psql-container :
docker run -it --link tools_postgres_1:postgres --rm postgres:9.4.1 sh -c 'exec psql -h "$$POSTGRES_PORT_5432_TCP_ADDR" -p "$$POSTGRES_PORT_5432_TCP_PORT" -U postgres'