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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

playbooks for CI checks, units and functional tests #2079

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

jctanner
Copy link
Collaborator

@jctanner jctanner commented Feb 21, 2024

This is a set of playbooks, roles, files and templates that are able to spawn a container almost identical to the one generated by https://github.com/pulp/plugin_template 's scripts and then run the various checks, unit tests and functional tests. All without needing to use the files layed out by https://github.com/pulp/plugin_template

Key differences with these playbooks:

  • can be run locally on any x86 linux or macos machine with docker
  • set the python version on the container from the earliest step in the process
  • can install projects in editable mode for live edit&debug loops
  • coverage reporting on the unit tests
  • we can edit and improve them without having to use the plugin template repo

@jctanner jctanner marked this pull request as draft February 21, 2024 17:36
@jctanner jctanner changed the title Tests pulpectomy [WIP] Tests pulpectomy Feb 21, 2024
@jctanner jctanner changed the title [WIP] Tests pulpectomy [WIP] testing playbooks Feb 21, 2024
No-Issue

Signed-off-by: James Tanner <[email protected]>
@jctanner jctanner changed the title [WIP] testing playbooks playbooks for CI checks, units and functional tests Feb 27, 2024
@jctanner jctanner marked this pull request as ready for review February 27, 2024 22:19
@jctanner
Copy link
Collaborator Author

/retest

No-Issue

Signed-off-by: James Tanner <[email protected]>
@himdel
Copy link
Collaborator

himdel commented Feb 28, 2024

Guessing this has some dependencies?

~/galaxy_ng$ dev/playbooks/RUNALL.sh 
dev/playbooks/RUNALL.sh: line 5: docker-killall: command not found

Also, how will this interact with a running oci-env on the same machine?

@jctanner
Copy link
Collaborator Author

@himdel that's just a helper script i run locally that i didn't mean to commit

@himdel
Copy link
Collaborator

himdel commented Feb 28, 2024

Ah :) but the intended way to run this is still

cd dev/playbooks
ANSIBLE="ansible-playbook -i 'localhost,' --forks=1 -vvvv"
$ANSIBLE build_container.yaml
$ANSIBLE start_container.yaml
$ANSIBLE run_unit_tests.yaml

?

build_container fails for me...

TASK [Build pulp image] ********************************************************
task path: /home/himdel/galaxy_ng/dev/playbooks/build_container.yaml:28
error checking context: no permission to read from '/home/himdel/.local/share/containers/storage/vfs/dir/1183ed2bc46f217d716f66eba51a744c1f92ebd202537314f2bfcf1ee1dc6da7/etc/gshadow'
fatal: [localhost]: FAILED! => {
    "changed": false,
    "error": "Command 'docker build --network host --no-cache=False -t pulp:ci_build -f /home/himdel/galaxy_ng/dev/playbooks//cache/Containerfile ../../..' returned non-zero exit status 1.",
    "msg": "Command execution failed"
}

PLAY RECAP *********************************************************************
localhost                  : ok=4    changed=4    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

(

$ ls -l /home/himdel/.local/share/containers/storage/vfs/dir/1183ed2bc46f217d716f66eba51a744c1f92ebd202537314f2bfcf1ee1dc6da7/etc/gshadow
---------- 1 himdel himdel 327 Sep 11 04:50 /home/himdel/.local/share/containers/storage/vfs/dir/1183ed2bc46f217d716f66eba51a744c1f92ebd202537314f2bfcf1ee1dc6da7/etc/gshadow

🤷
)

EDIT: moving galaxy_ng to ~/src worked

@jctanner
Copy link
Collaborator Author

jctanner commented Feb 28, 2024

@himdel try nesting the checkout under a directory like /home/himdel/src/ ...

The mount config for the container is going to mount the parent directory of the galaxy_ng checkout to /src inside the container so that it can do editable installs of adjacent projects.

In your case I think it's blowing up because it's trying to bind mount /home/himdel

Copy link
Collaborator

@himdel himdel left a comment

Choose a reason for hiding this comment

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

Works for me 👍

mkdir ~/src
cd ~/src
git clone [email protected]:ansible/galaxy_ng.git
cd galaxy_ng/
# git fetch origin pull/2079/head && git checkout FETCH_HEAD && git checkout -b pr2079
cd dev/playbooks/
ANSIBLE="ansible-playbook -i 'localhost,' --forks=1 -vvvv"
$ANSIBLE build_container.yaml
$ANSIBLE start_container.yaml
$ANSIBLE run_unit_tests.yaml
=========== 177 passed, 25 skipped, 11 warnings in 84.25s (0:01:24) ============

Copy link
Contributor

@bmclaughlin bmclaughlin left a comment

Choose a reason for hiding this comment

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

Looks good to me. 👍

Unit tests:
=========== 179 passed, 25 skipped, 11 warnings in 73.25s (0:01:13) ============

Functional tests:
============ 7 passed, 2 skipped, 242 warnings in 90.62s (0:01:30) =============

@jctanner jctanner merged commit cecd099 into ansible:master Feb 28, 2024
21 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants