Commit 9e4c6bf1 authored by 20th (Victor Nikulshin)'s avatar 20th (Victor Nikulshin) Committed by Victor Nikulshin
Browse files

Avoid `fab_run()` for Jenkins deployment

The `provision` task specifically targets Jenkins platform that can only exist
in local environment. Direct usage of `local()` operation prevents accidental
manipulation of build artifacts in other environments.
parent ca0a0c05
......@@ -175,27 +175,26 @@ def deploy(environment):
def provision(environment, role='local'):
def provision(environment):
Provision a Jenkins deployment.
This task loads the target environment and extract the archive to deploy.
:param environment The environment to deploy the site DEV, STAGE, PROD
:param role Tha fabric role to run the task.
artefact = _get_archive_from_dir(env.builddir)
with h.fab_cd(role, '{}/src'.format(env.workspace)):
with lcd('{}/src'.format(env.workspace)):
# Clear the currently installed platform
if h.fab_exists(role, env.site_root):
h.fab_run(role, 'rm -rf {}'.format(env.site_root))
if os.path.exists(env.site_root):
local('rm -rf {}'.format(env.site_root))
# Extract the platform to deploy
h.fab_run(role, 'tar -xzf {}/{}'.format(env.builddir, artefact))
local('tar -xzf {}/{}'.format(env.builddir, artefact))
# Fast-check if the archive looks like a Drupal installation
if not h.fab_exists(role, '{}/src/drupal'.format(env.workspace)):
if not os.path.exists('{}/src/drupal'.format(env.workspace)):
abort('The archive to deploy does not contain a drupal directory.')
if not os.path.isfile('{}/src/drupal/cron.php'.format(env.workspace)):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment