From 97e7f770d9f9224e31d36b9124d4d964746c062e Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Thu, 23 Sep 2021 11:33:42 -0700 Subject: [PATCH 01/12] Start with a working setup --- .gitlab-ci.yml | 11 ++++++++--- spack-environments/radiuss/ci-config.yml | 9 +++++++++ spack-environments/raja-suite/ci-variables.yml | 9 +++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 spack-environments/radiuss/ci-config.yml create mode 100644 spack-environments/raja-suite/ci-variables.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3969dd..e1dc71c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,10 +10,8 @@ variables: SPACK_PARENT_DIR: ${CI_BUILDS_DIR}/llnl-stack-${CI_COMMIT_SHORT_SHA} SPACK_PATH: ${CI_BUILDS_DIR}/llnl-stack-${CI_COMMIT_SHORT_SHA}/spack #[--create-unique-path] - SPACK_REPO: https://github.com/spack/spack.git - SPACK_REF: develop SPACK_DEBUG: "-d" - ENV_NAME: "radiuss" + ENV_NAME: "" # We only do one generation per stage because we found conflicts otherwise #[one-generate-per-stage--] @@ -49,3 +47,10 @@ rm-spack: include: - .gitlab/generate.yml + #- spack-environments/${ENV_NAME}/ci-variables.yml + - spack-environments/radiuss/ci-variables.yml + rules: + - if: '$ENV_NAME == "radiuss"' + - spack-environments/raja-suite/ci-variables.yml + rules: + - if: '$ENV_NAME == "raja-suite"' diff --git a/spack-environments/radiuss/ci-config.yml b/spack-environments/radiuss/ci-config.yml new file mode 100644 index 0000000..fe13b91 --- /dev/null +++ b/spack-environments/radiuss/ci-config.yml @@ -0,0 +1,9 @@ +############################################################################## +# Copyright (c) 2019-2021, Lawrence Livermore National Security, LLC and +# RADIUSS project contributors. See the COPYRIGHT file for details. +# +# SPDX-License-Identifier: (MIT) +############################################################################## + +SPACK_REPO: https://github.com/spack/spack.git +SPACK_REF: develop diff --git a/spack-environments/raja-suite/ci-variables.yml b/spack-environments/raja-suite/ci-variables.yml new file mode 100644 index 0000000..fe13b91 --- /dev/null +++ b/spack-environments/raja-suite/ci-variables.yml @@ -0,0 +1,9 @@ +############################################################################## +# Copyright (c) 2019-2021, Lawrence Livermore National Security, LLC and +# RADIUSS project contributors. See the COPYRIGHT file for details. +# +# SPDX-License-Identifier: (MIT) +############################################################################## + +SPACK_REPO: https://github.com/spack/spack.git +SPACK_REF: develop From 67ef379224f26362fadc6fba546130f1b7ad3a53 Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 14:08:52 -0700 Subject: [PATCH 02/12] commit latest changes --- .gitlab-ci.yml | 25 +++++++------------------ .gitlab/generate.yml | 35 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e1dc71c..8827bf8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,11 +16,11 @@ variables: # We only do one generation per stage because we found conflicts otherwise #[one-generate-per-stage--] stages: - - get-spack + - setup - generate-quartz - generate-lassen - build - - rm-spack + - clean #[--one-generate-per-stage] .on-quartz: @@ -29,24 +29,10 @@ stages: .on-lassen: tags: [shell, lassen] -#[get-spack--] -get-spack: - extends: [.on-quartz] - stage: get-spack - script: - - scripts/get-spack -#[--get-spack] - -#[rm-spack--] -rm-spack: - extends: [.on-quartz] - stage: rm-spack - script: - - scripts/remove-spack -#[--rm-spack] - include: - .gitlab/generate.yml + rules: + - if: '$ENV_NAME ~= ""' #- spack-environments/${ENV_NAME}/ci-variables.yml - spack-environments/radiuss/ci-variables.yml rules: @@ -54,3 +40,6 @@ include: - spack-environments/raja-suite/ci-variables.yml rules: - if: '$ENV_NAME == "raja-suite"' + - .gitlab/no-env-name.yml + rules: + - if: '$ENV_NAME == ""' diff --git a/.gitlab/generate.yml b/.gitlab/generate.yml index 9f31a89..966649e 100644 --- a/.gitlab/generate.yml +++ b/.gitlab/generate.yml @@ -7,21 +7,22 @@ # # Generate CI pipelines for the package in $ENV_NAME -# To use with each job that has to run when an environment name is provided. -.has_project_name: - rules: - - if: '$ENV_NAME == ""' - when: never - - if: '$CI_JOB_NAME == "rm-spack"' - when: always - - when: on_success +#[get-spack--] +get-spack: + extends: [.on-quartz] + stage: setup + script: + - scripts/get-spack +#[--get-spack] -# To use with each job that has to run when no environment is provided. -.no_project_name: - rules: - - if: '$ENV_NAME != ""' - when: never - - when: on_success +#[rm-spack--] +rm-spack: + extends: [.on-quartz] + stage: clean + script: + - scripts/remove-spack + when: always +#[--rm-spack] .generate-pipeline: script: @@ -37,14 +38,13 @@ # quartz generate-on-quartz: - extends: [.generate-pipeline, .on-quartz, .has_project_name] + extends: [.generate-pipeline, .on-quartz] stage: generate-quartz before_script: - scripts/print-variables #[send-variable-child--] build-on-quartz: - extends: [.has_project_name] stage: build variables: CHILD_SPACK_PATH: ${SPACK_PATH} @@ -58,13 +58,12 @@ build-on-quartz: # lassen generate-on-lassen: - extends: [.generate-pipeline, .on-lassen, .has_project_name] + extends: [.generate-pipeline, .on-lassen] stage: generate-lassen before_script: - scripts/print-variables build-on-lassen: - extends: [.has_project_name] stage: build variables: CHILD_SPACK_PATH: ${SPACK_PATH} From 28329d697a334b357aa416859212d008ca5cd730 Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 14:13:39 -0700 Subject: [PATCH 03/12] Fix syntax --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8827bf8..fce0c45 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,16 +30,16 @@ stages: tags: [shell, lassen] include: - - .gitlab/generate.yml + - local: .gitlab/generate.yml rules: - if: '$ENV_NAME ~= ""' #- spack-environments/${ENV_NAME}/ci-variables.yml - - spack-environments/radiuss/ci-variables.yml + - local: spack-environments/radiuss/ci-variables.yml rules: - if: '$ENV_NAME == "radiuss"' - - spack-environments/raja-suite/ci-variables.yml + - local: spack-environments/raja-suite/ci-variables.yml rules: - if: '$ENV_NAME == "raja-suite"' - - .gitlab/no-env-name.yml + - local: .gitlab/no-env-name.yml rules: - if: '$ENV_NAME == ""' From 0d6cf463bc235a23cecb48b22af6c9e55bb2b296 Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 14:16:36 -0700 Subject: [PATCH 04/12] Add dead end script --- .gitlab/no-env-name.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .gitlab/no-env-name.yml diff --git a/.gitlab/no-env-name.yml b/.gitlab/no-env-name.yml new file mode 100644 index 0000000..bbbb3fb --- /dev/null +++ b/.gitlab/no-env-name.yml @@ -0,0 +1,16 @@ +############################################################################## +# Copyright (c) 2019-2021, Lawrence Livermore National Security, LLC and +# RADIUSS project contributors. See the COPYRIGHT file for details. +# +# SPDX-License-Identifier: (MIT) +############################################################################## +# +# Run a simple jobs to display instructions when no env name was specified. + +no-env-name: + extends: [.on-quartz] + stage: setup + script: + - echo "Variable \"ENV_NAME\" was not set." + - echo "\"ENV_NAME\" is required and should point to an existing directory in spack-environments." + - exit 1 From 5d99dd7d4e8f38165a25a799499667c46d057a4b Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 14:20:54 -0700 Subject: [PATCH 05/12] Fix rename --- spack-environments/radiuss/ci-config.yml | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 spack-environments/radiuss/ci-config.yml diff --git a/spack-environments/radiuss/ci-config.yml b/spack-environments/radiuss/ci-config.yml deleted file mode 100644 index fe13b91..0000000 --- a/spack-environments/radiuss/ci-config.yml +++ /dev/null @@ -1,9 +0,0 @@ -############################################################################## -# Copyright (c) 2019-2021, Lawrence Livermore National Security, LLC and -# RADIUSS project contributors. See the COPYRIGHT file for details. -# -# SPDX-License-Identifier: (MIT) -############################################################################## - -SPACK_REPO: https://github.com/spack/spack.git -SPACK_REF: develop From a3d4c41a4f45b78dde7c2bb0dff04134905a7f97 Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 14:25:50 -0700 Subject: [PATCH 06/12] Fix rename --- spack-environments/radiuss/ci-variables.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 spack-environments/radiuss/ci-variables.yml diff --git a/spack-environments/radiuss/ci-variables.yml b/spack-environments/radiuss/ci-variables.yml new file mode 100644 index 0000000..fe13b91 --- /dev/null +++ b/spack-environments/radiuss/ci-variables.yml @@ -0,0 +1,9 @@ +############################################################################## +# Copyright (c) 2019-2021, Lawrence Livermore National Security, LLC and +# RADIUSS project contributors. See the COPYRIGHT file for details. +# +# SPDX-License-Identifier: (MIT) +############################################################################## + +SPACK_REPO: https://github.com/spack/spack.git +SPACK_REF: develop From 6c09e5604ab437facb8ab0fc6f04cd6fc0d5bbd7 Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 14:36:01 -0700 Subject: [PATCH 07/12] improved organization --- docs/sphinx/add-environment.rst | 26 ++++++++++++++++++++++ docs/sphinx/index.rst | 3 ++- docs/sphinx/{general.rst => structure.rst} | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 docs/sphinx/add-environment.rst rename docs/sphinx/{general.rst => structure.rst} (99%) diff --git a/docs/sphinx/add-environment.rst b/docs/sphinx/add-environment.rst new file mode 100644 index 0000000..4c20d7e --- /dev/null +++ b/docs/sphinx/add-environment.rst @@ -0,0 +1,26 @@ +.. ## other RADIUSS Project Developers. See the top-level COPYRIGHT file for +.. ## details. +.. ## +.. ## SPDX-License-Identifier: (MIT) + +.. _add-environment: + +================================ +Process to add a new environment +================================ + +The goal of this project is to be able to build any environment of interest for +RADIUSS, independently, and in a reproducible manner. We aim in particular at +building those environments against Spack develop branch to check that RADIUSS +packages do not get broken by recent changes in Spack. + +The very first step is to make sure your environment can be built completely +isolated of any personnal Spack configuration, on LC systems. All the required +configuration needs to be embedded in the environment directory. + +Then you need to add the ``gitlab-ci`` section to the ``spack.yaml`` file. This +should be doable by inspecting the existing radiuss environement. Create a Pull +Request and ask for help if needed. + +Finally, adding an environment to the CI is easy. Most of the work being to +update in the UI the environment variables mentioned above. diff --git a/docs/sphinx/index.rst b/docs/sphinx/index.rst index 5b4a42e..5f56166 100644 --- a/docs/sphinx/index.rst +++ b/docs/sphinx/index.rst @@ -62,7 +62,8 @@ Table of Contents .. toctree:: :maxdepth: 2 - general + structure + add-environment spack-pipeline-feature Indices and tables diff --git a/docs/sphinx/general.rst b/docs/sphinx/structure.rst similarity index 99% rename from docs/sphinx/general.rst rename to docs/sphinx/structure.rst index 45bf524..4fcdee0 100644 --- a/docs/sphinx/general.rst +++ b/docs/sphinx/structure.rst @@ -4,7 +4,7 @@ .. ## .. ## SPDX-License-Identifier: (MIT) -.. _general: +.. _structure: The goal of this project is to provide a code infrastructure using Spack pipeline feature to test on LC machines any Spack environment of interest for From 498bcf09b417b01cb60389ce781e3fe0444853fa Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 14:42:51 -0700 Subject: [PATCH 08/12] Fix variables set in variables section --- spack-environments/radiuss/ci-variables.yml | 5 +++-- spack-environments/raja-suite/ci-variables.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/spack-environments/radiuss/ci-variables.yml b/spack-environments/radiuss/ci-variables.yml index fe13b91..ced54fe 100644 --- a/spack-environments/radiuss/ci-variables.yml +++ b/spack-environments/radiuss/ci-variables.yml @@ -5,5 +5,6 @@ # SPDX-License-Identifier: (MIT) ############################################################################## -SPACK_REPO: https://github.com/spack/spack.git -SPACK_REF: develop +variables: + SPACK_REPO: https://github.com/spack/spack.git + SPACK_REF: develop diff --git a/spack-environments/raja-suite/ci-variables.yml b/spack-environments/raja-suite/ci-variables.yml index fe13b91..ced54fe 100644 --- a/spack-environments/raja-suite/ci-variables.yml +++ b/spack-environments/raja-suite/ci-variables.yml @@ -5,5 +5,6 @@ # SPDX-License-Identifier: (MIT) ############################################################################## -SPACK_REPO: https://github.com/spack/spack.git -SPACK_REF: develop +variables: + SPACK_REPO: https://github.com/spack/spack.git + SPACK_REF: develop From 22f041378d150d687cd17feb66944e112401ec1e Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 14:46:25 -0700 Subject: [PATCH 09/12] Fix conditionnal syntax --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fce0c45..150ee3f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,7 +32,7 @@ stages: include: - local: .gitlab/generate.yml rules: - - if: '$ENV_NAME ~= ""' + - if: '$ENV_NAME != ""' #- spack-environments/${ENV_NAME}/ci-variables.yml - local: spack-environments/radiuss/ci-variables.yml rules: From 6414234a42e2c44e05931faff53e432f6bd026a8 Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 21:04:28 -0700 Subject: [PATCH 10/12] Improved documentation --- .gitlab-ci.yml | 8 +- docs/sphinx/add-environment.rst | 142 ++++++++++++++++++++++++++++++-- 2 files changed, 138 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 150ee3f..3c084be 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,16 +30,16 @@ stages: tags: [shell, lassen] include: - - local: .gitlab/generate.yml - rules: - - if: '$ENV_NAME != ""' - #- spack-environments/${ENV_NAME}/ci-variables.yml - local: spack-environments/radiuss/ci-variables.yml rules: - if: '$ENV_NAME == "radiuss"' - local: spack-environments/raja-suite/ci-variables.yml rules: - if: '$ENV_NAME == "raja-suite"' + - local: .gitlab/generate.yml + rules: + - if: '$ENV_NAME != ""' + #- spack-environments/${ENV_NAME}/ci-variables.yml - local: .gitlab/no-env-name.yml rules: - if: '$ENV_NAME == ""' diff --git a/docs/sphinx/add-environment.rst b/docs/sphinx/add-environment.rst index 4c20d7e..4b298d7 100644 --- a/docs/sphinx/add-environment.rst +++ b/docs/sphinx/add-environment.rst @@ -14,13 +14,139 @@ RADIUSS, independently, and in a reproducible manner. We aim in particular at building those environments against Spack develop branch to check that RADIUSS packages do not get broken by recent changes in Spack. -The very first step is to make sure your environment can be built completely -isolated of any personnal Spack configuration, on LC systems. All the required -configuration needs to be embedded in the environment directory. +Pre-requisite +============= -Then you need to add the ``gitlab-ci`` section to the ``spack.yaml`` file. This -should be doable by inspecting the existing radiuss environement. Create a Pull -Request and ask for help if needed. +To be used in CI, we need to make sure your environment can be built +completely isolated of any personnal Spack configuration on LC systems. +All the required configuration needs to be embedded in the environment +directory. -Finally, adding an environment to the CI is easy. Most of the work being to -update in the UI the environment variables mentioned above. +**Note** + +You may use this CI to effectively iterate over builds of an environment to fix +it. That's part of the purpose of this repo. + +Required adds-on +================ + +Gitlab section in spack config +------------------------------ + +Spack will use the ``gitlab-ci`` section to the ``spack.yaml`` file to +generate the pipeline for you environment. In particular, this is where we +map runners to specs. Adding this section should be doable by inspecting +the existing radiuss environement. Create a Pull Request and ask for help +if needed. + +CI variables +------------ + +There are three (3) variables that need to be defined in the CI YAML +configuration in order to make it work. + +* `ENV_NAME`: the name of the environment, which must match one of the + directories under `spack_environments`. + +* `SPACK_REPO`: the URL where to clone Spack from. + +* `SPACK_REF`: the ref to checkout in Spack repo. + +The CI is configured to generate a subpipeline using the environment under the +`spack_environments/`. The two other variables will be retrieved in +this same directory, but GitLab needs an hint. + +First, create a file named `ci-variables.yml` in +`spack_environments/`. In this file, add the definition of the +missing variables: + +.. code-block:: yaml + + variables: + SPACK_REPO: + SPACK_REF: + +Then edit the `.gitlab-ci.yml` file to add a conditional inclusion of you ci +variable file: + +.. code-block:: yaml + + include: + - local: spack-environments//ci-variables.yml + rules: + - if: '$ENV_NAME == ""' + - local: spack-environments/radiuss/ci-variables.yml + rules: + - if: '$ENV_NAME == "radiuss"' + +This simply means that each time the CI runs with `ENV_NAME=` it will +include the appropriate variable file. All you need to do to run your +environment pipeline is to set your environement name. + +Pull Request worflow +-------------------- + +We recommend setting your environment name globally in `.gitlab-ci.yml` + +Recommended adds-on +=================== + +Although you may use radiuss-spack-testing to play solo − even clone it in +another GitLab repo − we see it as an opportunity to gather various Spack +environments useful for LLNL. + +In particular, we provide a preferred location to create your `install_tree`, +`mirror` (build-cache) and `store` (for concretizer bootstrap). + +.. note:: + + The following recommendation applies to those belonging to the RADIUSS + group only. We could workaround that using the radiuss service user in + the future. + +Getting Started configuration +----------------------------- + +As a getting started recommendation, and if you belong to RADIUSS group, we +recommend creating a directory with you `ENV_NAME` in: + +* `/usr/workspace/radiuss/installs/` +* `/usr/workspace/radiuss/mirrors/` +* `/usr/workspace/radiuss/stores/` + +.. note:: + + Immediately addapt the permissions so that the RADIUSS group has write + access on those: + +.. code-block:: bash + + chmod -R g+rwX /usr/workspace/radiuss/installs/ + chmod -R g+rwX /usr/workspace/radiuss/mirrors/ + chmod -R g+rwX /usr/workspace/radiuss/stores/ + +Then, point your environment configuration to those locations. For install +tree, use: + +.. code-block:: yaml + + config: + install_tree: + root: /usr/workspace/radiuss/install/radiuss + padded_length: 128 + projections: + all: '{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}' + +For the mirror location, use: + +.. code-block:: yaml + + mirrors: + mirror: file:///usr/workspace/radiuss/mirrors/radiuss + +For the store location, use: + +.. code-block:: yaml + + bootstrap: + root: /usr/workspace/radiuss/store/radiuss From dde65de53079412c7612d3840fa960c702e129ef Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 21:10:24 -0700 Subject: [PATCH 11/12] Fix rule syntax --- .gitlab-ci.yml | 2 +- .gitlab/generate.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c084be..880ef6b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,7 @@ include: - if: '$ENV_NAME == "raja-suite"' - local: .gitlab/generate.yml rules: - - if: '$ENV_NAME != ""' + - if: $ENV_NAME #- spack-environments/${ENV_NAME}/ci-variables.yml - local: .gitlab/no-env-name.yml rules: diff --git a/.gitlab/generate.yml b/.gitlab/generate.yml index 966649e..5b67849 100644 --- a/.gitlab/generate.yml +++ b/.gitlab/generate.yml @@ -73,4 +73,3 @@ build-on-lassen: job: generate-on-lassen strategy: depend needs: [generate-on-lassen] - From 662427270df780ca9564988184134618f9e8d34b Mon Sep 17 00:00:00 2001 From: "Adrien M. Bernede" Date: Mon, 27 Sep 2021 21:12:59 -0700 Subject: [PATCH 12/12] Really fix this rules syntax --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 880ef6b..c2d8c13 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,7 @@ include: - if: '$ENV_NAME == "raja-suite"' - local: .gitlab/generate.yml rules: - - if: $ENV_NAME + - if: '$ENV_NAME =~ /^./' #- spack-environments/${ENV_NAME}/ci-variables.yml - local: .gitlab/no-env-name.yml rules: