From 336edbfc443b3a7f4a2cb52dbfd48c66ed04912d Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Mon, 9 Feb 2026 15:10:02 -0800 Subject: [PATCH 01/39] Update Dockerfile, cime.yaml, and entrypoint.sh in docker/ --- docker/Dockerfile | 34 +++++------------- docker/cime.yaml | 4 +-- docker/entrypoint.sh | 82 +++++++++++++++++++++++++++++++++++++------- 3 files changed, 79 insertions(+), 41 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b9362775bcf..29f9aa91c76 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,46 +1,28 @@ -ARG BASE_TAG=latest -FROM condaforge/miniforge3:${BASE_TAG} AS base +ARG BASE_TAG=25.11.0-1 +FROM quay.io/condaforge/miniforge3:${BASE_TAG} AS base WORKDIR /home/cime -RUN mkdir -p \ - /home/cime/inputdata/cpl/gridmaps/oQU240 \ - /home/cime/inputdata/share/domains \ - /home/cime/timings \ - /home/cime/cases \ - /home/cime/archive \ - /home/cime/baselines \ - /home/cime/tools \ - && wget -O /home/cime/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc \ - https://portal.nersc.gov/project/e3sm/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc \ - && wget -O /home/cime/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc \ - https://portal.nersc.gov/project/e3sm/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc \ - && wget -O /home/cime/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc \ - https://portal.nersc.gov/project/e3sm/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive \ + apt-get install -y --no-install-recommends perl libxml-libxml-perl gosu \ + && rm -rf /var/lib/apt/lists/* COPY cime.yaml cime.yaml -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive \ - apt-get install -y --no-install-recommends \ - perl libxml-libxml-perl && \ - rm -rf /var/lib/apt/lists/* - -RUN mamba install -y gosu tree - RUN mamba create -n e3sm -y --file cime.yaml python=3.10 'libnetcdf=4.9.1=*openmpi*' \ - && conda remove -n e3sm --force perl \ && conda clean -afy \ && rm -rf /opt/conda/pkgs/* RUN mamba create -n cesm -y --file cime.yaml python=3.10 'libnetcdf>=4.9.2=*openmpi*' \ - && conda remove -n cesm --force perl \ && conda clean -afy \ && rm -rf /opt/conda/pkgs/* COPY .cime .cime COPY entrypoint.sh /entrypoint.sh +RUN bash -c "SKIP_ENTRYPOINT=true . /entrypoint.sh && download_input_data" + ENTRYPOINT [ "/entrypoint.sh" ] FROM base AS slurm diff --git a/docker/cime.yaml b/docker/cime.yaml index 52d58039fc1..cbaaf588108 100644 --- a/docker/cime.yaml +++ b/docker/cime.yaml @@ -11,6 +11,7 @@ dependencies: - m4 - pkg-config - vim + - nvim - rsync - openssh - tree @@ -21,8 +22,7 @@ dependencies: # libraries - lapack - blas - # Testing hdf5 is out of scope for CIME - # - hdf5<1.14.0=*openmpi* + - hdf5=*=*openmpi* - netcdf-fortran=*=*openmpi* - libpnetcdf=*=*openmpi* - esmf=*=*openmpi* diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 5e78a7c5ccf..8e46f0febb6 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -21,38 +21,94 @@ function fix_arflags() { fi } -if [[ "${SKIP_ENTRYPOINT}" == "false" ]]; then +function build_cprnc() { + cprnc_dir="${SRC_PATH:-`pwd`}/CIME/non_py/cprnc" + + pushd `mktemp -d` + + cmake "${cprnc_dir}" + + make + + cp cprnc /home/cime/tools/cprnc + + popd +} + +function download_input_data() { + mkdir -p /home/cime/inputdata/cpl/gridmaps/oQU240 \ + /home/cime/inputdata/share/domains \ + /home/cime/timings \ + /home/cime/cases \ + /home/cime/archive \ + /home/cime/baselines \ + /home/cime/tools + + wget -O /home/cime/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc \ + https://portal.nersc.gov/project/e3sm/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc + + wget -O /home/cime/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc \ + https://portal.nersc.gov/project/e3sm/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc + + wget -O /home/cime/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc \ + https://portal.nersc.gov/project/e3sm/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc +} + +function link_config_machines() { if [[ "${CIME_MODEL}" == "e3sm" ]]; then - ln -sf /home/cime/.cime/config_machines.v2.xml /home/cime/.cime/config_machines.xml + ln -sf ${1}/.cime/config_machines.v2.xml ${1}/.cime/config_machines.xml elif [[ "${CIME_MODEL}" == "cesm" ]]; then export ESMFMKFILE=/opt/conda/envs/cesm/lib/esmf.mk - ln -sf /home/cime/.cime/config_machines.v3.xml /home/cime/.cime/config_machines.xml + ln -sf ${1}/.cime/config_machines.v3.xml ${1}/.cime/config_machines.xml fi +} - if [[ "${USER_ID}" == "0" ]]; then - cp -rf /home/cime/.cime /root/ +user_home=/home/cime + +if [[ "${USER_ID}" == "0" ]]; then + user_home=/root + + cp -rf /home/cime/.cime /root/ +fi + +{ + echo "source /opt/conda/etc/profile.d/conda.sh" + echo "conda activate base" + echo "if [[ ${CIME_MODEL} == 'e3sm' ]]; then" + echo " conda activate e3sm" + echo "elif [[ ${CIME_MODEL} == 'cesm' ]]; then" + echo " conda activate cesm" + echo "fi" + # need this to perfer host perl over conda + echo "export PATH=/usr/bin:\$PATH" +} > ${user_home}/.bashrc - git config --global --add safe.directory "*" +link_config_machines ${user_home} +if [[ -e "${PWD}/.git" ]]; then + git config --global --add safe.directory "*" +elif [[ -n "${SRC_PATH}" ]]; then + pushd "${SRC_PATH}" + git config --global --add safe.directory "*" + popd +fi + +if [[ "${SKIP_ENTRYPOINT}" == "false" ]]; then + if [[ "${USER_ID}" == "0" ]]; then exec "${@}" else groupmod -g "${GROUP_ID}" -n cime ubuntu usermod -d /home/cime -u "${USER_ID}" -g "${GROUP_ID}" -l cime ubuntu chown -R cime:cime /home/cime + chmod -R 775 /home/cime if [[ -n "${SRC_PATH}" ]] && [[ -e "${SRC_PATH}" ]]; then chown -R cime:cime "${SRC_PATH}" - - git config --global --add safe.directory "*" + chmod -R 775 "${SRC_PATH}" fi - { - echo "source /opt/conda/etc/profile.d/conda.sh" - echo "conda activate base" - } > /home/cime/.bashrc - gosu "${USER_ID}" "${@}" fi fi From db703889cc8174132c1533944dada4c3e493e66f Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 10 Feb 2026 10:34:14 -0800 Subject: [PATCH 02/39] Fixes base image to always use latest --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 29f9aa91c76..66e201d7e6f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_TAG=25.11.0-1 +ARG BASE_TAG=latest FROM quay.io/condaforge/miniforge3:${BASE_TAG} AS base WORKDIR /home/cime From 3bb231c0747cbd6b2bfad64783003029349d0fbe Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 10 Feb 2026 11:22:58 -0800 Subject: [PATCH 03/39] Cleans up entrypoint --- .github/workflows/testing.yml | 14 +++-- docker/entrypoint.sh | 109 +++++++++++++++++++++------------- 2 files changed, 77 insertions(+), 46 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index ce15387d08c..45574c0cbc2 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -132,6 +132,9 @@ jobs: CIME_TEST_PLATFORM: "ubuntu-latest" SKIP_ENTRYPOINT: "true" run: | + # TODO remove just for testing + export + source /opt/conda/etc/profile.d/conda.sh conda activate cesm @@ -140,9 +143,6 @@ jobs: pip install -r test-requirements.txt - # GitHub runner home is different than container - cp -rf /home/cime/.cime /github/home/ - pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker CIME/tests/test_unit* - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 @@ -223,20 +223,24 @@ jobs: CIME_TEST_PLATFORM: ubuntu-latest SKIP_ENTRYPOINT: "true" run: | + # TODO remove just for testing + export + source /opt/conda/etc/profile.d/conda.sh conda activate ${{ matrix.model.name }} pip install -r test-requirements.txt + # load functions source /entrypoint.sh if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then fix_mct_makefiles ../externals/mct fi - # GitHub runner home is different than container - cp -rf /home/cime/.cime /github/home/ + # TODO remove just for testing + ls -la "${HOME}" if [[ "${CIME_MODEL}" == "e3sm" ]]; then ln -sf /github/home/.cime/config_machines.v2.xml /github/home/.cime/config_machines.xml diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 8e46f0febb6..4962c333d75 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,18 +1,37 @@ #!/bin/bash -export USER=root -export LOGNAME=root -export USER_ID=${USER_ID:-1000} -export GROUP_ID=${GROUP_ID:-1000} - +# Set up basic user, logname, and default group/user IDs +export USER=`id -nu` +export LOGNAME="${USER}" +export USER_ID="${USER_ID:-1000}" +export GROUP_ID="${GROUP_ID:-1000}" + +# Set static home path where .cime exists and container entrypoint options +CIME_HOME="/home/cime" SKIP_ENTRYPOINT="${SKIP_ENTRYPOINT:-false}" +SRC_PATH="${SRC_PATH:-${PWD}}" + + +# Determine HOME directory: use provided HOME in CI, /root if root, default otherwise +if [[ "${CI:-false}" == "true" ]]; then + HOME="${HOME}" +elif [[ "${USER_ID}" == "0" ]]; then + HOME="/root" +else + # Not populated in $HOME until gosu switches user + HOME="/home/cime" +fi + +# Fix AR variable in MCT-related Makefiles function fix_mct_makefiles() { fix_arflags "${1}/mct/Makefile" fix_arflags "${1}/mpeu/Makefile" fix_arflags "${1}/mpi-serial/Makefile" } + +# Add ARFLAGS to AR in a Makefile if .bak does not exist function fix_arflags() { if [[ ! -e "${1}.bak" ]]; then echo "Fixing AR variable in ${1}" @@ -21,8 +40,15 @@ function fix_arflags() { fi } + +# Build the cprnc tool from CIME sources function build_cprnc() { - cprnc_dir="${SRC_PATH:-`pwd`}/CIME/non_py/cprnc" + cprnc_dir="${PWD}/CIME/non_py/cprnc" + + if [[ ! -e "${cprnc_dir}" ]]; then + echo "CPRNC path does not exist. Change to CIME's root directory." + exit 0 + fi pushd `mktemp -d` @@ -30,48 +56,53 @@ function build_cprnc() { make - cp cprnc /home/cime/tools/cprnc + # Needs to be copied into the machines configured tool path + cp cprnc "${CIME_HOME}/tools/cprnc" popd } + +# Download input data needed for model setup function download_input_data() { - mkdir -p /home/cime/inputdata/cpl/gridmaps/oQU240 \ - /home/cime/inputdata/share/domains \ - /home/cime/timings \ - /home/cime/cases \ - /home/cime/archive \ - /home/cime/baselines \ - /home/cime/tools - - wget -O /home/cime/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc \ + mkdir -p "${CIME_HOME}/inputdata/cpl/gridmaps/oQU240" \ + "${CIME_HOME}/inputdata/share/domains" \ + "${CIME_HOME}/timings" \ + "${CIME_HOME}/cases" \ + "${CIME_HOME}/archive" \ + "${CIME_HOME}/baselines" \ + "${CIME_HOME}/tools" + + wget -O "${CIME_HOME}/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc" \ https://portal.nersc.gov/project/e3sm/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc - wget -O /home/cime/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc \ + wget -O "${CIME_HOME}/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc" \ https://portal.nersc.gov/project/e3sm/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc - wget -O /home/cime/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc \ + wget -O "${CIME_HOME}/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc" \ https://portal.nersc.gov/project/e3sm/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc } + +# Link correct config_machines file based on CIME_MODEL, also set ESMFMKFILE for cesm function link_config_machines() { if [[ "${CIME_MODEL}" == "e3sm" ]]; then - ln -sf ${1}/.cime/config_machines.v2.xml ${1}/.cime/config_machines.xml + ln -sf "${CIME_HOME}/.cime/config_machines.v2.xml" "${HOME}/.cime/config_machines.xml" elif [[ "${CIME_MODEL}" == "cesm" ]]; then export ESMFMKFILE=/opt/conda/envs/cesm/lib/esmf.mk - ln -sf ${1}/.cime/config_machines.v3.xml ${1}/.cime/config_machines.xml + ln -sf "${CIME_HOME}/.cime/config_machines.v3.xml" "${HOME}/.cime/config_machines.xml" fi } -user_home=/home/cime - -if [[ "${USER_ID}" == "0" ]]; then - user_home=/root - cp -rf /home/cime/.cime /root/ +# If root or in CI, move .cime config to the appropriate home directory +if [[ "${USER_ID}" == "0" ]] || [[ "${CI:-false}" == "true" ]]; then + cp -rf "${CIME_HOME}/.cime" "${HOME}" fi + +# Write minimal .bashrc to activate correct conda environment and ensure system perl is preferred { echo "source /opt/conda/etc/profile.d/conda.sh" echo "conda activate base" @@ -80,35 +111,31 @@ fi echo "elif [[ ${CIME_MODEL} == 'cesm' ]]; then" echo " conda activate cesm" echo "fi" - # need this to perfer host perl over conda + # Clobber PATH so system perl is used instead of conda perl echo "export PATH=/usr/bin:\$PATH" -} > ${user_home}/.bashrc +} > "${HOME}/.bashrc" -link_config_machines ${user_home} -if [[ -e "${PWD}/.git" ]]; then - git config --global --add safe.directory "*" -elif [[ -n "${SRC_PATH}" ]]; then - pushd "${SRC_PATH}" +link_config_machines + +# Allow git to operate in any directory, for container/dev scenarios +if [[ -e "${SRC_PATH}/.git" ]]; then git config --global --add safe.directory "*" - popd fi + +# If not skipping entrypoint, set up user/group IDs and exec given command. if [[ "${SKIP_ENTRYPOINT}" == "false" ]]; then if [[ "${USER_ID}" == "0" ]]; then exec "${@}" else + # Modify user/group, useful for local in-container development groupmod -g "${GROUP_ID}" -n cime ubuntu - usermod -d /home/cime -u "${USER_ID}" -g "${GROUP_ID}" -l cime ubuntu + usermod -d "${HOME}" -u "${USER_ID}" -g "${GROUP_ID}" -l cime ubuntu - chown -R cime:cime /home/cime - chmod -R 775 /home/cime - - if [[ -n "${SRC_PATH}" ]] && [[ -e "${SRC_PATH}" ]]; then - chown -R cime:cime "${SRC_PATH}" - chmod -R 775 "${SRC_PATH}" - fi + chown -R cime:cime "${HOME}" gosu "${USER_ID}" "${@}" fi fi + From d462fce7bc15e9184d28a2215bdc699ebe3a3f55 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Feb 2026 10:24:40 -0800 Subject: [PATCH 04/39] Updates testing workflow --- .github/workflows/testing.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 45574c0cbc2..fe59e71d3d2 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -132,8 +132,8 @@ jobs: CIME_TEST_PLATFORM: "ubuntu-latest" SKIP_ENTRYPOINT: "true" run: | - # TODO remove just for testing - export + # manually run the entrypoint + source /entrypoint.sh source /opt/conda/etc/profile.d/conda.sh @@ -223,8 +223,8 @@ jobs: CIME_TEST_PLATFORM: ubuntu-latest SKIP_ENTRYPOINT: "true" run: | - # TODO remove just for testing - export + # manually run the entrypoint + source /entrypoint.sh source /opt/conda/etc/profile.d/conda.sh @@ -232,9 +232,6 @@ jobs: pip install -r test-requirements.txt - # load functions - source /entrypoint.sh - if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then fix_mct_makefiles ../externals/mct fi From 7e39a0615d3e52bd96295ae968e4b8c40dd61b20 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Feb 2026 10:28:04 -0800 Subject: [PATCH 05/39] Fixes formatting --- docker/entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 4962c333d75..0a52440233c 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -138,4 +138,3 @@ if [[ "${SKIP_ENTRYPOINT}" == "false" ]]; then gosu "${USER_ID}" "${@}" fi fi - From d8e7cd7fd479d0d8aa19d294be6d19d98f672c11 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Feb 2026 11:12:44 -0800 Subject: [PATCH 06/39] Explicitly installs wget/curl/subversion in container --- docker/Dockerfile | 2 +- docker/cime.yaml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 66e201d7e6f..4398a579baa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /home/cime RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive \ - apt-get install -y --no-install-recommends perl libxml-libxml-perl gosu \ + apt-get install -y --no-install-recommends perl libxml-libxml-perl gosu wget curl subversion \ && rm -rf /var/lib/apt/lists/* COPY cime.yaml cime.yaml diff --git a/docker/cime.yaml b/docker/cime.yaml index cbaaf588108..61b67f17ba8 100644 --- a/docker/cime.yaml +++ b/docker/cime.yaml @@ -5,9 +5,6 @@ dependencies: # development tools - cmake<4.0 # some libraries still require 3.5.x - make - - wget - - curl - - subversion - m4 - pkg-config - vim From 9c60f90ce32cd7e7646279e252a8726f436ce1e9 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Feb 2026 13:39:05 -0800 Subject: [PATCH 07/39] Replaces legacy backticks --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 0a52440233c..fdea1d3fe3d 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash # Set up basic user, logname, and default group/user IDs -export USER=`id -nu` +export USER="$(id -nu)" export LOGNAME="${USER}" export USER_ID="${USER_ID:-1000}" export GROUP_ID="${GROUP_ID:-1000}" From 286597c191979836a2f86161459ab7f4a777704d Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Feb 2026 13:39:39 -0800 Subject: [PATCH 08/39] Only modify HOME if required --- docker/entrypoint.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index fdea1d3fe3d..a695b10c1e4 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -13,11 +13,9 @@ SRC_PATH="${SRC_PATH:-${PWD}}" # Determine HOME directory: use provided HOME in CI, /root if root, default otherwise -if [[ "${CI:-false}" == "true" ]]; then - HOME="${HOME}" -elif [[ "${USER_ID}" == "0" ]]; then +if [[ "${USER_ID}" == "0" ]]; then HOME="/root" -else +elif [[ "${CI:-false}" == "false" ]]; then # Not populated in $HOME until gosu switches user HOME="/home/cime" fi From 78eb63a4d6be836ba3a44dbb82a190650fbd77ce Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Feb 2026 13:39:58 -0800 Subject: [PATCH 09/39] Fixes exit code --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index a695b10c1e4..1b0550c5fdb 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -45,7 +45,7 @@ function build_cprnc() { if [[ ! -e "${cprnc_dir}" ]]; then echo "CPRNC path does not exist. Change to CIME's root directory." - exit 0 + exit 1 fi pushd `mktemp -d` From e05f5a1a05a7c5a3355be76ee9e07a6d2c4e1473 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Feb 2026 13:40:31 -0800 Subject: [PATCH 10/39] Fixes exit if cprnc temp directory cannot be created --- docker/entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 1b0550c5fdb..6df3fd6caa8 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -48,7 +48,7 @@ function build_cprnc() { exit 1 fi - pushd `mktemp -d` + pushd "$(mktemp -d)" || exit 1 cmake "${cprnc_dir}" @@ -57,7 +57,7 @@ function build_cprnc() { # Needs to be copied into the machines configured tool path cp cprnc "${CIME_HOME}/tools/cprnc" - popd + popd || exit 1 } From d3e06e4da18c7854825d89a4195b8d4e532ed69c Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Feb 2026 13:41:04 -0800 Subject: [PATCH 11/39] Fixes forcing host over conda perl for shell and build tools --- docker/entrypoint.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 6df3fd6caa8..3f929f83ca8 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -109,8 +109,11 @@ fi echo "elif [[ ${CIME_MODEL} == 'cesm' ]]; then" echo " conda activate cesm" echo "fi" - # Clobber PATH so system perl is used instead of conda perl - echo "export PATH=/usr/bin:\$PATH" + + echo "export PERL=/usr/bin/perl" + + # prefer host perl + echo "hash -p /usr/bin/perl perl" } > "${HOME}/.bashrc" From c811b106cd1a5ceb47cdb458aec08ac45db6091a Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 3 Mar 2026 23:16:18 -0800 Subject: [PATCH 12/39] Switches to spack for idempotent environment --- .github/workflows/testing.yml | 1 - docker/.cime/config_machines.v2.xml | 11 +-- docker/.cime/docker.cmake | 14 ++-- docker/.cime/docker/config_machines.xml | 11 +-- docker/Dockerfile | 104 ++++++++---------------- docker/cime.yaml | 37 --------- docker/entrypoint.sh | 72 +++++----------- docker/spack.yaml | 18 ++++ 8 files changed, 86 insertions(+), 182 deletions(-) delete mode 100644 docker/cime.yaml create mode 100644 docker/spack.yaml diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index fe59e71d3d2..e0a6da627f5 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -62,7 +62,6 @@ jobs: - name: Build and push uses: docker/build-push-action@v6 with: - target: base context: docker/ push: true tags: ${{ steps.meta.outputs.tags }} diff --git a/docker/.cime/config_machines.v2.xml b/docker/.cime/config_machines.v2.xml index 73b7ea56fb2..3cdd08084cd 100644 --- a/docker/.cime/config_machines.v2.xml +++ b/docker/.cime/config_machines.v2.xml @@ -37,11 +37,12 @@ 1 1 - /opt/conda/envs/e3sm - FALSE - /opt/conda/envs/e3sm - /opt/conda/envs/e3sm - /opt/conda/envs/e3sm + /opt/spack-envs/view + /opt/spack-envs/view + /opt/spack-envs/view + /opt/spack-envs/view/bin:$ENV{PATH} + /opt/spack-envs/view/lib + /opt/spack-envs/view/lib/pkgconfig diff --git a/docker/.cime/docker.cmake b/docker/.cime/docker.cmake index f8439e5e9a2..9251b999c2c 100644 --- a/docker/.cime/docker.cmake +++ b/docker/.cime/docker.cmake @@ -3,18 +3,14 @@ if (COMP_NAME STREQUAL gptl) string(APPEND CPPDEFS " -DHAVE_NANOTIME -DBIT64 -DHAVE_SLASHPROC -DHAVE_GETTIMEOFDAY") endif() -string(APPEND CMAKE_C_FLAGS_RELEASE " -O2 -g") -string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -O2 -g") -string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O2 -g") - -string(APPEND CMAKE_C_FLAGS_DEBUG " -O0") -string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0") -string(APPEND CMAKE_CXX_FLAGS_DEBUG " -O0") +string(APPEND CMAKE_C_FLAGS " -I/opt/spack-envs/view/include -O1 -g -fno-fast-math -frounding-math -fsignaling-nans -fno-inline -fno-aggressive-loop-optimizations") +string(APPEND CMAKE_Fortran_FLAGS " -I/opt/spack-envs/view/include -O1 -g -fno-fast-math -frounding-math -fsignaling-nans -fno-inline -fno-aggressive-loop-optimizations -ffpe-trap=invalid,zero,overflow") +string(APPEND CMAKE_CXX_FLAGS " -I/opt/spack-envs/view/include") # required for grid generation tests that use make if (CMAKE_SOURCE_DIR MATCHES "^.*TestGridGeneration.*$") - string(APPEND FFLAGS " -I/opt/conda/envs/$ENV{CIME_MODEL}/include") - string(APPEND SLIBS " -L/opt/conda/envs/$ENV{CIME_MODEL} -lnetcdf -lnetcdff") + string(APPEND FFLAGS " -I/opt/spack-envs/view/include") + string(APPEND SLIBS " -L/opt/spack-envs/view/lib -lnetcdf -lnetcdff") endif() # DEBUGGING variables diff --git a/docker/.cime/docker/config_machines.xml b/docker/.cime/docker/config_machines.xml index 79fb6f4898d..588b8d62746 100644 --- a/docker/.cime/docker/config_machines.xml +++ b/docker/.cime/docker/config_machines.xml @@ -36,11 +36,12 @@ 1 1 - /opt/conda/envs/cesm - FALSE - /opt/conda/envs/cesm - /opt/conda/envs/cesm - /opt/conda/envs/cesm + /opt/spack-envs/view + /opt/spack-envs/view + /opt/spack-envs/view + /opt/spack-envs/view/bin:$ENV{PATH} + /opt/spack-envs/view/lib + /opt/spack-envs/view/lib/pkgconfig diff --git a/docker/Dockerfile b/docker/Dockerfile index 4398a579baa..ddf7808deb5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,78 +1,38 @@ -ARG BASE_TAG=latest -FROM quay.io/condaforge/miniforge3:${BASE_TAG} AS base - -WORKDIR /home/cime +FROM ghcr.io/spack/ubuntu-noble:1.0.4 AS builder RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive \ - apt-get install -y --no-install-recommends perl libxml-libxml-perl gosu wget curl subversion \ - && rm -rf /var/lib/apt/lists/* - -COPY cime.yaml cime.yaml - -RUN mamba create -n e3sm -y --file cime.yaml python=3.10 'libnetcdf=4.9.1=*openmpi*' \ - && conda clean -afy \ - && rm -rf /opt/conda/pkgs/* + && apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + libopenblas-openmp-dev \ + libopenblas0-openmp \ + libxml-libxml-perl \ + libxml2-utils \ + openmpi-bin \ + libopenmpi-dev \ + perl \ + pkg-config \ + python3-dev \ + subversion \ + wget \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p /opt/spack-envs + +COPY spack.yaml /opt/spack-envs/spack.yaml + +RUN spack compiler find \ + && spack external find --not-buildable \ + && spack external find --not-buildable openmpi \ + && spack -e /opt/spack-envs install --fail-fast -RUN mamba create -n cesm -y --file cime.yaml python=3.10 'libnetcdf>=4.9.2=*openmpi*' \ - && conda clean -afy \ - && rm -rf /opt/conda/pkgs/* +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + vim \ + neovim \ + && rm -rf /var/lib/apt/lists/* \ + && curl -LsSf https://astral.sh/uv/install.sh | sh -COPY .cime .cime COPY entrypoint.sh /entrypoint.sh +COPY .cime /root/.cime -RUN bash -c "SKIP_ENTRYPOINT=true . /entrypoint.sh && download_input_data" - -ENTRYPOINT [ "/entrypoint.sh" ] - -FROM base AS slurm - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive \ - apt-get install -y --no-install-recommends \ - munge slurmd slurm-client slurmctld && \ - rm -rf /var/lib/apt/lists/* && \ - sed -i"" "s/\(.*\)[^<]*\(<\/BATCH_SYSTEM>\)/\1slurm\2/g" ~/.cime/config_machines.xml - -COPY slurm/slurm.conf /etc/slurm-llnl/ -COPY slurm/config_batch.xml /root/.cime/ -COPY slurm/entrypoint_batch.sh /entrypoint_batch.sh - -FROM base AS pbs - -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive \ - apt-get install -y --no-install-recommends \ - curl ca-certificates software-properties-common \ - gcc make libtool libhwloc-dev libx11-dev libxt-dev libedit-dev \ - libical-dev ncurses-dev python-dev tcl-dev tk-dev swig libexpat-dev libssl-dev \ - libxext-dev libxft-dev autoconf automake \ - postgresql-12 postgresql-server-dev-all postgresql-contrib \ - expat libedit2 python3 sendmail-bin sudo tcl tk && \ - add-apt-repository ppa:deadsnakes/ppa && \ - apt-get update && \ - DEBIAN_FRONTEND=noninteractive \ - apt-get install -y python3.7 python3.7-dev && \ - rm -rf /var/lib/apt/lists/* - -RUN mkdir /src && pushd /src && \ - curl -LO https://github.com/openpbs/openpbs/archive/refs/tags/v20.0.1.tar.gz && \ - tar -xvf v20.0.1.tar.gz && \ - cd openpbs-20.0.1 && \ - sed -i"" 's/\(#include "list_link.h"\)/\1\n#include /' /src/openpbs-20.0.1/src/lib/Libifl/list_link.c && \ - export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin && \ - ./autogen.sh && \ - PYTHON=/usr/bin/python3.7 \ - CFLAGS="`/usr/bin/python3.7m-config --cflags`" \ - LDFLAGS="`/usr/bin/python3.7m-config --ldflags`" \ - LIBS="-lpthread -lm -lpython3.7m" \ - ./configure --prefix=/opt/pbs && \ - make -j8 && \ - make install && \ - popd && \ - rm -rf /src && \ - sed -i"" "s/\(.*\)[^<]*\(<\/BATCH_SYSTEM>\)/\1pbs\2/g" ~/.cime/config_machines.xml - -COPY pbs/pbs.conf /etc/ -COPY pbs/config_batch.xml /root/.cime/ -COPY pbs/entrypoint_batch.sh /entrypoint_batch.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/docker/cime.yaml b/docker/cime.yaml deleted file mode 100644 index 61b67f17ba8..00000000000 --- a/docker/cime.yaml +++ /dev/null @@ -1,37 +0,0 @@ -name: base -channels: - - conda-forge -dependencies: -# development tools - - cmake<4.0 # some libraries still require 3.5.x - - make - - m4 - - pkg-config - - vim - - nvim - - rsync - - openssh - - tree -# python packages - - pytest - - pytest-cov - - pyyaml -# libraries - - lapack - - blas - - hdf5=*=*openmpi* - - netcdf-fortran=*=*openmpi* - - libpnetcdf=*=*openmpi* - - esmf=*=*openmpi* - - openmpi - - gcc_linux-64 - - gxx_linux-64 - - gfortran_linux-64 - - gcc=12.* - - gxx=12.* - - gfortran=12.* - - compilers - - c-compiler - - cxx-compiler - - fortran-compiler -prefix: /opt/conda diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 3f929f83ca8..786f0d966e5 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -7,20 +7,10 @@ export USER_ID="${USER_ID:-1000}" export GROUP_ID="${GROUP_ID:-1000}" # Set static home path where .cime exists and container entrypoint options -CIME_HOME="/home/cime" SKIP_ENTRYPOINT="${SKIP_ENTRYPOINT:-false}" SRC_PATH="${SRC_PATH:-${PWD}}" -# Determine HOME directory: use provided HOME in CI, /root if root, default otherwise -if [[ "${USER_ID}" == "0" ]]; then - HOME="/root" -elif [[ "${CI:-false}" == "false" ]]; then - # Not populated in $HOME until gosu switches user - HOME="/home/cime" -fi - - # Fix AR variable in MCT-related Makefiles function fix_mct_makefiles() { fix_arflags "${1}/mct/Makefile" @@ -55,7 +45,7 @@ function build_cprnc() { make # Needs to be copied into the machines configured tool path - cp cprnc "${CIME_HOME}/tools/cprnc" + cp cprnc "${HOME}/tools/cprnc" popd || exit 1 } @@ -63,21 +53,21 @@ function build_cprnc() { # Download input data needed for model setup function download_input_data() { - mkdir -p "${CIME_HOME}/inputdata/cpl/gridmaps/oQU240" \ - "${CIME_HOME}/inputdata/share/domains" \ - "${CIME_HOME}/timings" \ - "${CIME_HOME}/cases" \ - "${CIME_HOME}/archive" \ - "${CIME_HOME}/baselines" \ - "${CIME_HOME}/tools" - - wget -O "${CIME_HOME}/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc" \ + mkdir -p "${HOME}/inputdata/cpl/gridmaps/oQU240" \ + "${HOME}/inputdata/share/domains" \ + "${HOME}/timings" \ + "${HOME}/cases" \ + "${HOME}/archive" \ + "${HOME}/baselines" \ + "${HOME}/tools" + + wget -O "${HOME}/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc" \ https://portal.nersc.gov/project/e3sm/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc - wget -O "${CIME_HOME}/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc" \ + wget -O "${HOME}/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc" \ https://portal.nersc.gov/project/e3sm/inputdata/share/domains/domain.ocn.ne4np4_oQU240.160614.nc - wget -O "${CIME_HOME}/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc" \ + wget -O "${HOME}/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc" \ https://portal.nersc.gov/project/e3sm/inputdata/share/domains/domain.lnd.ne4np4_oQU240.160614.nc } @@ -85,35 +75,21 @@ function download_input_data() { # Link correct config_machines file based on CIME_MODEL, also set ESMFMKFILE for cesm function link_config_machines() { if [[ "${CIME_MODEL}" == "e3sm" ]]; then - ln -sf "${CIME_HOME}/.cime/config_machines.v2.xml" "${HOME}/.cime/config_machines.xml" + ln -sf "${HOME}/.cime/config_machines.v2.xml" "${HOME}/.cime/config_machines.xml" elif [[ "${CIME_MODEL}" == "cesm" ]]; then export ESMFMKFILE=/opt/conda/envs/cesm/lib/esmf.mk - ln -sf "${CIME_HOME}/.cime/config_machines.v3.xml" "${HOME}/.cime/config_machines.xml" + ln -sf "${HOME}/.cime/config_machines.v3.xml" "${HOME}/.cime/config_machines.xml" fi } -# If root or in CI, move .cime config to the appropriate home directory -if [[ "${USER_ID}" == "0" ]] || [[ "${CI:-false}" == "true" ]]; then - cp -rf "${CIME_HOME}/.cime" "${HOME}" -fi - - # Write minimal .bashrc to activate correct conda environment and ensure system perl is preferred { - echo "source /opt/conda/etc/profile.d/conda.sh" - echo "conda activate base" - echo "if [[ ${CIME_MODEL} == 'e3sm' ]]; then" - echo " conda activate e3sm" - echo "elif [[ ${CIME_MODEL} == 'cesm' ]]; then" - echo " conda activate cesm" - echo "fi" - - echo "export PERL=/usr/bin/perl" - - # prefer host perl - echo "hash -p /usr/bin/perl perl" + echo "export PATH=\"/opt/spack-envs/view/bin:$PATH\"" + echo "export PKG_CONFIG_PATH=\"/opt/spack-envs/view/lib/pkgconfig\"" + echo "export LD_LIBRARY_PATH=\"/opt/spack-envs/view/lib\"" + echo "source \$HOME/.local/bin/env" } > "${HOME}/.bashrc" @@ -127,15 +103,5 @@ fi # If not skipping entrypoint, set up user/group IDs and exec given command. if [[ "${SKIP_ENTRYPOINT}" == "false" ]]; then - if [[ "${USER_ID}" == "0" ]]; then - exec "${@}" - else - # Modify user/group, useful for local in-container development - groupmod -g "${GROUP_ID}" -n cime ubuntu - usermod -d "${HOME}" -u "${USER_ID}" -g "${GROUP_ID}" -l cime ubuntu - - chown -R cime:cime "${HOME}" - - gosu "${USER_ID}" "${@}" - fi + exec "${@}" fi diff --git a/docker/spack.yaml b/docker/spack.yaml new file mode 100644 index 00000000000..a069663508b --- /dev/null +++ b/docker/spack.yaml @@ -0,0 +1,18 @@ +spack: + specs: + - hdf5@1.12.3+cxx+fortran+hl+mpi+shared %gcc@13.3.0 + - netcdf-c@4.9.2+mpi %gcc@13.3.0 + - netcdf-fortran@4.6.1 %gcc@13.3.0 + - parallel-netcdf@1.12.3 %gcc@13.3.0 + - esmf@8.8.1+mpi+netcdf~pnetcdf~external-parallelio %gcc@13.3.0 + concretizer: + unify: when_possible + reuse: true + targets: + granularity: generic + host_compatible: false + packages: + all: + target: [x86_64_v3] + view: + default: /opt/spack-envs/view From a917d73bc79abc409793625da86cf2a1ea6c6caa Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 00:09:44 -0800 Subject: [PATCH 13/39] Fixes CI home directory --- docker/entrypoint.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 786f0d966e5..04a8379cf92 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -8,8 +8,6 @@ export GROUP_ID="${GROUP_ID:-1000}" # Set static home path where .cime exists and container entrypoint options SKIP_ENTRYPOINT="${SKIP_ENTRYPOINT:-false}" -SRC_PATH="${SRC_PATH:-${PWD}}" - # Fix AR variable in MCT-related Makefiles function fix_mct_makefiles() { @@ -83,6 +81,10 @@ function link_config_machines() { fi } +if [[ "${CI:-false}" == "true" ]]; then + cp -rf /root/.cime "${HOME}" +fi + # Write minimal .bashrc to activate correct conda environment and ensure system perl is preferred { @@ -96,7 +98,7 @@ function link_config_machines() { link_config_machines # Allow git to operate in any directory, for container/dev scenarios -if [[ -e "${SRC_PATH}/.git" ]]; then +if [[ -e "${PWD}/.git" ]]; then git config --global --add safe.directory "*" fi From 28c06a6a6b7ea0a93d995b080f2fd126a74f4786 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 00:50:31 -0800 Subject: [PATCH 14/39] Fixes testing workflow --- .github/workflows/testing.yml | 37 +++++++++++++---------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index e0a6da627f5..f242ae5afd1 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -122,6 +122,10 @@ jobs: with: path: cesm/cime submodules: "true" + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + python-version: ${{ matrix.python-version }} - name: Run tests shell: bash working-directory: cesm/cime @@ -132,15 +136,10 @@ jobs: SKIP_ENTRYPOINT: "true" run: | # manually run the entrypoint - source /entrypoint.sh - - source /opt/conda/etc/profile.d/conda.sh - - conda activate cesm + SKIP_ENTRYPOINT="true" source /entrypoint.sh - mamba install -y 'python=${{ matrix.python-version }}' - - pip install -r test-requirements.txt + uv pip install -r test-requirements.txt + uv pip install pytest pytest-cov pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker CIME/tests/test_unit* - name: Upload coverage reports to Codecov @@ -213,6 +212,10 @@ jobs: with: path: /home/cime/inputdata key: inputdata-2 + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + python-version: "3.10" - name: Run tests shell: bash working-directory: ${{ matrix.model.name }}/cime @@ -223,27 +226,15 @@ jobs: SKIP_ENTRYPOINT: "true" run: | # manually run the entrypoint - source /entrypoint.sh - - source /opt/conda/etc/profile.d/conda.sh + SKIP_ENTRYPOINT=true source /entrypoint.sh - conda activate ${{ matrix.model.name }} - - pip install -r test-requirements.txt + uv pip install -r test-requirements.txt + uv pip install pytest pytest-cov if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then fix_mct_makefiles ../externals/mct fi - # TODO remove just for testing - ls -la "${HOME}" - - if [[ "${CIME_MODEL}" == "e3sm" ]]; then - ln -sf /github/home/.cime/config_machines.v2.xml /github/home/.cime/config_machines.xml - else - ln -sf /github/home/.cime/config_machines.v3.xml /github/home/.cime/config_machines.xml - fi - git config --global user.name "${{ github.actor }}" git config --global user.email "${{ github.actor }}@users.noreply.github.com" From 6fa1167a9ac3fb344bc389c1cfd7b5e6317ebd7e Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 00:55:59 -0800 Subject: [PATCH 15/39] Fixes using uv pip --- .github/workflows/testing.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f242ae5afd1..c887e5f1af2 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -134,9 +134,10 @@ jobs: CIME_DRIVER: "nuopc" CIME_TEST_PLATFORM: "ubuntu-latest" SKIP_ENTRYPOINT: "true" + UV_SYSTEM_PYTHON: 1 run: | # manually run the entrypoint - SKIP_ENTRYPOINT="true" source /entrypoint.sh + source /entrypoint.sh uv pip install -r test-requirements.txt uv pip install pytest pytest-cov @@ -224,9 +225,10 @@ jobs: CIME_DRIVER: ${{ matrix.driver }} CIME_TEST_PLATFORM: ubuntu-latest SKIP_ENTRYPOINT: "true" + UV_SYSTEM_PYTHON: 1 run: | # manually run the entrypoint - SKIP_ENTRYPOINT=true source /entrypoint.sh + source /entrypoint.sh uv pip install -r test-requirements.txt uv pip install pytest pytest-cov From 8191658b914a56bdfffda0c653b99a8e16877a01 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 01:11:46 -0800 Subject: [PATCH 16/39] Fixes using uv in testing workflow --- .github/workflows/testing.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index c887e5f1af2..9c2af3108d1 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -139,10 +139,13 @@ jobs: # manually run the entrypoint source /entrypoint.sh + uv python install '${{ matrix.python-version }}' + uv venv + source .venv/bin/activate uv pip install -r test-requirements.txt uv pip install pytest pytest-cov - pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker CIME/tests/test_unit* + uv run pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker CIME/tests/test_unit* - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: @@ -230,6 +233,9 @@ jobs: # manually run the entrypoint source /entrypoint.sh + uv python install 3.10 + uv venv + source .venv/bin/activate uv pip install -r test-requirements.txt uv pip install pytest pytest-cov @@ -240,7 +246,7 @@ jobs: git config --global user.name "${{ github.actor }}" git config --global user.email "${{ github.actor }}@users.noreply.github.com" - pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker --no-fortran-run --no-teardown CIME/tests/test_sys* + uv run pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker --no-fortran-run --no-teardown CIME/tests/test_sys* - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: From a4dd31b363a1c07473ba017d513574f479736bff Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 01:25:38 -0800 Subject: [PATCH 17/39] Updates contributing guide --- CONTRIBUTING.md | 44 +++------ doc/source/contributing-guide.rst | 152 +++++++----------------------- 2 files changed, 47 insertions(+), 149 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a70f247e9d4..4278cb975f5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,11 +20,13 @@ For more information on contributing to open source projects, is a great starting point. Also, checkout the [Zen of Scientific Software Maintenance](https://jrleeman.github.io/ScientificSoftwareMaintenance/) for some guiding principles on how to create high quality scientific software contributions. +The canonical, detailed contributing guide for this repository is included in the source tree at `doc/source/contributing-guide.rst`; please consult that file as the single source of truth for developer workflows, testing, and container usage. + ## Getting Started Interested in helping extend CIME? Have code from your research that you believe others will -find useful? Have a few minutes to tackle an issue? In this guide we will get you setup and -integrated into contributing to CIME! +find useful? Have a few minutes to tackle an issue? This guide will get you set up to contribute +to CIME. ## What Can I Do? * Tackle any unassigned [issues](https://github.com/ESMCI/CIME/issues) you wish! @@ -44,7 +46,7 @@ The goal is to maintain a diverse community that's pleasant for everyone. include multiple bug fixes in a single pull request, but they should be related. For unrelated changes, please submit multiple pull requests. * Do not commit changes to files that are irrelevant to your feature or bugfix - (eg: .gitignore). + (e.g., .gitignore). * Be willing to accept constructive criticism as part of issuing a pull request, since the CIME developers are dedicated to ensuring that new features extend the system robustly and do not introduce new bugs. @@ -53,7 +55,7 @@ The goal is to maintain a diverse community that's pleasant for everyone. ## Reporting a bug When creating a new issue, please be as specific as possible. Include the version -of the code you were using, as well as what operating system you are running. +of the code you were using, as well as what operating system you are running. Include the commit SHA or tag (e.g., output of `git rev-parse HEAD`) and the branch name. If possible, include complete, minimal example code that reproduces the problem. ## Pull Requests @@ -62,34 +64,17 @@ We love pull requests from everyone. Fork, then clone the repo: git clone git@github.com:your-username/CIME.git -Additionally you may need to checkout the submodules with: +You will need to initialize and update submodules: cd CIME - git submodule update --init - -You will need to install CIME dependencies and edit config files -to tell CIME about your development machine. See the [CIME users guide](https://esmci.github.io/cime/users_guide/porting-cime.html) - -Run the scripts_regression_tests: - - cd CIME/tests - python scripts_regression_tests.py - -Alternatively with `pytest`: - - pytest CIME/tests - -Make your change. Add tests for your change. Make the tests pass to the same level as before your changes. - - cd CIME/tests - python scripts_regression_tests.py + git submodule update --init --recursive -Run [pre-commit](https://pre-commit.com/#usage) before committing changes and submitting a PR. +From here you can edit the code and run the unit tests following this [guide](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#pytest). - pip install pre-commit - pre-commit run -a +If you need to run the system tests you will need to have your respective model +checked out and on a supported machine. -Commit the changes you made. Chris Beams has written a [guide](https://chris.beams.io/posts/git-commit/) on how to write good commit messages. +Before creating your PR you will need to run the code quality checkers; see this [guide](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#code-quality). Push to your fork and [submit a pull request][pr]. @@ -102,8 +87,9 @@ We may suggest some changes or improvements or alternatives. Some things that will increase the chance that your pull request is accepted: * Write tests. -* Follow [PEP8][pep8] for style. (The `flake8` utility can help with this.) -* Write a [good commit message][commit]. +* Write documentation. +* Follow the [Code Quality guide](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#code-quality) +* Write a good commit message, we recommend using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) Pull requests will automatically have tests run by a Github Action. This includes running both the unit tests as well as `pre-commit`, which checks diff --git a/doc/source/contributing-guide.rst b/doc/source/contributing-guide.rst index c479ed864ca..05bd7bcdbd8 100644 --- a/doc/source/contributing-guide.rst +++ b/doc/source/contributing-guide.rst @@ -21,9 +21,9 @@ The `Case` class includes an array of the Case env classes. In the `configure` f Testing ------- -CIME splits it's testing into two categories `unit` and `sys`. +CIME splits its tests into two categories: `unit` and `sys`. -The `unit` category covers both doctests and unit tests. While the `sys` category covers regression tests. The tests are named accordingly e.g. `unit` tests are found as `CIME/tests/test_unit*`. +The `unit` category covers doctests and unit tests, while the `sys` category covers regression tests. Tests are named accordingly (e.g., unit tests: `CIME/tests/test_unit*`). How to run the tests ``````````````````````` @@ -41,13 +41,12 @@ To get started install `pytest` and `pytest-cov`. .. code-block:: bash + pip install -r test-requirements.txt pip install pytest pytest-cov - # or - # conda install -c conda-forge pytest pytest-cov Examples ........ -Runing all the ``sys`` and ``unit`` tests. +Running all the ``sys`` and ``unit`` tests. .. code-block:: bash @@ -59,13 +58,13 @@ Running only ``sys`` tests, ``sys`` can be replaced with ``unit`` to run only un pytest CIME/tests/test_sys.* -Runnig a specific test case. +Running a specific test case. .. code-block:: bash pytest CIME/tests/test_unit_case.py -A specific test can be ran with the followin. +A specific test can be run with the following. .. code-block:: bash @@ -80,7 +79,7 @@ You can pass either the module name or the file path of a test. Examples ........ -Runing all the ``sys`` and ``unit`` tests. +Running all the ``sys`` and ``unit`` tests. .. code-block:: bash @@ -98,7 +97,7 @@ Runnig a specific test case. python CIME/tests/scripts_regression_tests.py CIME.tests.test_unit_case -A specific test can be ran with the followin. +A specific test can be run with the following. .. code-block:: bash @@ -117,9 +116,7 @@ Installing pre-commit .. code-block:: bash - pip install pre_commit - # or - # conda install -c conda-forge pre_commit + pip install pre-commit Running pre-commit `````````````````` @@ -138,127 +135,42 @@ If you install these scripts then `pre-commit` will automatically run on `git co Docker container ---------------- -GitHub actions runs all CIME's tests in containers. The dockerfile can be found under the `docker/` directory. - -You can skip building the container and use the same container from the GitHub actions using the following commands. This will pull the latest [image](https://hub.docker.com/r/jasonb87/cime/tags), see the available [run modifiers](#running-the-container) to customize the container. - -The current container supports the ``GNU`` compiler and ``OpenMPI`` library. - -Running -``````` -The default environment is similar to the one used by GitHub Actions. It will clone CIME into `/src/cime`, set `CIME_MODEL=cesm` and run CESM's `checkout_externals`. This will create a minimum base environment to run both unit and system tests. - -The `CIME_MODEL` environment vairable will change the environment that is created. - -Setting it to `E3SM` will clone E3SM into `/src/E3SM`, checkout the submodules and update the CIME repository using `CIME_REPO` and `CIME_BRANCH`. - -Setting it to `CESM` will clone CESM into `/src/CESM`, run `checkout_externals` and update the CIME repository using `CIME_REPO` and `CIME_BRANCH`. - -The container can further be modified using the environment variables defined below. - -.. code-block:: bash - - docker run -it --name cime --hostname docker cime:latest bash - - -.. code-block:: bash - - docker run -it --name cime --hostname docker -e CIME_MODEL=e3sm cime:latest bash +CIME provides a container that the CI uses to run all the testing. This container -.. note:: - - It's recommended when running the container to pass `--hostname docker` as it will match the custom machine defined in `config_machines.xml`. If this is omitted, `--machine docker` must be passed to CIME commands in order to use the correct machine definition. +can also be used to test locally providing a reproducible environment. The -Environment variables -::::::::::::::::::::: +compiler is ``GNU`` and the MPI implementation is ``OpenMPI``. -Environment variables to modify the container environment. - -| Name | Description | Default | -| ---- | ----------- | ------- | -| INIT | Set to false to skip init | true | -| GIT_SHALLOW | Performs shallow checkouts, to save time | false | -| UPDATE_CIME | Setting this will cause the CIME repository to be updated using `CIME_REPO` and `CIME_BRANCH` | "false" | -| CIME_MODEL | Setting this will change which environment is loaded | | -| CIME_REPO | CIME repository URL | https://github.com/ESMCI/cime | -| CIME_BRANCH | CIME branch that will be cloned | master | -| E3SM_REPO | E3SM repository URL | https://github.com/E3SM-Project/E3SM | -| E3SM_BRANCH | E3SM branch that will be cloned | master | -| CESM_REPO | CESM repository URL | https://github.com/ESCOMP/CESM | -| CESM_BRANCH | CESM branch that will be cloned | master | - -Examples -:::::::: -.. code-block:: bash - - docker run -it -e INIT=false cime:latest bash - -.. code-block:: bash - - docker run -it -e CIME_REPO=https://github.com/user/cime -e CIME_BRANCH=updates_xyz cime:latest bash - -Persisting data -::::::::::::::: - -The `config_machines.xml` definition as been setup to provided persistance for inputdata, cases, archives and tools. The following paths can be mounted as volumes to provide persistance. - -* /storage/inputdata -* /storage/cases -* /storage/archives -* /storage/tools +The image can be pulled from ``ghcr.io``. .. code-block:: bash - docker run -it -v ${PWD}/data-cache:/storage/inputdata cime:latest bash + docker pull ghcr.io/esmci/cime:latest -It's also possible to persist the source git repositories. +or can be built locally. .. code-block:: bash - docker run -it -v ${PWD}/src:/src cime:latest bash + docker build -t ghcr.io/esmci/cime:latest docker/ -Local git respositories can be mounted as well. +Running +``````` +The container does not provide any source, as such you will need to bind +mount the model+cime directory and define which model is being used. The +following example assumes the model is checked out in ``$SRC_PATH``. .. code-block:: bash - docker run -v ${PWD}:/src/cime cime:latest bash - - docker run -v ${PWD}:/src/E3SM cime:latest bash - -Building -```````` -The container provides 3 targets. + docker run -it --rm --hostname docker -e CIME_MODEL=e3sm -v ${SRC_PATH}:/root/model -v `pwd`/test-cases:/root/cases -v `pwd`/input-data:/root/inputdata -w /root/E3SM/cime ghcr.io/esmci/cime:latest bash -* base - Base image with no batch system. -* slurm - Slurm batch system with configuration and single queue. -* pbs - PBS batch system with configuration and single queue. +This example will drop into a shell where CIME commands or tests can be run. +The options are broken down below. -.. code-block:: bash - - docker build -t ghcr.io/ESMCI/cime:latest --target docker/ - -Customizing -::::::::::: -When building the container some features can be customized. Multiple `--build-arg` arguments can be passed. - -.. code-block:: bash - - docker build -t ghcr.io/ESMCI/cime:latest --build-arg {name}={value} docker/ - -+------------------------+-----------------------------------------------+---------+ -| Argument | Description | Default | -+========================+===============================================+=========+ -| MAMBAFORGE_VERSION | Version of the condaforge/mambaforge image | 4.11.0-0| -| | used as a base | | -+------------------------+-----------------------------------------------+---------+ -| PNETCDF_VERSION | Parallel NetCDF version to build | 1.12.1 | -+------------------------+-----------------------------------------------+---------+ -| LIBNETCDF_VERSION | Version of libnetcdf, the default will | 4.8.1 | -| | install the latest | | -+------------------------+-----------------------------------------------+---------+ -| NETCDF_FORTRAN_VERSION | Version of netcdf-fortran, the default will | 4.5.4 | -| | install the latest | | -+------------------------+-----------------------------------------------+---------+ -| ESMF_VERSION | Version of ESMF, the default will install the | 8.2.0 | -| | latest | | -+------------------------+-----------------------------------------------+---------+ +- ``--hostname docker`` is required to tell CIME which machine definition to use. +- ``-e CIME_MODEL=e3sm`` defines the model. +- ``-v ${SRC_PATH}:/root/model`` passes through the model source. +- ``-v `pwd`/test-cases:/root/cases`` stores cases in the current directory under ``test-cases``. +- ``-v `pwd`/inputdata:/root/inputdata`` stores inputdata in the current directory under ``inputdata``. +- ``-w /root/E3SM/cime`` set the current working directory to CIME's root. +- ``ghcr.io/esmci/cime:latest`` container image. +- ``bash`` the command to run in the container. From a612bcbcd3ad7a2f40eeb3d5af5c209283c1aa2a Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 01:27:17 -0800 Subject: [PATCH 18/39] Fixes black formatting --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9c2af3108d1..50340d36cff 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -134,7 +134,7 @@ jobs: CIME_DRIVER: "nuopc" CIME_TEST_PLATFORM: "ubuntu-latest" SKIP_ENTRYPOINT: "true" - UV_SYSTEM_PYTHON: 1 + UV_SYSTEM_PYTHON: 1 run: | # manually run the entrypoint source /entrypoint.sh From 7d66fe50bfd748f6eafa25e7804eec5d058b80e5 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 01:28:04 -0800 Subject: [PATCH 19/39] Fixes setting up uv python --- .github/workflows/testing.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 50340d36cff..d2672c5dd19 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -139,7 +139,6 @@ jobs: # manually run the entrypoint source /entrypoint.sh - uv python install '${{ matrix.python-version }}' uv venv source .venv/bin/activate uv pip install -r test-requirements.txt @@ -233,7 +232,6 @@ jobs: # manually run the entrypoint source /entrypoint.sh - uv python install 3.10 uv venv source .venv/bin/activate uv pip install -r test-requirements.txt From 2e730de29b32c9bb0e92c2b8b276229f4999ecf3 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 01:35:00 -0800 Subject: [PATCH 20/39] Fixes pip install --- .github/workflows/testing.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d2672c5dd19..dd49a36a4b4 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -141,8 +141,8 @@ jobs: uv venv source .venv/bin/activate - uv pip install -r test-requirements.txt - uv pip install pytest pytest-cov + pip install -r test-requirements.txt + pip install pytest pytest-cov uv run pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker CIME/tests/test_unit* - name: Upload coverage reports to Codecov @@ -234,8 +234,8 @@ jobs: uv venv source .venv/bin/activate - uv pip install -r test-requirements.txt - uv pip install pytest pytest-cov + pip install -r test-requirements.txt + pip install pytest pytest-cov if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then fix_mct_makefiles ../externals/mct From 5ddf24490fac58118d9fe7c86a78dd1101bf2952 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 01:41:09 -0800 Subject: [PATCH 21/39] Fixes uv management --- .github/workflows/testing.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index dd49a36a4b4..5ee7edc2be7 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -124,8 +124,6 @@ jobs: submodules: "true" - name: Install uv uses: astral-sh/setup-uv@v7 - with: - python-version: ${{ matrix.python-version }} - name: Run tests shell: bash working-directory: cesm/cime @@ -134,15 +132,15 @@ jobs: CIME_DRIVER: "nuopc" CIME_TEST_PLATFORM: "ubuntu-latest" SKIP_ENTRYPOINT: "true" - UV_SYSTEM_PYTHON: 1 run: | # manually run the entrypoint source /entrypoint.sh + uv python install "${{ matrix.python-version }}" uv venv source .venv/bin/activate - pip install -r test-requirements.txt - pip install pytest pytest-cov + uv pip install -r test-requirements.txt + uv pip install pytest pytest-cov uv run pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker CIME/tests/test_unit* - name: Upload coverage reports to Codecov @@ -227,15 +225,15 @@ jobs: CIME_DRIVER: ${{ matrix.driver }} CIME_TEST_PLATFORM: ubuntu-latest SKIP_ENTRYPOINT: "true" - UV_SYSTEM_PYTHON: 1 run: | # manually run the entrypoint source /entrypoint.sh + uv python install 3.10 uv venv source .venv/bin/activate - pip install -r test-requirements.txt - pip install pytest pytest-cov + uv pip install -r test-requirements.txt + uv pip install pytest pytest-cov if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then fix_mct_makefiles ../externals/mct From ffc660d1e6a0e582204a0e289b927e9b7252817f Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 10:46:01 -0800 Subject: [PATCH 22/39] Fixes entrypoint and adds a default venv --- docker/Dockerfile | 10 ++++++++-- docker/entrypoint.sh | 15 +++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ddf7808deb5..02bb7433be6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -29,8 +29,14 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ vim \ neovim \ - && rm -rf /var/lib/apt/lists/* \ - && curl -LsSf https://astral.sh/uv/install.sh | sh + && rm -rf /var/lib/apt/lists/* + +RUN curl -LsSf https://astral.sh/uv/install.sh | sh \ + && source ~/.local/bin/env \ + && uv python install 3.10 \ + && uv venv \ + && source .venv/bin/activate \ + && uv pip install pytest pytest-cov COPY entrypoint.sh /entrypoint.sh COPY .cime /root/.cime diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 04a8379cf92..684bb64d03f 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -85,16 +85,6 @@ if [[ "${CI:-false}" == "true" ]]; then cp -rf /root/.cime "${HOME}" fi - -# Write minimal .bashrc to activate correct conda environment and ensure system perl is preferred -{ - echo "export PATH=\"/opt/spack-envs/view/bin:$PATH\"" - echo "export PKG_CONFIG_PATH=\"/opt/spack-envs/view/lib/pkgconfig\"" - echo "export LD_LIBRARY_PATH=\"/opt/spack-envs/view/lib\"" - echo "source \$HOME/.local/bin/env" -} > "${HOME}/.bashrc" - - link_config_machines # Allow git to operate in any directory, for container/dev scenarios @@ -102,6 +92,11 @@ if [[ -e "${PWD}/.git" ]]; then git config --global --add safe.directory "*" fi +export PATH=/opt/spack-envs/view/bin:$PATH +export PKG_CONFIG_PATH=/opt/spakc-envs/view/pkgconfig +export LD_LIBRARY_PATH=/opt/spack-envs/view/lib +source ${HOME}/.local/bin/env +source ${HOME}/.venv/bin/activate # If not skipping entrypoint, set up user/group IDs and exec given command. if [[ "${SKIP_ENTRYPOINT}" == "false" ]]; then From 88c557e6264e2814880f44e8e3d8f795384552d3 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 10:54:57 -0800 Subject: [PATCH 23/39] Updates documentation --- CONTRIBUTING.md | 5 +++-- doc/source/contributing-guide.rst | 13 ++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4278cb975f5..88207281515 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,8 +71,9 @@ You will need to initialize and update submodules: From here you can edit the code and run the unit tests following this [guide](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#pytest). -If you need to run the system tests you will need to have your respective model -checked out and on a supported machine. +When running the ``unit`` tests you can specify any valid machine e.g. docker and the tests will run. + +If you need to run the ``system`` tests you will need to have your respective model checked out and on a supported machine. Alternatively you can use CIME [container](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#docker-container) which is used in our GitHub CI testing. Before creating your PR you will need to run the code quality checkers; see this [guide](https://esmci.github.io/cime/versions/master/html/contributing-guide.html#code-quality). diff --git a/doc/source/contributing-guide.rst b/doc/source/contributing-guide.rst index 05bd7bcdbd8..d0138d3b448 100644 --- a/doc/source/contributing-guide.rst +++ b/doc/source/contributing-guide.rst @@ -168,9 +168,20 @@ The options are broken down below. - ``--hostname docker`` is required to tell CIME which machine definition to use. - ``-e CIME_MODEL=e3sm`` defines the model. -- ``-v ${SRC_PATH}:/root/model`` passes through the model source. +- ``-v ${SRC_PATH}:/root/E3SM`` passes through the model source. - ``-v `pwd`/test-cases:/root/cases`` stores cases in the current directory under ``test-cases``. - ``-v `pwd`/inputdata:/root/inputdata`` stores inputdata in the current directory under ``inputdata``. - ``-w /root/E3SM/cime`` set the current working directory to CIME's root. - ``ghcr.io/esmci/cime:latest`` container image. - ``bash`` the command to run in the container. + +You can even run CIME or testing without a shell. + +.. code-block:: bash + + docker run -it --rm --hostname docker -e CIME_MODEL=e3sm -v ${SRC_PATH}:/root/model -v `pwd`/test-cases:/root/cases -v `pwd`/input-data:/root/inputdata -w /root/E3SM/cime ghcr.io/esmci/cime:latest pytest CIME/tests/test_unit* + +.. code-block:: bash + + docker run -it --rm --hostname docker -e CIME_MODEL=e3sm -v ${SRC_PATH}:/root/model -v `pwd`/test-cases:/root/cases -v `pwd`/input-data:/root/inputdata -w /root/E3SM/cime ghcr.io/esmci/cime:latest ./scripts/create_test SMS.f19_g16.S + From 2969950f0e4ffb789c19271618591bb09e2c8b7f Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 11:32:54 -0800 Subject: [PATCH 24/39] Fixes not loading uv python when running in CI --- docker/entrypoint.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 684bb64d03f..999e5601758 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -95,8 +95,11 @@ fi export PATH=/opt/spack-envs/view/bin:$PATH export PKG_CONFIG_PATH=/opt/spakc-envs/view/pkgconfig export LD_LIBRARY_PATH=/opt/spack-envs/view/lib -source ${HOME}/.local/bin/env -source ${HOME}/.venv/bin/activate + +if [[ "${CI:-false}" == "true" ]]; then + source ${HOME}/.local/bin/env + source ${HOME}/.venv/bin/activate +fi # If not skipping entrypoint, set up user/group IDs and exec given command. if [[ "${SKIP_ENTRYPOINT}" == "false" ]]; then From 9811e64f7fa4103243dc99b810eab07d85a212a3 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 11:38:52 -0800 Subject: [PATCH 25/39] Adds missing ESMFMKFILE --- docker/entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 999e5601758..a9107b2ed7b 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -95,6 +95,7 @@ fi export PATH=/opt/spack-envs/view/bin:$PATH export PKG_CONFIG_PATH=/opt/spakc-envs/view/pkgconfig export LD_LIBRARY_PATH=/opt/spack-envs/view/lib +export ESMFMKFILE=/opt/spack-envs/view/lib/esmf.mk if [[ "${CI:-false}" == "true" ]]; then source ${HOME}/.local/bin/env From 124cd0f847b4e27b441ce4e46d8517d6200bcd4f Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 4 Mar 2026 13:45:37 -0800 Subject: [PATCH 26/39] fix: not loading uv in CI --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index a9107b2ed7b..3eee5ca08eb 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -97,7 +97,7 @@ export PKG_CONFIG_PATH=/opt/spakc-envs/view/pkgconfig export LD_LIBRARY_PATH=/opt/spack-envs/view/lib export ESMFMKFILE=/opt/spack-envs/view/lib/esmf.mk -if [[ "${CI:-false}" == "true" ]]; then +if [[ "${CI:-false}" == "false" ]]; then source ${HOME}/.local/bin/env source ${HOME}/.venv/bin/activate fi From df08a6107039f122e932abd804473f2d02550f94 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 10 Mar 2026 10:58:13 -0700 Subject: [PATCH 27/39] fix: adds debug --- .github/workflows/testing.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 5ee7edc2be7..062bb18598c 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -229,6 +229,9 @@ jobs: # manually run the entrypoint source /entrypoint.sh + # TODO remove, debug only + export + uv python install 3.10 uv venv source .venv/bin/activate From bcf2be4cdf3244c0c27bb6044abce63c201cf581 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Tue, 10 Mar 2026 14:20:26 -0700 Subject: [PATCH 28/39] fix: disable fixing mct ARFLAGS --- .github/workflows/testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 062bb18598c..155e76e8a79 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -238,9 +238,9 @@ jobs: uv pip install -r test-requirements.txt uv pip install pytest pytest-cov - if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then - fix_mct_makefiles ../externals/mct - fi + # if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then + # fix_mct_makefiles ../externals/mct + # fi git config --global user.name "${{ github.actor }}" git config --global user.email "${{ github.actor }}@users.noreply.github.com" From a0fb2ca4515ef94436c5b07902bb3803e42b9881 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 11 Mar 2026 12:05:10 -0700 Subject: [PATCH 29/39] fix: machine directories --- docker/.cime/config_machines.v2.xml | 14 +++++++------- docker/.cime/docker/config_machines.xml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docker/.cime/config_machines.v2.xml b/docker/.cime/config_machines.v2.xml index 3cdd08084cd..6ed4d6c9a6b 100644 --- a/docker/.cime/config_machines.v2.xml +++ b/docker/.cime/config_machines.v2.xml @@ -9,14 +9,14 @@ gnu,gnuX openmpi CIME - /home/cime/timings + /root/timings CIME - /home/cime/cases - /home/cime/inputdata - /home/cime/inputdata-clmforc - /home/cime/archive/$CASE - /home/cime/baselines/$COMPILER - /home/cime/tools/cprnc + /root/cases + /root/inputdata + /root/inputdata-clmforc + /root/archive/$CASE + /root/baselines/$COMPILER + /root/tools/cprnc make 4 e3sm_developer diff --git a/docker/.cime/docker/config_machines.xml b/docker/.cime/docker/config_machines.xml index 588b8d62746..cbe42413ba3 100644 --- a/docker/.cime/docker/config_machines.xml +++ b/docker/.cime/docker/config_machines.xml @@ -8,14 +8,14 @@ gnu,gnuX openmpi CIME - /home/cime/timings + /root/timings CIME - /home/cime/cases - /home/cime/inputdata - /home/cime/inputdata-clmforc - /home/cime/archive/$CASE - /home/cime/baselines/$COMPILER - /home/cime/tools/cprnc + /root/cases + /root/inputdata + /root/inputdata-clmforc + /root/archive/$CASE + /root/baselines/$COMPILER + /root/tools/cprnc make 4 e3sm_developer From 1fbec2472cca5c815e926b2511ad0aafde3f1d44 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 11 Mar 2026 12:05:31 -0700 Subject: [PATCH 30/39] fix: PKG_CONFIG_PATH typo and path --- docker/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 3eee5ca08eb..de10b68f5ab 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -93,7 +93,7 @@ if [[ -e "${PWD}/.git" ]]; then fi export PATH=/opt/spack-envs/view/bin:$PATH -export PKG_CONFIG_PATH=/opt/spakc-envs/view/pkgconfig +export PKG_CONFIG_PATH=/opt/spack-envs/view/lib/pkgconfig export LD_LIBRARY_PATH=/opt/spack-envs/view/lib export ESMFMKFILE=/opt/spack-envs/view/lib/esmf.mk From cf103359ae21f481968a19ad119522bf2f5c77e2 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 11 Mar 2026 12:24:31 -0700 Subject: [PATCH 31/39] fix: test requirements and build context --- .github/workflows/testing.yml | 3 --- docker/Dockerfile | 10 ++++++---- test-requirements.txt | 2 ++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 155e76e8a79..3686e658d4e 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -140,7 +140,6 @@ jobs: uv venv source .venv/bin/activate uv pip install -r test-requirements.txt - uv pip install pytest pytest-cov uv run pytest -vvv --cov=CIME --cov-branch --cov-report=xml --machine docker CIME/tests/test_unit* - name: Upload coverage reports to Codecov @@ -236,8 +235,6 @@ jobs: uv venv source .venv/bin/activate uv pip install -r test-requirements.txt - uv pip install pytest pytest-cov - # if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then # fix_mct_makefiles ../externals/mct # fi diff --git a/docker/Dockerfile b/docker/Dockerfile index 02bb7433be6..6405ed28410 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && mkdir -p /opt/spack-envs -COPY spack.yaml /opt/spack-envs/spack.yaml +COPY docker/spack.yaml /opt/spack-envs/spack.yaml RUN spack compiler find \ && spack external find --not-buildable \ @@ -31,14 +31,16 @@ RUN apt-get update \ neovim \ && rm -rf /var/lib/apt/lists/* +COPY test-requirements.txt /requirements.txt + RUN curl -LsSf https://astral.sh/uv/install.sh | sh \ && source ~/.local/bin/env \ && uv python install 3.10 \ && uv venv \ && source .venv/bin/activate \ - && uv pip install pytest pytest-cov + && uv pip install -r /requirements.txt -COPY entrypoint.sh /entrypoint.sh -COPY .cime /root/.cime +COPY docker/entrypoint.sh /entrypoint.sh +COPY docker/.cime /root/.cime ENTRYPOINT ["/entrypoint.sh"] diff --git a/test-requirements.txt b/test-requirements.txt index d4abdec4d0f..9d22f450869 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1,3 @@ evv4esm +pytest +pytest-cov From 3a3cd4e3269a9205ad3f09a91ca523739e7c8e60 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 11 Mar 2026 12:25:03 -0700 Subject: [PATCH 32/39] fix: removes debugging and unused scripting --- .github/workflows/testing.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 3686e658d4e..0c5968f9bf1 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -228,16 +228,10 @@ jobs: # manually run the entrypoint source /entrypoint.sh - # TODO remove, debug only - export - uv python install 3.10 uv venv source .venv/bin/activate uv pip install -r test-requirements.txt - # if [[ "${{ matrix.model.name }}" == "e3sm" ]]; then - # fix_mct_makefiles ../externals/mct - # fi git config --global user.name "${{ github.actor }}" git config --global user.email "${{ github.actor }}@users.noreply.github.com" From 47a0e7e8172fd7b357ebd28a57cec1057b97e0e4 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 11 Mar 2026 12:25:16 -0700 Subject: [PATCH 33/39] fix: updates doc --- doc/source/contributing-guide.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/contributing-guide.rst b/doc/source/contributing-guide.rst index d0138d3b448..04b0253876f 100644 --- a/doc/source/contributing-guide.rst +++ b/doc/source/contributing-guide.rst @@ -147,11 +147,11 @@ The image can be pulled from ``ghcr.io``. docker pull ghcr.io/esmci/cime:latest -or can be built locally. +or can be built locally. The build context needs to be set to the root of the CIME repository. .. code-block:: bash - docker build -t ghcr.io/esmci/cime:latest docker/ + docker build -t ghcr.io/esmci/cime:latest -f docker/Dockerfile . Running ``````` From a230764921cc61776f258eaada57725ca686dac2 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 11 Mar 2026 13:01:56 -0700 Subject: [PATCH 34/39] fix: build job config --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 0c5968f9bf1..4a13d1f7cbe 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -62,7 +62,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v6 with: - context: docker/ + file: docker/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From cecca55c2fb58b323c524a731c9ad0445064c97c Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 11 Mar 2026 13:44:49 -0700 Subject: [PATCH 35/39] fix: sets context to current directory --- .github/workflows/testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 4a13d1f7cbe..8d07e4d9392 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -63,6 +63,7 @@ jobs: uses: docker/build-push-action@v6 with: file: docker/Dockerfile + context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 4ee43c34a724b2ff24bba23429f1e6bcdc7dd472 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 11 Mar 2026 14:11:14 -0700 Subject: [PATCH 36/39] fix: download input data --- docker/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6405ed28410..3d34a883b40 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -43,4 +43,7 @@ RUN curl -LsSf https://astral.sh/uv/install.sh | sh \ COPY docker/entrypoint.sh /entrypoint.sh COPY docker/.cime /root/.cime +RUN SKIP_ENTRYPOINT=true source /entrypoint.sh \ + && download_input_data + ENTRYPOINT ["/entrypoint.sh"] From 3ff3abbfd5dd4082809d37d7acf06d1067730d43 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 11 Mar 2026 15:14:28 -0700 Subject: [PATCH 37/39] fix: archive paths for workflow failures --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 8d07e4d9392..60e85c40007 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -249,7 +249,7 @@ jobs: - name: Create testing log archive if: ${{ failure() }} shell: bash - run: tar -czvf /testing-logs-${GITHUB_RUN_NUMBER}-${{ matrix.model.name }}-${{ matrix.driver }}.tar.gz /home/cime/cases /home/cime/baselines /home/cime/archive + run: tar -czvf /testing-logs-${GITHUB_RUN_NUMBER}-${{ matrix.model.name }}-${{ matrix.driver }}.tar.gz /root/cases /root/baselines /root/archive # How to download artifacts: # https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts - name: Upload testing logs From 82929f76d54e6391b578b1eb5373465a53a30498 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Mar 2026 10:19:09 -0700 Subject: [PATCH 38/39] fix: removes unused functions --- docker/entrypoint.sh | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index de10b68f5ab..562035a6cf4 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -9,24 +9,6 @@ export GROUP_ID="${GROUP_ID:-1000}" # Set static home path where .cime exists and container entrypoint options SKIP_ENTRYPOINT="${SKIP_ENTRYPOINT:-false}" -# Fix AR variable in MCT-related Makefiles -function fix_mct_makefiles() { - fix_arflags "${1}/mct/Makefile" - fix_arflags "${1}/mpeu/Makefile" - fix_arflags "${1}/mpi-serial/Makefile" -} - - -# Add ARFLAGS to AR in a Makefile if .bak does not exist -function fix_arflags() { - if [[ ! -e "${1}.bak" ]]; then - echo "Fixing AR variable in ${1}" - - sed -i".bak" "s/\$(AR)/\$(AR) \$(ARFLAGS)/g" "${1}" - fi -} - - # Build the cprnc tool from CIME sources function build_cprnc() { cprnc_dir="${PWD}/CIME/non_py/cprnc" @@ -50,6 +32,7 @@ function build_cprnc() { # Download input data needed for model setup +# required for grid generation tests function download_input_data() { mkdir -p "${HOME}/inputdata/cpl/gridmaps/oQU240" \ "${HOME}/inputdata/share/domains" \ From d3fd50689e4ee0b66d6b1aff7d0529e99217a9ee Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Thu, 12 Mar 2026 11:41:20 -0700 Subject: [PATCH 39/39] fix: coalesce cime directories for easier persistence --- .github/workflows/testing.yml | 2 +- doc/source/contributing-guide.rst | 10 +++++----- docker/.cime/config_machines.v2.xml | 10 +++++----- docker/.cime/docker/config_machines.xml | 10 +++++----- docker/entrypoint.sh | 18 +++++++++--------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 60e85c40007..8114d401444 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -249,7 +249,7 @@ jobs: - name: Create testing log archive if: ${{ failure() }} shell: bash - run: tar -czvf /testing-logs-${GITHUB_RUN_NUMBER}-${{ matrix.model.name }}-${{ matrix.driver }}.tar.gz /root/cases /root/baselines /root/archive + run: tar -czvf /testing-logs-${GITHUB_RUN_NUMBER}-${{ matrix.model.name }}-${{ matrix.driver }}.tar.gz /root/storage/cases /root/storage/baselines /root/storage/archive # How to download artifacts: # https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts - name: Upload testing logs diff --git a/doc/source/contributing-guide.rst b/doc/source/contributing-guide.rst index 04b0253876f..5fbb9cb4f78 100644 --- a/doc/source/contributing-guide.rst +++ b/doc/source/contributing-guide.rst @@ -161,7 +161,7 @@ following example assumes the model is checked out in ``$SRC_PATH``. .. code-block:: bash - docker run -it --rm --hostname docker -e CIME_MODEL=e3sm -v ${SRC_PATH}:/root/model -v `pwd`/test-cases:/root/cases -v `pwd`/input-data:/root/inputdata -w /root/E3SM/cime ghcr.io/esmci/cime:latest bash + docker run -it --rm --hostname docker -e CIME_MODEL=e3sm -v ${SRC_PATH}:/root/model -v ./storage:/root/storage -v ./inputdata:/root/inputdata -w /root/E3SM/cime ghcr.io/esmci/cime:latest bash This example will drop into a shell where CIME commands or tests can be run. The options are broken down below. @@ -169,8 +169,8 @@ The options are broken down below. - ``--hostname docker`` is required to tell CIME which machine definition to use. - ``-e CIME_MODEL=e3sm`` defines the model. - ``-v ${SRC_PATH}:/root/E3SM`` passes through the model source. -- ``-v `pwd`/test-cases:/root/cases`` stores cases in the current directory under ``test-cases``. -- ``-v `pwd`/inputdata:/root/inputdata`` stores inputdata in the current directory under ``inputdata``. +- ``-v ./inputdata:/root/inputdata`` persistent input data. +- ``-v ./storage:/root/storage`` persistent cases, baselines, timings, etc. - ``-w /root/E3SM/cime`` set the current working directory to CIME's root. - ``ghcr.io/esmci/cime:latest`` container image. - ``bash`` the command to run in the container. @@ -179,9 +179,9 @@ You can even run CIME or testing without a shell. .. code-block:: bash - docker run -it --rm --hostname docker -e CIME_MODEL=e3sm -v ${SRC_PATH}:/root/model -v `pwd`/test-cases:/root/cases -v `pwd`/input-data:/root/inputdata -w /root/E3SM/cime ghcr.io/esmci/cime:latest pytest CIME/tests/test_unit* + docker run -it --rm --hostname docker -e CIME_MODEL=e3sm -v ${SRC_PATH}:/root/model -v ./storage:/root/storage -w /root/E3SM/cime ghcr.io/esmci/cime:latest pytest CIME/tests/test_unit* .. code-block:: bash - docker run -it --rm --hostname docker -e CIME_MODEL=e3sm -v ${SRC_PATH}:/root/model -v `pwd`/test-cases:/root/cases -v `pwd`/input-data:/root/inputdata -w /root/E3SM/cime ghcr.io/esmci/cime:latest ./scripts/create_test SMS.f19_g16.S + docker run -it --rm --hostname docker -e CIME_MODEL=e3sm -v ${SRC_PATH}:/root/model -v ./storage:/root/storage -w /root/E3SM/cime ghcr.io/esmci/cime:latest ./scripts/create_test SMS.f19_g16.S diff --git a/docker/.cime/config_machines.v2.xml b/docker/.cime/config_machines.v2.xml index 6ed4d6c9a6b..b36a660488a 100644 --- a/docker/.cime/config_machines.v2.xml +++ b/docker/.cime/config_machines.v2.xml @@ -9,14 +9,14 @@ gnu,gnuX openmpi CIME - /root/timings + /root/storage/timings CIME - /root/cases + /root/storage/cases /root/inputdata /root/inputdata-clmforc - /root/archive/$CASE - /root/baselines/$COMPILER - /root/tools/cprnc + /root/storage/archive/$CASE + /root/storage/baselines/$COMPILER + /root/storage/tools/cprnc make 4 e3sm_developer diff --git a/docker/.cime/docker/config_machines.xml b/docker/.cime/docker/config_machines.xml index cbe42413ba3..3aee97ec316 100644 --- a/docker/.cime/docker/config_machines.xml +++ b/docker/.cime/docker/config_machines.xml @@ -8,14 +8,14 @@ gnu,gnuX openmpi CIME - /root/timings + /root/storage/timings CIME - /root/cases + /root/storage/cases /root/inputdata /root/inputdata-clmforc - /root/archive/$CASE - /root/baselines/$COMPILER - /root/tools/cprnc + /root/storage/archive/$CASE + /root/storage/baselines/$COMPILER + /root/storage/tools/cprnc make 4 e3sm_developer diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 562035a6cf4..194538c8e7f 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -3,8 +3,6 @@ # Set up basic user, logname, and default group/user IDs export USER="$(id -nu)" export LOGNAME="${USER}" -export USER_ID="${USER_ID:-1000}" -export GROUP_ID="${GROUP_ID:-1000}" # Set static home path where .cime exists and container entrypoint options SKIP_ENTRYPOINT="${SKIP_ENTRYPOINT:-false}" @@ -34,13 +32,15 @@ function build_cprnc() { # Download input data needed for model setup # required for grid generation tests function download_input_data() { - mkdir -p "${HOME}/inputdata/cpl/gridmaps/oQU240" \ - "${HOME}/inputdata/share/domains" \ - "${HOME}/timings" \ - "${HOME}/cases" \ - "${HOME}/archive" \ - "${HOME}/baselines" \ - "${HOME}/tools" + local storage="${HOME}/storage" + + mkdir -p "${HOME}/inputdata/cpl/gridmaps/oQU240" + mkdir -p "${HOME}/inputdata/share/domains" + mkdir -p "${storage}/cases" + mkdir -p "${storage}/timings" + mkdir -p "${storage}/archive" + mkdir -p "${storage}/baselines" + mkdir -p "${storage}/tools" wget -O "${HOME}/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc" \ https://portal.nersc.gov/project/e3sm/inputdata/cpl/gridmaps/oQU240/map_oQU240_to_ne4np4_aave.160614.nc