Skip to content

Commit

Permalink
fix: add yaml anchor/fragments support
Browse files Browse the repository at this point in the history
ref: #39
  • Loading branch information
zavoloklom committed Oct 26, 2024
1 parent 98d2f92 commit 4d9826f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/linter/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DCLinter {

try {
context.sourceCode = fs.readFileSync(file, 'utf8');
const doc = parseDocument(context.sourceCode);
const doc = parseDocument(context.sourceCode, { merge: true });

if (doc.errors && doc.errors.length > 0) {
doc.errors.forEach((error) => {
Expand Down
22 changes: 22 additions & 0 deletions tests/mocks/docker-compose.anchors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: fragment-example
x-shared-links: &shared-links
links:
- "foo:foo.example.svc.cluster.local"
- "bar:bar.example.svc.cluster.local"
x-shared-image: &shared-image
image: traefik/whoami
x-shared-ports: &shared-ports
- '81'
- '80:80'
services:
app_bar:
image: traefik/whoami
<<: *shared-links
app_foo:
<<: *shared-links
image: traefik/whoami:v1.10
bar:
<<: *shared-image
ports: *shared-ports
foo:
<<: [*shared-image, *shared-links]

0 comments on commit 4d9826f

Please sign in to comment.