Skip to content

Commit

Permalink
Don't build test project during CI reprovisioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtnpro committed Jan 5, 2017
1 parent f9b6dd1 commit 9156d4b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
8 changes: 5 additions & 3 deletions ci/lib.py
Expand Up @@ -62,7 +62,7 @@ def __init__(self):
self._provisioned = True if os.environ.get(
'CCCP_CI_PROVISIONED', None) == 'true' else False

def run(self, controller, force=False):
def run(self, controller, force=False, extra_args=""):
if not force and self._provisioned:
return

Expand All @@ -83,9 +83,11 @@ def run(self, controller, force=False):
cmd = (
"cd {workdir} && "
"ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i {inventory} "
"-u {user} -s {private_key_args} provisions/vagrant.yml"
"-u {user} -s {private_key_args} {extra_args} "
"provisions/vagrant.yml"
).format(workdir=workdir, inventory=inventory, user=user,
private_key_args=private_key_args)
private_key_args=private_key_args,
extra_args=extra_args)
_print('Provisioning command: %s' % cmd)
run_cmd(cmd, host=host, stream=True)
self._provisioned = True
Expand Down
5 changes: 3 additions & 2 deletions ci/tests/base.py
Expand Up @@ -35,7 +35,7 @@ def setUp(self):
}
}

def provision(self, force=False):
def provision(self, force=False, extra_args=""):
"""
Provision CCCP nodes.
Expand All @@ -44,8 +44,9 @@ def provision(self, force=False):
Args:
force (bool): Provision forcefully.
extra_args (str): Extra cmd line args for running ansible playbook
"""
provision(self.hosts['controller'], force=force)
provision(self.hosts['controller'], force=force, extra_args=extra_args)

def run_cmd(self, cmd, user=None, host=None, stream=False):
"""
Expand Down
3 changes: 2 additions & 1 deletion ci/tests/test_00_openshift/__init__.py
Expand Up @@ -45,7 +45,8 @@ def test_00_openshift_builds_are_complete(self):
_print("Openshift builds completed successfully.")

def test_01_openshift_builds_persist_after_provision(self):
self.provision(force=True)
self.provision(force=True,
extra_args='--skip-tags=ci-build-test-project')
_print("=" * 30)
_print("Test if openshift builds persist after reprovision")
_print("=" * 30)
Expand Down
1 change: 1 addition & 0 deletions provisions/roles/jenkins/master/tasks/main.yml
Expand Up @@ -44,3 +44,4 @@
when: test
tags:
- test
- ci-build-test-project

0 comments on commit 9156d4b

Please sign in to comment.