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

Support GitLab references #24

Merged
merged 4 commits into from
Jun 10, 2024
Merged

Support GitLab references #24

merged 4 commits into from
Jun 10, 2024

Conversation

keith-hall
Copy link
Member

fixes #18

not sure about scopes though - I consider the first sequence item to be a reference to a label, like a goto in programming languages. The second item is like the type of reference, and the third a specific identifier to reference.

@deathaxe
Copy link
Member

The sequence just denotes a path to an item in the object model (like xpath for yaml).

!reference ["job-label", "job-keyword", "variable"]

1st item is the job label or one of the special labels variable, include, ... (see: https://docs.gitlab.com/ee/ci/jobs/#job-name-limitations). => constant.other.label seems suitable.

2nd item represents a job-keyword, like variable, script or any other valid one.

3rd item may be variable, but can probably also be something like an artefact definition (see: https://docs.gitlab.com/ee/ci/yaml/index.html#artifactspaths)

job1:
  artifacts:
    paths:
      - binaries/
      - .config

job2:
  artefacts:
    paths: !reference ["job1", "artefacts", "paths"]

Therefore maybe just treat it as a list of constants without interpreting kind of item - at least on of item 3.

@FichteFoll
Copy link
Member

I also wouldn't put too much thought into the scope names of the reference segments since they are just … references to any other block in the pipeline and may use arbitrary names.

Copy link
Member

@FichteFoll FichteFoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not clear on the scope names (especially how there are three different scopes for the first three elements and then it's back to the first?), but let's roll with it for now and see how it fares in practice.

Edit: I guess a quick improvement would be to allow the third kind to match an arbitrary amount of times instead of just once and then poping.

Gitlab CICD.sublime-syntax Show resolved Hide resolved
Gitlab CICD.sublime-syntax Outdated Show resolved Hide resolved
@keith-hall keith-hall merged commit 37276bd into master Jun 10, 2024
4 checks passed
@keith-hall keith-hall deleted the gitlab_references branch June 10, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle GitLab's !reference custom tag
3 participants