Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Molecule testing for Singularity, plus infra for more roles #1088

Merged
merged 5 commits into from Jan 19, 2022

Conversation

ajdecon
Copy link
Collaborator

@ajdecon ajdecon commented Jan 7, 2022

Summary

  • Fixes the ability to install Singularity on EL8 by enabling the
    necessary repos
  • Move the pre-execution logic for the Singularity Galaxy role into a
    new DeepOps role, singularity_wrapper
  • Modify the playbook to use singularity_wrapper
  • Add Molecule tests to singularity_wrapper role
  • Move Galaxy requirements for singularity wrapper into the
    singularity_wrapper role, and include this from
    roles/requirements.yml
  • Add a Github Action configuration to execute this and other Molecule
    tests of DeepOps roles
  • Add documentation to docs/deepops/testing.md to describe these tests
    and provide instructions on adding more

Test plan

  • Clean execution of the Github action for this role
  • Clean execution of existing Jenkins tests

Future work

This change adds a lot of infrastructure that should make it easier to
add testing to additional roles. Future changes should enable testing of
more of the roles in DeepOps, but I didn't want to get too carried
away in this one. 馃槈

@ajdecon ajdecon force-pushed the singularity-centos-8 branch 2 times, most recently from 676d129 to 75d2fbf Compare January 7, 2022 15:53
@dholt dholt self-assigned this Jan 7, 2022
scripts/setup.sh Show resolved Hide resolved
@ajdecon ajdecon added the nice-to-have-for-release Good to include in next release but not a blocker label Jan 12, 2022
@ajdecon ajdecon force-pushed the singularity-centos-8 branch 2 times, most recently from cdaac35 to bcdb847 Compare January 12, 2022 20:52
Summary
-------

- Fixes the ability to install Singularity on EL8 by enabling the
  necessary repos
- Move the pre-execution logic for the Singularity Galaxy role into a
  new DeepOps role, singularity_wrapper
- Modify the playbook to use singularity_wrapper
- Add Molecule tests to singularity_wrapper role
- Add a Github Action configuration to execute this and other Molecule
  tests of DeepOps roles
- Add documentation to `docs/deepops/testing.md` to describe these tests
  and provide instructions on adding more

Test plan
---------

Clean execution of the Github action for this role

Future work
-----------

This change adds a lot of infrastructure that should make it easier to
add testing to additional roles. Future changes should enable testing of
more of the roles in DeepOps, but I didn't want to get *too* carried
away in this one. 馃槈
Annoyingly, includes in requirements.yml seem to be relative to the cwd
of ansible-galaxy, rather than relative to the requirements file.

ansible/ansible#46385

Made changes to setup.sh in order to ensure we can install requirements
even if we use includes.
Just check that we actually install Singularity
@ajdecon
Copy link
Collaborator Author

ajdecon commented Jan 12, 2022

@dholt : This should be ready to test now! I simplified the requirements file handling for Github actions.

scripts/setup.sh Outdated
Comment on lines 149 to 167
as_user ansible-galaxy collection install --force -r "${ROOT_DIR}/roles/requirements.yml" >/dev/null
as_user ansible-galaxy role install --force -r "${ROOT_DIR}/roles/requirements.yml" >/dev/null
as_user ansible-galaxy collection install --force -i -r "${ROOT_DIR}/config/requirements.yml" >/dev/null
as_user ansible-galaxy role install --force -i -r "${ROOT_DIR}/config/requirements.yml" >/dev/null
initial_dir="$(pwd)"
roles_path="${ROOT_DIR}/roles/galaxy"
collections_path="${ROOT_DIR}/collections"

# First, install requirements from role requirements.
# Note: due to a known issue in ansible-galaxy, this works best when the
# cwd is the same as the directory where the file is located.
# https://github.com/ansible/ansible/issues/46385
cd "${ROOT_DIR}/roles"
as_user ansible-galaxy collection install -p "${collections_path}" --force -r "requirements.yml" >/dev/null
as_user ansible-galaxy role install -p "${roles_path}" --force -r "requirements.yml" >/dev/null

# Install any user-defined config requirements
if [ -d "${CONFIG_DIR}" ]; then
cd "${CONFIG_DIR}"
as_user ansible-galaxy collection install -p "${collections_path}" --force -i -r "requirements.yml" >/dev/null
as_user ansible-galaxy role install -p "${roles_path}" --force -i -r "requirements.yml" >/dev/null
fi
cd "${initial_dir}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still getting this warning and these errors when running the setup script:

Not entirely sure about this one since it seems properly set in the ansible.cfg file. Is the setup script no longer using the virtual env?

[WARNING]: The specified collections path '/home/ubuntu/deepops/collections' is not part of the configured Ansible collections paths '/home/ubuntu/.ansible/collections:/usr/share/ansible/collections'. The installed collection won't be picked up in an Ansible run.

Wondering if this is because the collections and roles vars in the config/requirements.yml file are empty?

ERROR! Unexpected Exception, this is probably a bug: 'NoneType' object is not iterable
ERROR! Unexpected Exception, this is probably a bug: 'NoneType' object is not iterable

@dholt dholt merged commit aa2dfab into NVIDIA:master Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nice-to-have-for-release Good to include in next release but not a blocker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants