env: no automatic activation (#17258)

* env: no automatic activation

* Ensure ci rebuild jobs activate the environment (no longer automagic)

Co-authored-by: Scott Wittenburg <scott.wittenburg@kitware.com>
This commit is contained in:
Greg Becker 2020-06-26 17:20:15 -05:00 committed by GitHub
parent dfac09eade
commit 56b4abbe38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 19 deletions

View file

@ -167,15 +167,6 @@ Any directory can be treated as an environment if it contains a file
$ spack env activate -d /path/to/directory
Spack commands that are environment sensitive will also act on the
environment any time the current working directory contains a
``spack.yaml`` file. Changing working directory to a directory
containing a ``spack.yaml`` file is equivalent to the command:
.. code-block:: console
$ spack env activate -d /path/to/dir --without-view
Anonymous specs can be created in place using the command:
.. code-block:: console

View file

@ -45,6 +45,7 @@ for setting up a build pipeline are as follows:
tags:
- <custom-tag>
script:
- spack env activate .
- spack ci generate
--output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/pipeline.yml"
artifacts:
@ -384,6 +385,7 @@ a custom spack and make sure the generated rebuild jobs will clone it too:
- git clone ${SPACK_REPO} --branch ${SPACK_REF}
- . ./spack/share/spack/setup-env.sh
script:
- spack env activate .
- spack ci generate
--spack-repo ${SPACK_REPO} --spack-ref ${SPACK_REF}
--output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/pipeline.yml"

View file

@ -612,7 +612,10 @@ def generate_gitlab_ci_yaml(env, print_summary, output_file,
if 'enable-debug-messages' in gitlab_ci:
debug_flag = '-d '
job_scripts = ['spack {0}ci rebuild'.format(debug_flag)]
job_scripts = [
'spack env activate .',
'spack {0}ci rebuild'.format(debug_flag),
]
compiler_action = 'NONE'
if len(phases) > 1:

View file

@ -247,12 +247,7 @@ def find_environment(args):
# at env_dir (env and env_dir are mutually exclusive)
env = getattr(args, 'env_dir', None)
# if no argument, look for a manifest file
if not env:
if os.path.exists(manifest_name):
env = os.getcwd()
# if no env, env_dir, or manifest try the environment
# if no argument, look for the environment variable
if not env:
env = os.environ.get(spack_env_var)