Skip to content

[FEATURE]: Add support to deactivate spack environments #1534

@shahzebsiddiqui

Description

@shahzebsiddiqui

Please describe your feature

Currently we have support to create, activate and remove spack environment but not to deactivate environment spack env deactivate. For reference see https://buildtest.readthedocs.io/en/devel/buildspecs/spack.html#spack-environment

We propose to add a new feature to deactivate environment by introducing a keyword deactivate which is a boolean

buildspecs:
  spack_env_deactivate_first:
    type: spack
    executor: generic.local.bash
    description: "deactivate a spack environment first prior to activating it"
    tags: [spack]
    spack:
      root: $HOME/spack
      env:
        deactivate: true
        create:
          dir: $HOME/spack-envs/m4
        activate:
          dir: $HOME/spack-envs/m4
        specs:
          - 'm4'
      install:
        option: ''
    post_cmds: |
      spack find
      rm -rf $HOME/spack-envs/m4

If deactivate: true is set then we should emit spack env deactivate otherwise its not set.

The order of the commands would be the following in this example, so we should see environment created first then we deactivate any active environment and run spack env activate.

spack env create
spack env deactivate
spack env activate

TODO

Suggest potential solution

No response

Additional Information

No response

Post question in Slack

  • I agree that I posted my question in slack before creating this issue

Is there an existing issue

  • I confirm there is no existing issue for this issue

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions