Commit 41ccce24 authored by André Anjos's avatar André Anjos 💬
Browse files

[ci] Move clean-betas to CI (pre-nightlies)

parent 774779ec
Pipeline #32621 passed with stage
in 13 minutes and 26 seconds
......@@ -7,7 +7,7 @@
import git
import distutils.version
from .log import get_logger
from .log import get_logger, echo_info
from .build import load_order_file
logger = get_logger(__name__)
......@@ -213,3 +213,46 @@ def select_user_condarc(paths, branch):
return select_build_file("condarc", paths, branch)
def clean_betas(dry_run, username, password):
"""Cleans-up betas (through the CI). Executes if ``dry_run==False`` only.
from .deploy import _setup_webdav_client
from .constants import WEBDAV_PATHS, SERVER
from .dav import remove_old_beta_packages
for public in (True, False):
server_info = WEBDAV_PATHS[False][public]
davclient = _setup_webdav_client(
SERVER, server_info["root"], username, password
# go through all possible variants:
archs = [
for arch in archs:
arch_path = '/'.join((path, arch))
if not (davclient.check(arch_path) and davclient.is_dir(arch_path)):
# it is normal if the directory does not exist
server_path = davclient.get_url(arch_path)
echo_info('Cleaning beta packages from %s' % server_path)
remove_old_beta_packages(client=davclient, path=arch_path,
dry_run=dry_run, pyver=True)
......@@ -10,9 +10,30 @@ variables:
# Definition of our build pipeline order
- cleanup
- build
# Periodic cleanup of beta packages
stage: cleanup
- docker
image: continuumio/conda-concourse-ci
- curl --silent "${BOOTSTRAP}" --output ""
- python3 -vv channel base
- source ${CONDA_ROOT}/etc/profile.d/
- conda activate base
- bdt ci clean-betas -vv --dry-run
cache: &test_caches
key: "linux-cache"
- ${CONDA_ROOT}/pkgs/*.tar.bz2
- ${CONDA_ROOT}/pkgs/urls.txt
# Build targets
stage: build
......@@ -20,6 +20,7 @@ from import (
from ..log import verbosity_option, get_logger, echo_normal
......@@ -946,3 +947,53 @@ def docs(ctx, requirement, dry_run):"Building documentation...")
ctx.invoke(build, dry_run=dry_run)
1. Cleans-up the excess of beta packages from all conda channels via WebDAV:
$ bdt ci -vv clean-betas --dry-run
Notice this does not do anything. Remove the --dry-run flag to execute
2. Really removes (recursively), the excess of beta packages
$ bdt ci -vv clean-betas
help="Only goes through the actions, but does not execute them "
"(combine with the verbosity flags - e.g. ``-vvv``) to enable "
"printing to help you understand what will be done",
def clean_betas(dry_run):
"""Cleans-up the excess of beta packages from a conda channel via WebDAV
ATTENTION: There is no undo! Use --dry-run to test before using.
is_master = os.environ["CI_COMMIT_REF_NAME"] == "master"
if not is_master and dry_run == False:
echo_warning("Forcing dry-run mode - not in master branch")
echo_warning("... considering this is **not** a periodic run!")
dry_run = True
if dry_run:
echo_warning("!!!! DRY RUN MODE !!!!")
echo_warning("Nothing is being executed on server.")
......@@ -286,11 +286,9 @@ Examples:
2. Realy removes (recursively), everything under the 'remote/path/foo/bar'
$ bdt dav -vv rmtree --execute remote/path/foo/bar
2. Really removes (recursively), the excess of beta packages
$ bdt dav -vv clean-betas --execute remote/path/foo/bar
......@@ -93,6 +93,7 @@ test:
- bdt ci clean --help
- bdt ci nightlies --help
- bdt ci docs --help
- bdt ci clean-betas --help
- bdt dav --help
- bdt dav list --help
- bdt dav makedirs --help
......@@ -79,6 +79,7 @@ setup(
'pypi =',
'nightlies =',
'docs =',
'clean-betas =',
'bdt.local.cli': [
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