Skip to content
Snippets Groups Projects
Unverified Commit b1ffc66d authored by Mikko Piuhola's avatar Mikko Piuhola Committed by GitHub
Browse files

fix(manager/gitlabci): support multi-line !reference tags (#21896)

parent 64e50399
No related branches found
No related tags found
No related merge requests found
test:
script:
- !reference [.setup, script]
- !reference [arbitrary job name with space and no starting dot, nested1, nested2, nested3]
- !reference [
.multiline,
reference,
]
- !reference [
.another, multilineref
]
import { Fixtures } from '../../../../test/fixtures';
import type { PackageDependency } from '../types'; import type { PackageDependency } from '../types';
import { getGitlabDep } from './utils'; import { getGitlabDep, replaceReferenceTags } from './utils';
describe('modules/manager/gitlabci/utils', () => { describe('modules/manager/gitlabci/utils', () => {
describe('getGitlabDep', () => { describe('getGitlabDep', () => {
...@@ -81,4 +82,12 @@ describe('modules/manager/gitlabci/utils', () => { ...@@ -81,4 +82,12 @@ describe('modules/manager/gitlabci/utils', () => {
}); });
}); });
}); });
describe('replaceReferenceTags', () => {
it('replaces all !reference tags with empty strings', () => {
const yamlFileReferenceConfig = Fixtures.get('gitlab-ci.reference.yaml');
const replaced = replaceReferenceTags(yamlFileReferenceConfig);
expect(replaced).not.toContain('!reference');
});
});
}); });
...@@ -2,7 +2,7 @@ import { regEx } from '../../../util/regex'; ...@@ -2,7 +2,7 @@ import { regEx } from '../../../util/regex';
import { getDep } from '../dockerfile/extract'; import { getDep } from '../dockerfile/extract';
import type { PackageDependency } from '../types'; import type { PackageDependency } from '../types';
const re = /!reference \[(.*?)\]/g; const re = /!reference \[[^\]]+\]/g;
/** /**
* Replaces GitLab reference tags before parsing, because our yaml parser cannot process them anyway. * Replaces GitLab reference tags before parsing, because our yaml parser cannot process them anyway.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment