stacklok / frizbee

Throw a tag at and it comes back with a checksum.
Apache License 2.0
56 stars 17 forks source link

Add support for GitLab #151

Open dirsigler opened 3 weeks ago

dirsigler commented 3 weeks ago

Please describe the enhancement

I would look forward if Frizbee could support GitLab .gitlab-ci.yml files. There two options which would benefit from the support are:

Job Images: Here we declare a Container Image and its version tag (e.g. latest, v4.2.0).

Includes and CI/CD Components: Here we declare a CI/CD Component, essentially a pre-defined job which should be run in the project and it's version

Solution Proposal

Frizbee should be able to look into .gitlab-ci.yml files and provide the checksum for declared Job images and included components.

Describe alternatives you've considered

Not supporting it?!

Additional context

No response

Acceptance Criteria

I am not sure about how much more difficult the support for includes are, therefore I would consider this feature done if GitLab Job images can be supported.

rdimitrov commented 3 weeks ago

hey @dirsigler, thanks for reaching out! 🙏

If I'm not mistaken the 1st part should already work with frizbee since it's similar to what is used in docker-compose files and such. Can you try it against your typical gitlab-ci.yml files and share your feedback?

I've tried the following -

default:
  image: ruby:3.0

rspec:
  script: bundle exec rspec

rspec 2.7:
  image: registry.example.com/my-group/my-project/ruby:2.7
  script: bundle exec rspec

and Frizbee produced the following -

default:
  image: index.docker.io/library/ruby@sha256:dcb8a8a6ee981f949da505cb9f4f15cde696e7bcb088955bc1f92f23a4cd7a72 # 3.0

rspec:
  script: bundle exec rspec

rspec 2.7:
  image: registry.example.com/my-group/my-project/ruby:2.7
  script: bundle exec rspec

which seems to make sense since the rspec 2.7 example is for a fake registry so it's okay to stay like that.

The 2nd part though is something that we don't support yet, but it should be possible 👍 Thanks for bringing this up!

dirsigler commented 3 weeks ago

Hey @rdimitrov , thanks for the quick response. You are right, it works fine on my .gitlab-ci.yml for the job:image spec.

Then I think the CLI helper flags or at least the documentation could need some updates, because it seems (to me) like the heavy focus here relies on GitHub Actions support. I think a clear section about the support of GitLab (and probably other widely used platforms?) could attract more users.