Skip to content

Commit

Permalink
Scope and index job names in Gitlab CI/CD pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
keith-hall committed Jul 11, 2023
1 parent 0affe07 commit b7f3086
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
11 changes: 8 additions & 3 deletions Gitlab CICD.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ file_extensions:
contexts:
node:
- meta_prepend: true
- match: \s(script)\s*(:)(?=\s|$)
- match: ^\s+(script)\s*(:)(?=\s|$)
captures:
1: string.unquoted.plain.out.yaml keyword.control.flow.script.pipeline
2: punctuation.separator.key-value.yaml
push: script-block-sequence
- match: ^([-\w]+)\s*(:)$
captures:
1: entity.name.label.gitlab
2: punctuation.separator.key-value.yaml

script-block-sequence:
- match: (-)(?!\S)
scope: punctuation.definition.block.sequence.item.yaml
- match: (-)[ \t]+(?=\S)
captures:
1: punctuation.definition.block.sequence.item.yaml
embed: scope:source.shell.bash
escape: '{{_flow_scalar_end_plain_out}}'
- match: (?=\S)
Expand Down
2 changes: 1 addition & 1 deletion Index Labels.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>name</key>
<string>Index Labels</string>
<key>scope</key>
<string>source.yaml.pipeline.github-actions entity.name.label.github-actions</string>
<string>source.yaml.pipeline.github-actions entity.name.label.github-actions, source.yaml.pipeline.gitlab entity.name.label.gitlab</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
Expand Down
10 changes: 10 additions & 0 deletions tests/syntax_test_gitlab_cicd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# SYNTAX TEST "Packages/YamlPipelines/Gitlab CICD.sublime-syntax"
build-job:
# ^^^^^^^ entity.name.label
# ^ punctuation.separator.key-value - entity
stage: build
# ^^^^^^^^^^^^^ - entity
script:
# ^^^^^^ string.unquoted.plain.out keyword.control.flow.script
# ^ punctuation.separator.key-value
Expand All @@ -10,9 +13,16 @@ build-job:

# <- - source.shell
test-job1:
# ^^^^^^^ entity.name.label
# ^ punctuation.separator.key-value - entity
stage: test
script:
# ^^^^^^ string.unquoted.plain.out keyword.control.flow.script
# ^ punctuation.separator.key-value
- echo "This job tests something"
# ^ punctuation.definition.block.sequence.item
#^^^ - punctuation
# ^ - punctuation

test-job2:
stage: test
Expand Down

0 comments on commit b7f3086

Please sign in to comment.