-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from SublimeText/aws_templates
initial support for AWS templates
- Loading branch information
Showing
4 changed files
with
170 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
%YAML 1.2 | ||
--- | ||
name: AWS YAML Template | ||
scope: source.yaml.pipeline.aws | ||
version: 2 | ||
|
||
extends: Packages/YamlPipelines/YamlPipeline.sublime-syntax | ||
|
||
file_extensions: | ||
- cron.yaml | ||
- fargate.yaml | ||
- predeploy.yaml | ||
|
||
first_line_match: '^AWSTemplateFormatVersion:' | ||
|
||
variables: | ||
variable_interpolation: |- | ||
(?x)(?: | ||
(\$\{)((?:AWS::)?\w+)(\}) | ||
) | ||
contexts: | ||
flow-scalar-plain-out-body: | ||
- meta_prepend: true | ||
- include: variable-interpolation | ||
|
||
flow-scalar-single-quoted-body: | ||
- meta_prepend: true | ||
- include: variable-interpolation | ||
|
||
flow-scalar-double-quoted-body: | ||
- meta_prepend: true | ||
- include: variable-interpolation | ||
|
||
variable-interpolation: | ||
- match: '{{variable_interpolation}}' | ||
captures: | ||
1: punctuation.section.interpolation.begin.aws | ||
2: variable.other.constant.aws | ||
3: punctuation.section.interpolation.end.aws | ||
|
||
node: | ||
- meta_prepend: true | ||
- match: ^(\s+)(Command)\s*(:)(?=\s|$) | ||
captures: | ||
2: string.unquoted.plain.out.yaml keyword.control.flow.script.pipeline | ||
3: punctuation.separator.key-value.yaml | ||
push: script-block-sequence | ||
|
||
script-block-sequence: | ||
- match: |- | ||
(?x)^(\s+)(-)[ \t]+(?="CMD-SHELL"|'CMD-SHELL'|CMD-SHELL\b) | ||
(["'])? | ||
(CMD-SHELL) | ||
(["'])? | ||
captures: | ||
2: punctuation.definition.block.sequence.item.yaml | ||
3: punctuation.definition.string.begin.yaml | ||
4: variable.language.aws | ||
5: punctuation.definition.string.end.yaml | ||
set: | ||
- expect-script-block-node | ||
- pop-at-bol | ||
- include: expect-script-block-node | ||
|
||
pop-if-not-sequence-at-same-or-deeper-indentation: | ||
- match: ^(?!\1\s*-) | ||
pop: 1 | ||
|
||
pop-at-bol: | ||
- match: ^ | ||
pop: 1 | ||
|
||
expect-script-block-node: | ||
- match: (-)[ \t]+(?=\S)(["'])? | ||
captures: | ||
1: punctuation.definition.block.sequence.item.yaml | ||
2: punctuation.definition.string.begin.yaml | ||
push: script-block-node | ||
- include: pop-if-not-sequence-at-same-or-deeper-indentation | ||
|
||
script-block-node: | ||
- meta_prepend: true | ||
- include: flow-alias | ||
- match: '{{_flow_scalar_end_plain_out}}' | ||
pop: 1 | ||
|
||
embedded-bash: | ||
- meta_include_prototype: false | ||
- meta_scope: source.shell.bash.embedded | ||
- include: scope:source.shell.bash.aws | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
%YAML 1.2 | ||
--- | ||
# See http://www.sublimetext.com/docs/3/syntax.html | ||
scope: source.shell.bash.aws | ||
version: 2 | ||
hidden: true | ||
|
||
extends: Packages/ShellScript/Bash.sublime-syntax | ||
|
||
# NOTE: this syntax is designed to handle YAML sequence delimited Bash | ||
|
||
contexts: | ||
prototype: | ||
- meta_prepend: true | ||
- match: ^\s*(-)[ \t]+(?=\S)(["'])? | ||
captures: | ||
1: punctuation.definition.block.sequence.item.yaml | ||
2: punctuation.definition.string.begin.yaml | ||
- match: (["'])$ | ||
captures: | ||
1: punctuation.definition.string.end.yaml | ||
|
||
variables: | ||
# lazy escaping from heredoc as shell maybe indented | ||
no_indent: ^\s* | ||
tab_indent: ^\s* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Yaml Pipelines for Sublime Text | ||
|
||
Syntax highlighting definitions for YAML pipeline files, like GitHub Actions and AzureDevops, Drone CI, GitLab CICD etc. | ||
Syntax highlighting definitions for YAML pipeline files, like GitHub Actions and AzureDevops, Drone CI, GitLab CICD, AWS templates etc. | ||
Includes a small plugin to automatically apply the GitHub Actions filetype when loading or saving a YAML file in a `.github/workflows` folder. | ||
|
||
Why not just use the default YAML syntax definition? Because it doesn't highlight conditions, variables or embedded Bash or PowerShell scripts! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# SYNTAX TEST "Packages/YamlPipelines/AWSTemplate.sublime-syntax" | ||
|
||
Resources: | ||
SomeTask: | ||
Properties: | ||
ContainerDefinitions: | ||
- Name: "some_name" | ||
Image: !Sub "${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/some_path:${DockerImageVersion}" | ||
# ^^ meta.string.yaml string.quoted.double.yaml punctuation.section.interpolation.begin.aws | ||
# ^^^^^^^^^^^^^^ meta.string.yaml string.quoted.double.yaml variable.other.constant.aws | ||
# ^ meta.string.yaml string.quoted.double.yaml punctuation.section.interpolation.end.aws | ||
Command: | ||
# ^^^^^^^ string.unquoted.plain.out.yaml keyword.control.flow.script.pipeline | ||
# ^ punctuation.separator.key-value.yaml | ||
- "bin/console" | ||
# ^ meta.block.script.pipeline punctuation.definition.block.sequence.item.yaml | ||
# ^ meta.block.script.pipeline punctuation.definition.string.begin.yaml - source.shell | ||
# ^^^^^^^^^^^ source.shell.bash.embedded meta.function-call.identifier.shell variable.function.shell | ||
# ^ source.shell.bash.embedded meta.function-call.identifier.shell punctuation.definition.string.end.yaml | ||
- "messenger:consume" | ||
- "--quiet" | ||
- "--memory-limit=120M" | ||
- "clearing-payouts-executed" | ||
- "--no-debug" | ||
Cpu: 128 | ||
MemoryReservation: 256 | ||
HealthCheck: | ||
Command: | ||
# ^^^^^^^ string.unquoted.plain.out.yaml keyword.control.flow.script.pipeline | ||
# ^ punctuation.separator.key-value.yaml | ||
- "CMD-SHELL" | ||
# ^ punctuation.definition.block.sequence.item.yaml | ||
# ^ punctuation.definition.string.begin.yaml | ||
# ^^^^^^^^^ variable.language.aws | ||
# ^ punctuation.definition.string.end.yaml | ||
- "agent health || exit 1" | ||
# ^ meta.block.script.pipeline punctuation.definition.block.sequence.item.yaml | ||
# ^ meta.block.script.pipeline punctuation.definition.string.begin.yaml | ||
# ^^^^^ source.shell.bash.embedded meta.function-call.identifier.shell variable.function.shell | ||
# ^^^^^^ source.shell.bash.embedded meta.function-call.arguments.shell | ||
# ^^ source.shell.bash.embedded keyword.operator.logical.shell | ||
# ^^^^ source.shell.bash.embedded keyword.control.flow.exit.shell | ||
# ^ source.shell.bash.embedded meta.number.integer.decimal.shell constant.numeric.value.shell | ||
# ^ source.shell.bash.embedded punctuation.definition.string.end.yaml | ||
Timeout: 5 | ||
# ^^^^^^^ meta.mapping.key.yaml meta.string.yaml string.unquoted.plain.out.yaml - source.shell | ||
# ^ meta.mapping.yaml punctuation.separator.key-value.mapping.yaml | ||
Interval: 30 | ||
StartPeriod: 15 | ||
Retries: 3 |