Commit dc9b8540 authored by Duncan Macleod's avatar Duncan Macleod

fixed docs build

use `docker run <img> <env> <cmd> <args>` as suggested by @thomas.downes
parent 26e57d13
Pipeline #47805 failed with stages
in 25 minutes and 53 seconds
......@@ -51,15 +51,10 @@ docs:
before_script:
# install python
- apk add python3
# unpack /cvmfs contents into temporary dir
- CONDA_BASE="${CI_PROJECT_DIR}/condaconda"
- mkdir -pv ${CONDA_BASE}
- docker run ${TAG}
- docker export $(docker ps -lq) | tar -x -C ${CONDA_BASE}
script:
- LSCSOFT_CONDA_DOCKER_IMAGE=${TAG}
- python3 -m pip install -r docs/requirements.txt
script:
- cd docs
- source ${CONDA_BASE}/etc/profile.d/conda.sh
- python3 -m sphinx -M html . ../build/sphinx
artifacts:
paths:
......
......@@ -27,8 +27,7 @@ You can then list the available environments:
which will print something like:
.. this is a hack because the gitlab-ci can't read directly from /cvmfs
.. program-output:: python environments/list.py
.. program-output:: bash environments/list.sh
You can then activate one of these environments:
......
#!/usr/bin/env python
import os
import subprocess
TEMPLATE_DIR = os.path.join(
os.getenv('CI_PROJECT_DIR', ''),
'condaconda',
)
CVMFS_DIR = os.getenv(
"CVMFS_BASE_DIR",
"/cvmfs/ligo-containers.opensciencegrid.org/lscsoft/conda/latest",
)
output = subprocess.check_output(['conda', 'env', 'list']).decode()
print(output.replace(TEMPLATE_DIR, CVMFS_DIR))
#!/bin/bash
CONDA_CMD="conda env list"
if [ -z "${LSCSOFT_CONDA_DOCKER_IMAGE}" ]; then
${CONDA_CMD}
else
docker run ${LSCSOFT_CONDA_DOCKER_IMAGE} ligo-py37 ${CONDA_CMD}
fi
......@@ -18,6 +18,14 @@ ANACONDA_CHANNELS = {
"pkgs/main",
}
DOCKER_IMAGE = os.getenv("LSCSOFT_CONDA_DOCKER_IMAGE", None)
def run_conda_command(cmd):
if DOCKER_IMAGE:
cmd = ["docker", "run", DOCKER_IMAGE, "ligo-py37"] + cmd
return check_output(cmd)
def find_environments(path=None):
"""Finds all of the environments known to conda
......@@ -28,7 +36,7 @@ def find_environments(path=None):
files = path.glob('environment-*.yml')
# get environments
envs = json.loads(check_output([
envs = json.loads(run_conda_command([
'conda',
'env',
'list',
......@@ -73,7 +81,7 @@ def write_environment(env, file=None):
file=file)
# get packages
celist = check_output([
celist = run_conda_command([
'conda',
'list',
'--name',
......
Markdown is supported
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