Skip to content
Snippets Groups Projects
Commit 0d3cb434 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[deploy] Fixes unknown variable "arch" issue

parent d2eb0b09
No related branches found
No related tags found
No related merge requests found
Pipeline #27712 failed
......@@ -26,13 +26,16 @@ def _setup_webdav_client(server, root, username, password):
return retval
def deploy_conda_package(package, stable, public, username, password,
def deploy_conda_package(package, arch, stable, public, username, password,
overwrite, dry_run):
'''Deploys a single conda package on the appropriate path
Args:
package (str): Path leading to the conda package to be deployed
arch (str): The conda architecture to deploy to (``linux-64``, ``osx-64``,
``noarch``, or ``None`` - in which case the architecture is going to be
guessed from the directory where the package sits)
stable (bool): Indicates if the package should be deployed on a stable
(``True``) or beta (``False``) channel
public (bool): Indicates if the package is supposed to be distributed
......@@ -56,6 +59,7 @@ def deploy_conda_package(package, stable, public, username, password,
server_info['root'], server_info['conda'])
basename = os.path.basename(package)
arch = arch or os.path.basename(os.path.dirname(package))
remote_path = '%s/%s/%s' % (server_info['conda'], arch, basename)
if davclient.check(remote_path):
......
......@@ -75,7 +75,7 @@ def base_deploy(dry_run):
logger.debug('Skipping deploying of %s - not a base package', k)
continue
deploy_conda_package(k, stable=True, public=True,
deploy_conda_package(k, arch=arch, stable=True, public=True,
username=os.environ['DOCUSER'], password=os.environ['DOCPASS'],
overwrite=False, dry_run=dry_run)
......@@ -125,7 +125,7 @@ def deploy(dry_run):
name + '*.tar.bz2')
deploy_packages = glob.glob(package_path)
for k in deploy_packages:
deploy_conda_package(k, stable=stable, public=public,
deploy_conda_package(k, arch=arch, stable=stable, public=public,
username=os.environ['DOCUSER'], password=os.environ['DOCPASS'],
overwrite=False, dry_run=dry_run)
......@@ -509,11 +509,23 @@ def nightlies(ctx, order, dry_run):
ci=True,
)
local_docs = os.path.join(os.environ['CI_PROJECT_DIR'], 'sphinx')
is_master = os.environ['CI_COMMIT_REF_NAME'] == 'master'
# re-deploys a new conda package if it was rebuilt and it is the master
# branch
# n.b.: can only arrive here if dry_run was ``False`` (no need to check
# again)
if 'BDT_REBUILD' in os.environ and is_master:
tarball = os.environ['BDT_REBUILD']
del os.environ['BDT_REBUILD']
deploy_conda_package(tarball, arch=None, stable=stable,
public=(not private), username=os.environ['DOCUSER'],
password=os.environ['DOCPASS'], overwrite=False, dry_run=dry_run)
# re-deploys freshly built documentation if we're on the master branch
# otherwise, removes the documentation
local_docs = os.path.join(os.environ['CI_PROJECT_DIR'], 'sphinx')
if is_master:
deploy_documentation(local_docs, package, stable=stable,
public=(not private), branch='master', tag=None,
......@@ -523,15 +535,3 @@ def nightlies(ctx, order, dry_run):
logger.debug('Sphinx output was generated during test/rebuild ' \
'of %s - Erasing...', package)
shutil.rmtree(local_docs)
# re-deploys a new conda package if it was rebuilt and it is the master
# branch
# n.b.: can only arrive here if dry_run was ``False`` (no need to check
# again)
if 'BDT_REBUILD' in os.environ and is_master:
tarball = os.environ['BDT_REBUILD']
del os.environ['BDT_REBUILD']
deploy_conda_package(tarball, stable=stable, public=(not private),
username=os.environ['DOCUSER'], password=os.environ['DOCPASS'],
overwrite=False, dry_run=dry_run)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment