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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Gitlab CICD.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,45 @@ contexts:
- meta_include_prototype: false
- meta_scope: source.shell.bash.embedded
- include: scope:source.shell.bash.folded

property:
- meta_prepend: true
- match: (!reference)\s*(\[)
captures:
1: meta.property.yaml storage.type.tag-handle.yaml
2: meta.sequence.flow.yaml punctuation.definition.sequence.begin.yaml
push: gitlab-reference-flow-sequence-body

gitlab-reference-flow-sequence-body:
- meta_content_scope: meta.sequence.flow.yaml
- match: \]
scope: meta.sequence.flow.yaml punctuation.definition.sequence.end.yaml
pop: 1
- match: ','
scope: punctuation.separator.sequence.yaml
push: gitlab-after-reference
- match: '[-\w.]+'
scope: constant.other.label.gitlab
- include: flow-pair-no-clear
- include: flow-node-11

gitlab-after-reference:
- match: \w+
scope: keyword.other.gitlab
- match: ','
scope: punctuation.separator.sequence.yaml
set: gitlab-after-reference-type
- include: flow-pair-no-clear
- include: flow-node-11
- match: (?=\])
pop: 1
FichteFoll marked this conversation as resolved.
Show resolved Hide resolved

gitlab-after-reference-type:
- match: \w+
scope: variable.other.constant.gitlab
- match: ','
scope: punctuation.separator.sequence.yaml
- include: flow-pair-no-clear
- include: flow-node-11
- match: (?=\S)
pop: 1
69 changes: 69 additions & 0 deletions tests/syntax_test_gitlab_cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,72 @@ release-finish:
# ^^^^^^^^^^^^^^^^ meta.string
# ^^^^^^^^^^^ meta.interpolation.parameter variable.other.readwrite
-DskipTestProject=true

include:
- local: setup.yml

.teardown:
after_script:
- echo deleting environment

test:
script:
- !reference [.setup, script]
# ^ punctuation.definition.block.sequence.item
# ^^^^^^^^^^ meta.property storage.type.tag-handle
# ^^^^^^^^^^^^^^^^ meta.sequence.flow
# ^ punctuation.definition.sequence.begin
# ^^^^^^ constant.other.label
# ^ punctuation.separator.sequence
# ^^^^^^ keyword.other
# ^ punctuation.definition.sequence.end
# ^ - meta.sequence
- echo running my own command
# ^ meta.block.script punctuation.definition.block.sequence.item
# ^^^^ source.shell.bash meta.function-call.identifier support.function.echo
after_script:
- !reference [.teardown, after_script]

.vars:
variables:
URL: "http://my-url.internal"
IMPORTANT_VAR: "the details"

test-vars-1:
variables: !reference [.vars, variables]
script:
- printenv

test-vars-2:
variables:
MY_VAR: !reference [.vars, variables, IMPORTANT_VAR]
# ^^^^^^^^^^ meta.property storage.type.tag-handle
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.flow
# ^ punctuation.definition.sequence.begin
# ^^^^^ constant.other.label
# ^ punctuation.separator.sequence
# ^^^^^^^^^ keyword.other
# ^ punctuation.separator.sequence
# ^^^^^^^^^^^^^ variable.other.constant
script:
- printenv

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

job2:
artifacts:
paths: !reference [job1, artifacts, paths, further_nesting]
# ^^^^^^^^^^ meta.property storage.type.tag-handle
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.flow
# ^^^^ constant.other.label
# ^ punctuation.separator.sequence
# ^^^^^^^^^ keyword.other
# ^ punctuation.separator.sequence
# ^^^^^ variable.other.constant
# ^ punctuation.separator.sequence
# ^^^^^^^^^^^^^^^ variable.other.constant
# ^ punctuation.definition.sequence.end
Loading