Skip to content

Commit

Permalink
Merge pull request #1051 from wrighbr/main
Browse files Browse the repository at this point in the history
Allow for backstage default mkdocs.yaml
  • Loading branch information
Xantier authored Jul 19, 2023
2 parents 8288897 + 501488a commit d8c2523
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sharp-crabs-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@roadiehq/roadie-backstage-entity-validator': patch
---

Allow for backstage default mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ const validateTechDocs = async (data, filePath) => {
}
const techDocsAnnotation =
data.metadata.annotations['backstage.io/techdocs-ref'];
if (!techDocsAnnotation.includes('dir')) {
if (
!techDocsAnnotation.includes('dir') ||
techDocsAnnotation.match(/^dir:.$/gm)
) {
return;
}

Expand Down
26 changes: 26 additions & 0 deletions utils/roadie-backstage-entity-validator/src/validator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,32 @@ spec:
validator.validateFromFile('invalid-resource-entity.yml'),
).rejects.toThrow();
});
describe('validateDefaultTechDocs', () => {
const defaultVol = {
'./test-entity.yaml': `
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: test-entity
description: |
Foo bar description
annotations:
backstage.io/techdocs-ref: dir:.
spec:
type: service
owner: user:dtuite
lifecycle: experimental
`,
};
describe('default techdocs annotations is set', () => {
it('should use the default mkdocs.yaml', async () => {
vol.fromJSON(defaultVol);
await expect(
validator.validateFromFile('./test-entity.yaml'),
).resolves.toBeUndefined();
});
});
});
describe('validateTechDocs', () => {
const defaultVol = {
'./test-entity.yaml': `
Expand Down

0 comments on commit d8c2523

Please sign in to comment.