Skip to content

Commit

Permalink
CI fails to make packages / CI-Env.Dockerfile fails (#88)
Browse files Browse the repository at this point in the history
* CI-Env dockerfile is broken

* incompatibility of exodus and netcdf
  • Loading branch information
ecoon authored Nov 13, 2024
1 parent 3995de4 commit bd23762
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
11 changes: 7 additions & 4 deletions docker/CI-Env.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Stage 1 -- setup base CI environment
#
FROM condaforge/mambaforge:4.12.0-0 AS ww_env_base_ci
FROM condaforge/mambaforge:latest AS ww_env_base_ci
LABEL Description="Base env for CI of Watershed Workflow"

ARG env_name=watershed_workflow_CI
Expand All @@ -13,11 +13,11 @@ COPY environments/create_envs.py /ww/tmp/create_envs.py
RUN mkdir environments

# install a base environment with just python
RUN ${CONDA_BIN} install -n base -y -c conda-forge python=3.10
RUN ${CONDA_BIN} install -n base -y -c conda-forge python=3

RUN --mount=type=cache,target=/opt/conda/pkgs \
/opt/conda/bin/python create_envs.py --manager=${CONDA_BIN} --env-name=${env_name} \
--env-type=CI --with-tools-env --tools-env-name=watershed_workflow_tools Linux
/opt/conda/bin/python create_envs.py \
--env-type=CI --with-tools-env=watershed_workflow_tools --OS=Linux ${env_name}

#
# Stage 2 -- add in the pip
Expand All @@ -43,6 +43,9 @@ WORKDIR /opt/conda/envs/${env_name}/src
RUN apt-get install git
RUN git clone -b v2021-10-11 --depth=1 https://github.com/gsjaardema/seacas/ seacas

# Exodus problems...
RUN find seacas -name \*.c | xargs sed -i '/const int NC_SZIP_NN = 32/d'

# configure
WORKDIR /ww/tmp
COPY docker/configure-seacas.sh /ww/tmp/configure-seacas.sh
Expand Down
14 changes: 11 additions & 3 deletions environments/create_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
]

# channels needed to find these packages
# need force use of linux-64, not just noarch?
CHANNELS=['conda-forge',
# 'defaults',
]
Expand Down Expand Up @@ -166,23 +167,30 @@ def dump_env_local(env_type, os_name, env_name, env_filename=None, new_env_name=
with open(env_filename, 'w') as fid:
fid.write('\n'.join(lines))


_commands = """
CONDA_SUBDIR=linux-64 {package_manager} create --name {env_name} {channels} {packages}
"""
def create_env_local(env_type, os_name, packages, env_name=None, dry_run=False):
"""Creates the environment locally."""
if env_name is None:
env_prefix = get_env_prefix(env_type)
env_name = get_env_name(env_prefix)

# build up the conda env create command
channels = ' '.join([f'-c {c}' for c in CHANNELS])

cmd = [PACKAGE_MANAGER, 'create', '--yes', '--name', env_name]
for channel in CHANNELS:
cmd.append('-c')
cmd.append(channel)
cmd.extend(packages)

# call conda env create
env = os.environ.copy()
env['CONDA_SUBDIR'] = 'linux-64'

if dry_run:
return print(cmd)
subprocess.run(cmd, check=True)
subprocess.run(cmd, env=env, check=True)

# set an environment variable so the user can figure out what we just made
if env_type is None:
Expand Down

0 comments on commit bd23762

Please sign in to comment.