Skip to content

Commit

Permalink
ci: Read env variable from os environment, not from nox (#1869)
Browse files Browse the repository at this point in the history
Contains two types of changes:

- Cleanup of `DOCKER_BUILD_ARGS`: this variable is passed to the docker
build, but not used, which occasionally triggers an unnecessary rebuild.
- As consequence of `DOCKER_BUILD_ARGS` cleanup the base image has been
rebuilt. In the new image we pull a new nox version, which removes the
os environment variables from the nox session environment (refer to nox
PR wntrblm/nox#874). Therefore, such variables
need to be read from the os environment.
  • Loading branch information
edopao authored Feb 17, 2025
1 parent f7f2a0a commit cae8753
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ci/cscs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ stages:
DOCKERFILE: ci/base.Dockerfile
# change to 'always' if you want to rebuild, even if target tag exists already (if-not-exists is the default, i.e. we could also skip the variable)
CSCS_REBUILD_POLICY: if-not-exists
DOCKER_BUILD_ARGS: '["CUDA_VERSION=$CUDA_VERSION", "CUPY_PACKAGE=$CUPY_PACKAGE", "CUPY_VERSION=$CUPY_VERSION", "UBUNTU_VERSION=$UBUNTU_VERSION", "PYVERSION=$PYVERSION", "CI_PROJECT_DIR=$CI_PROJECT_DIR"]'
DOCKER_BUILD_ARGS: '["CUDA_VERSION=$CUDA_VERSION", "CUPY_PACKAGE=$CUPY_PACKAGE", "CUPY_VERSION=$CUPY_VERSION", "UBUNTU_VERSION=$UBUNTU_VERSION", "PYVERSION=$PYVERSION"]'
.build_baseimage_x86_64:
extends: [.container-builder-cscs-zen2, .build_baseimage]
variables:
Expand Down
10 changes: 5 additions & 5 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_cartesian(
groups=["test"],
)

num_processes = session.env.get("NUM_PROCESSES", "auto")
num_processes = os.environ.get("NUM_PROCESSES", "auto")
markers = " and ".join(codegen_settings["markers"] + device_settings["markers"])

session.run(
Expand All @@ -111,7 +111,7 @@ def test_examples(session: nox.Session) -> None:
session.run(*"jupytext docs/user/next/QuickstartGuide.md --to .ipynb".split())
session.run(*"jupytext docs/user/next/advanced/*.md --to .ipynb".split())

num_processes = session.env.get("NUM_PROCESSES", "auto")
num_processes = os.environ.get("NUM_PROCESSES", "auto")
for notebook, extra_args in [
("docs/user/next/workshop/slides", None),
("docs/user/next/workshop/exercises", ["-k", "solutions"]),
Expand All @@ -131,7 +131,7 @@ def test_eve(session: nox.Session) -> None:

_install_session_venv(session, groups=["test"])

num_processes = session.env.get("NUM_PROCESSES", "auto")
num_processes = os.environ.get("NUM_PROCESSES", "auto")

session.run(
*f"pytest --cache-clear -sv -n {num_processes}".split(),
Expand Down Expand Up @@ -180,7 +180,7 @@ def test_next(
groups=groups,
)

num_processes = session.env.get("NUM_PROCESSES", "auto")
num_processes = os.environ.get("NUM_PROCESSES", "auto")
markers = " and ".join(codegen_settings["markers"] + device_settings["markers"] + mesh_markers)

session.run(
Expand Down Expand Up @@ -211,7 +211,7 @@ def test_storage(
session, extras=["performance", "testing", *device_settings["extras"]], groups=["test"]
)

num_processes = session.env.get("NUM_PROCESSES", "auto")
num_processes = os.environ.get("NUM_PROCESSES", "auto")
markers = " and ".join(device_settings["markers"])

session.run(
Expand Down

0 comments on commit cae8753

Please sign in to comment.