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

Image scanning script logic is duplicated #1036

Closed
Tracked by #1032
kimwnasptd opened this issue Aug 23, 2024 · 3 comments · Fixed by #1038
Closed
Tracked by #1032

Image scanning script logic is duplicated #1036

kimwnasptd opened this issue Aug 23, 2024 · 3 comments · Fixed by #1038
Labels
bug Something isn't working

Comments

@kimwnasptd
Copy link
Contributor

kimwnasptd commented Aug 23, 2024

Bug Description

This is part of #1032

Right now we have and use logic for gathering images for a bundle in 2 different places:

  1. In the scanning action, which is using kubeflow-ci
  2. In the airgap scripts

This creates duplication of logic while in the end we should have one script for the logic.

The main difference is that the airgap script will need to add some extra charms/images. But this could be easily added as some specialised logic with an --airgap flag to the same script

To Reproduce

Run the action for scanning and the airgap scripts

Environment

current main https://github.com/canonical/bundle-kubeflow/tree/b2269189231aea9a1c594def3bd92549ebb3ee0d

Relevant Log Output

<none>

Additional Context

No response

@kimwnasptd kimwnasptd added the bug Something isn't working label Aug 23, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-6146.

This message was autogenerated

@kimwnasptd
Copy link
Contributor Author

The script also is written in bash, and without set -xe #1030, which results in a lot of errors to get masked.

The common script should be converted to Python to make sure it's maintainable in the long run and has good programming practices.

@kimwnasptd
Copy link
Contributor Author

kimwnasptd commented Aug 23, 2024

Writing here the main flow of the logic for gathering all the images. The main point to keep in mind is that the input to the scripts is a bundle file and this bundle can include both charms that are owned by the Analytics team and from other teams (i.e. MySQL).

Then the flow of the script looks like the following:

  1. For each application in the provided bundle.yaml file:
  2. detect if it's owned by us or another team (by looking at the _github_dependency_repo_name and such metadata)
  3. clone its repo, by looking at _github_repo_name and such metadata
  4. If owned by another team: only parse it's metadata.yaml and look for oci-resources
  5. If owned by us: run the tools/get-images.sh script the repo must have
  6. If a repo does not have tools/get-images.sh (i.e. kubeflow-roles) then the script should skip the repo
  7. If the get-images.sh script either fails (return code non zero) or has error logs then the script should fail
  8. Aggregate the outputs of all get-images.sh scripts to one output
  9. If user passed an argument --append-images then the script will amend a list of images we need for airgap testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant