Issue #6047
closedStory #5762: [Epic] CI Improvements
ansible-pulp CI builds "creates" the base molecule container images for every run
Description
Every time ansible-pulp's CI is run, 3 container images (fedora, centos, etc) are created according to molecule/default/Dockerfile.j2. The actual roles get tested against them in each scenario. (the image is not re-built for every scenario fortunately.)
molecule_local/fedora 31
molecule_local/debian buster
molecule_local/centos 7
This takes up time, and could be optimized by building it according to a travis cronjob, and when a PR is opened that actually modifies the Dockerfile.j2. And then pushing it to quay.io.
In order to only build the image in a PR that actually modifies the Dockerfile.j2, some logic will need to be figured out. Like a tag based on the hashsum of the Dockerfile.j2 rather than just using "latest". This could be done in scripted commands if molecule cannot be configured to use a different image name. (e.g, retag molecule_local/centos:7 as quay.io/pulp/pulp-ci-molecule-centos:7-<7-digit-hash> after it is built, and push it to quay.io. And at the beginning of the run, check if the latter name exists and can be pulled, and if so, pull it and then re-tag it as the former name.)
Prebuilding molecule images
https://pulp.plan.io/issues/6047 closes #6047