openrewrite / rewrite-gitlab

OpenRewrite recipes for GitLab.
Apache License 2.0
0 stars 1 forks source link

Support for GitLab CI/CD Components #1

Open scuba10steve opened 2 months ago

scuba10steve commented 2 months ago

What problem are you trying to solve?

For reference, here's a blog post that announced CI / CD components becoming generally available.

Having the ability to translate from the older style template inclusion to components would be helpful.

Example for migration: opentofu template -> opentofu component

What precondition(s) should be checked before applying this recipe?

Describe the situation before applying the recipe

This is not an extensive example, just a snippet

include:
  - template: OpenTofu/Base.latest.gitlab-ci.yml

Describe the situation after applying the recipe

include:
  - component: $CI_SERVER_FQDN/components/opentofu/job-templates@~latest
    inputs:
      # The version must currently be specified explicitly as an input,
      # to find the correctly associated images. # This can be removed
      # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
      version: ~latest
      opentofu_version: 1.6.0

Have you considered any alternatives or workarounds?

Only alternative is to follow the aformentioned migration guide(s) that may or may not be available

Are you interested in contributing this recipe to OpenRewrite?

Yes, I would be interested in helping contribute this recipe.

timtebeek commented 2 months ago

Great to see; MergeYaml should be able to help you here; here's a video going in depth on that topic: https://www.youtube.com/watch?v=MRHHGxh4rdU