possibility to skip Generate mirror-manifest in mirror_case_prepare role
Issue: once the manifest files have been create in /manifests/direct and /manifests/to-filesystem, there imay be no need to generate those again if the role is executed again with the same parameters.
the issue is that oc ibm-pak get command connects to github, in a restricted environment it may require approval and theefore if the manifest are alredy present locally, this is not necessary to mirror.
the request is to add a parameter to the role to be able to skip the tasks that use oc ibm-pak in https://github.com/ibm-mas/ansible-devops/blob/master/ibm/mas_devops/roles/mirror_case_prepare/tasks/prepare-released.yml
Yes, we did in fact face this issue while installing MAS in a client's restricted environment with limited access to GitHub.
I'd suggest either an option or flag to disable case downloads when running "mas mirror-images" using the MAS CLI tool; similar to the --case-download=false flag in the Cloud Pak for Data cpd-cli for example) OR the CLI could check locally if the cases are already downloaded and skip this step instead of trying to contact the GitHub Repo every time.
It's not as straightforward as it seems, but we should be able to do this:
We know that the goal is to generate 3 manifests:
{{ mirror_working_dir }}/manifests/direct/{{ case_name }}_{{ _manifest_version }}.txt{{ mirror_working_dir }}/manifests/from-filesystem/{{ case_name }}_{{ _manifest_version }}.txt{{ mirror_working_dir }}/manifests/to-filesystem/{{ case_name }}_{{ _manifest_version }}.txt
First, we add a new mirror_case_clean parameter that will force the current behaviour where we overwrite anything already there and we add a check that if that flag isn't set then we will just skip the prep.
However, these are not templated manifests, inside the direct and from-filesystem manifests are the actual target registry, which means they are not reusable, which goes against the goals here (and also is a long standing thing we wanted to fix).
This prepare stage should no longer ask for, or use, the registry_public_host, registry_public_port parameters, and instead of generating direct/{{ case_name }}_{{ _manifest_version }}.txt and from-filesystem/{{ case_name }}_{{ _manifest_version }}.txt it should generate a jinja template for each (.txt.j2) which contains placeholders as if the target reigstry is actually called {{ registry_public_host }}:{{registry_public_port }}.
Then, the mirror command becomes the only role that needs to know where we are sending the images, and it will convert the .txt.j2 template into the .txt.
The result is that I can now do this:
- prepare (once)
- mirror to registry 1
- mirror to registry 2 (using same content I prepared before running the mirroring to registry 1)