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

GitLab CI yaml includes custom tags that cannot be resolved by from_yaml #200

Open
haboustak opened this issue Feb 20, 2023 · 2 comments
Open
Labels
enhancement gitlab-ci Issues related to compatibility with .gitlab-ci.yml help wanted

Comments

@haboustak
Copy link
Contributor

GitLab has added a custom yaml tag: !reference. This tag copies content from another path within the yaml document. The example use cases are to reuse script blocks in other CI jobs. Implementation in ruby is here: lib/gitlab/ci/config/yaml/tags/reference.rb

I've created an example project based on the above documentation.

It seems appropriate to create a !from_gitlab custom tag to load GitLab-specific yaml syntax. This would use a SafeLoader with support for !reference initially. It would also provide a place for scuba to support some or all of GitLab's include syntax.

Sample .gitlab-ci.yml

stages:
  - build

.before:
  script:
    - echo "ABCD"

build:
  stage: build
  script:
    - !reference [.before, script]
    - echo "after ABCD completes"
@haboustak
Copy link
Contributor Author

Two other GitLab-flavored yaml extensions from my recent memory that would be nice to have some level of some scuba support:

  1. They build compound yaml documents using the includes keyword
  2. They have replaced yaml anchors with the extends keyword

These extensions may be unreasonable to support within GitlabYamlLoader, but a warning from scuba would be nice. For example:

WARN: GitLabYamlLoader: Loading content from .gitlab-ci.yml with unsupported includes keyword.

@JonathonReinhart
Copy link
Owner

I think this all sounds great. I'm all for a !from_gitlab (!from_gitlab_ci_yaml or !from_gitlab_ci might be a bit too long).

@JonathonReinhart JonathonReinhart added the gitlab-ci Issues related to compatibility with .gitlab-ci.yml label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement gitlab-ci Issues related to compatibility with .gitlab-ci.yml help wanted
Projects
None yet
Development

No branches or pull requests

2 participants