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.yml - Allow !reference keyword #2926

Closed
gone-for-coding opened this issue Apr 25, 2023 · 4 comments
Closed

.gitlab-ci.yml - Allow !reference keyword #2926

gone-for-coding opened this issue Apr 25, 2023 · 4 comments
Labels
issue:bug Report errors or unexpected behavior (auto-generated by issue forms)

Comments

@gone-for-coding
Copy link

Area with issue?

JSON Schema

✔️ Expected Behavior

This code is actually valid:

.common:
  before_script:
    - git config --global credential.helper store

.job:
  before_script:
    - !reference [.common, before_script]

and should be recognized as that.

See here: https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#reference-tags

❌ Actual Behavior

The following error is printed:

Unresolved tag: !reference

YAML or JSON file that does not work.

.common:
  before_script:
    - git config --global credential.helper store

.job:
  before_script:
    - !reference [.common, before_script]

IDE or code editor.

Visual Studio Code

Are you making a PR for this?

No, someone else must create the PR.

@gone-for-coding gone-for-coding added the issue:bug Report errors or unexpected behavior (auto-generated by issue forms) label Apr 25, 2023
@EmilyGraceSeville7cf
Copy link
Contributor

@gone-for-coding, is it what are you looking for?

@gone-for-coding
Copy link
Author

Hi @EmilySeville7cfg
Thanks for your quick reply! That looks promising. Is that something I would need to configure in my setup or can this be included in the schema so that the file lints correctly automatically for everyone?

@EmilyGraceSeville7cf
Copy link
Contributor

Is that something I would need to configure in my setup or can this be included in the schema so that the file lints correctly automatically for everyone?

AFAIK it's the first case.

@gone-for-coding
Copy link
Author

I found out that it is actually already supported and included in the official schema:
https://github.com/SchemaStore/schemastore/blob/master/src/api/json/catalog.json#L1732
https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/editor/schema/ci.json#L29

Then the issue must be somewhere else and not within SchemaStore. Thanks @EmilySeville7cfg !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue:bug Report errors or unexpected behavior (auto-generated by issue forms)
Projects
None yet
Development

No branches or pull requests

2 participants