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
ansible-test - add a --docker-pull-only
option that pulls down the required images but doesn't execute the tests
#75320
Comments
Files identified in the description: If these files are incorrect, please update the |
|
GitHub Actions also apparently support Docker Caching, though I'm not sure if that's only per run, or per repo. You can see how often the Docker images are updated by looking at the change history of https://github.com/ansible/ansible/commits/devel/test/lib/ansible_test/_data/completion/docker.txt |
@gundalow I have recently looked at using the "Docker Layer Caching" action: https://github.com/marketplace/actions/docker-layer-caching It's a neat idea, and in theory, exactly what I'd want to do. Unfortunately in practice, it was a complete failure. Both restoring and populating the cache took WAY longer than just pulling. Where an Ansible 2.9 pull of the default image (which is much bigger in 2.9) could take up to 2 minutes, the caching thing replaced that with about 8 minutes of time, much of which was concurrency blocking, overloading the cache service, and retries, and sometimes it timed out. The available generic caching action is something I am considering trying myself for this use case (using In fact, that experiment is what made me look at separating out the pull, so that I can measure the differences and ROI of any specific thing that's aimed at reducing the pull time (I have other ideas, at different levels, which I could go into in this ticket or via a separate conversation). So this request is currently more scoped down to separating the pull. There's an internal function for performing the pull; it's based on the arguments sent in, which is great. The reasons I'm not using it in my workaround script above is because I didn't see it until later, and because I didn't (yet) want to duplicate the args, pass them into my action, and figure out how to get them parsed to pass into that function. Since my workaround uses internal code, it'll be prone to break, and it'd be much nicer as an CLI argument, and I think easy to implement as it introduces almost nothing new internally except mapping the CLI option to that existing pull function (I may be missing important context though). Also I probably need my workaround for a while longer, depending on whether this would get backported. to 2.11/2.10 (and I'd need a workaround for 2.9 still anyway). But it'd be nice going forward! |
Resolves ansible#75320 The option `--prime-containers` was chosen over `--docker-pull-only` to match the recently added `--prime-venvs` option for sanity tests. It would also fit well with a future `--prime-requirements` option for pre-installing requirements for unit and integration tests.
Resolves #75320 The option `--prime-containers` was chosen over `--docker-pull-only` to match the recently added `--prime-venvs` option for sanity tests. It would also fit well with a future `--prime-requirements` option for pre-installing requirements for unit and integration tests.
Summary
What
Looking for an option to
ansible-test
that will pull down the docker image(s) required, based on the options you've given, but not actually run the tests. Examples:Why?
My primary reason
In CI, I'm trying to separate the time it takes for tests to run (which includes other setup or preparation that
ansible-test
does), from the time taken to pull the test images, which is quite significant.On a local machine you're re-using the pulled image but in CI you're bearing the cost every time, and I want to see those separately.
This isn't easily achievable outside of
ansible-test
because the exact image tags pulled are part of theansible-test
code, and in some cases depend on the options chosen (like whether or not to pull the pypi proxy image).Secondary reason
For those on slow connections, being surprised by a new image after a pull of devel or something can result in painfully long times to pull, and it would be nice to be allow those on slow connections to schedule pull-only runs to keep their local images up-to-date.
Workarounds
I'm adding this into
community.hashi_vault
's CI by way of a Python script step in a custom GitHub Action that imports some private stuff. It doesn't handle pypi proxy either, though that's less of a concern due to its size at the moment: https://github.com/ansible-collections/community.hashi_vault/blob/main/.github/actions/pull-ansible-test-images/action.ymlAlso here's the current state of the python for easier viewing (since it's embedded in YAML in the action):
Issue Type
Feature Idea
Component Name
ansible-test
Additional Information
see description
Code of Conduct
The text was updated successfully, but these errors were encountered: