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

possibility to skip Generate mirror-manifest in mirror_case_prepare role #1318

Open
mattlrx opened this issue May 24, 2024 · 2 comments
Open
Labels
Air Gap Issue related to air gap support Enhancement New feature or request High Priority High priority issue that should be addressed ASAP

Comments

@mattlrx
Copy link
Contributor

mattlrx commented May 24, 2024

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

@amoussa99
Copy link

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.

@durera
Copy link
Contributor

durera commented Aug 23, 2024

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)

@durera durera added Enhancement New feature or request Air Gap Issue related to air gap support High Priority High priority issue that should be addressed ASAP labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Air Gap Issue related to air gap support Enhancement New feature or request High Priority High priority issue that should be addressed ASAP
Projects
None yet
Development

No branches or pull requests

3 participants