From c4a1dfc4e853421ec53136f70e82d3e16e5636a2 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Thu, 17 Aug 2017 13:53:04 -0400 Subject: [PATCH 1/2] only run shippable UI for devel and release branches --- shippable.yml | 11 ++++++++--- tools/docker-compose/unit-tests/Dockerfile | 3 +-- .../unit-tests/docker-compose-shippable.yml | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 tools/docker-compose/unit-tests/docker-compose-shippable.yml diff --git a/shippable.yml b/shippable.yml index a4ed31f424..f7644d063a 100644 --- a/shippable.yml +++ b/shippable.yml @@ -8,14 +8,19 @@ env: - AWX_BUILD_TARGET=ui-test-ci - AWX_BUILD_TARGET="flake8 jshint" +branches: + only: + - devel + - release_* + build: pre_ci: - docker build -t ansible/awx_devel -f tools/docker-compose/Dockerfile . - - docker tag ansible/awx_devel gcr.io/ansible-tower-engineering/awx_devel:${BASE_BRANCH:-latest} + - docker tag ansible/awx_devel gcr.io/ansible-tower-engineering/awx_devel:latest pre_ci_boot: options: "-v /awx_devel:/awx_devel" ci: - cp -R . /awx_devel - pip install -U docker-compose - - docker-compose -f tools/docker-compose/unit-tests/docker-compose.yml build --build-arg TAG=${BASE_BRANCH:-latest} unit-tests - - docker-compose -f tools/docker-compose/unit-tests/docker-compose.yml run -v /awx_devel:/awx_devel unit-tests "make ${AWX_BUILD_TARGET}" + - docker-compose -f tools/docker-compose/unit-tests/docker-compose-shippable.yml build --build-arg TAG=latest unit-tests + - docker-compose -f tools/docker-compose/unit-tests/docker-compose-shippable.yml run unit-tests "make ${AWX_BUILD_TARGET}" diff --git a/tools/docker-compose/unit-tests/Dockerfile b/tools/docker-compose/unit-tests/Dockerfile index 15d8d25c22..9398c89398 100644 --- a/tools/docker-compose/unit-tests/Dockerfile +++ b/tools/docker-compose/unit-tests/Dockerfile @@ -1,5 +1,4 @@ -ARG TAG=latest -FROM gcr.io/ansible-tower-engineering/awx_devel:$TAG +FROM gcr.io/ansible-tower-engineering/awx_devel:latest # For UI tests RUN yum install -y bzip2 gcc-c++ diff --git a/tools/docker-compose/unit-tests/docker-compose-shippable.yml b/tools/docker-compose/unit-tests/docker-compose-shippable.yml new file mode 100644 index 0000000000..b314d6acdd --- /dev/null +++ b/tools/docker-compose/unit-tests/docker-compose-shippable.yml @@ -0,0 +1,14 @@ +--- +version: '3' +services: + unit-tests: + build: + context: ../../../ + dockerfile: tools/docker-compose/unit-tests/Dockerfile + image: gcr.io/ansible-tower-engineering/unit-test-runner:${GIT_BRANCH:-latest} + environment: + SWIG_FEATURES: "-cpperraswarn -includeall -I/usr/include/openssl" + TEST_DIRS: awx/main/tests/functional awx/main/tests/unit awx/conf/tests awx/sso/tests + command: ["make test"] + volumes: + - /awx_devel:/awx_devel From 1f2a7801fdac113e635a1dbcac87b913917d213f Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Thu, 17 Aug 2017 10:14:36 -0400 Subject: [PATCH 2/2] fix flake8 and data gen functionality --- .../rbac_dummy_data_generator.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/data_generators/rbac_dummy_data_generator.py b/tools/data_generators/rbac_dummy_data_generator.py index 3855bd728e..f1aab7d049 100755 --- a/tools/data_generators/rbac_dummy_data_generator.py +++ b/tools/data_generators/rbac_dummy_data_generator.py @@ -249,7 +249,6 @@ def make_the_data(): org.member_role.members.add(jt_admin) org.member_role.members.add(inv_admin) - organization_gen = yield_choice(organizations) print('') print('# Creating %d users' % n_users) @@ -542,7 +541,6 @@ def make_the_data(): wfjt_nodes = [] for i in range(n): ids['nodes'] += 1 - node_id = ids['nodes'] sys.stdout.write('\r Assigning %d to %s: %d ' % (n, wfjt.name, i+ 1)) sys.stdout.flush() kwargs = dict( @@ -710,17 +708,18 @@ def make_the_data(): if n: print('') - if options['pretend']: - with transaction.atomic(): - try: - make_the_data() - raise Rollback() - except Rollback: - print('Rolled back changes') - pass - else: - make_the_data() +if options['pretend']: + with transaction.atomic(): + try: + make_the_data() + raise Rollback() + except Rollback: + print('Rolled back changes') + pass + +else: + make_the_data() print('')