Skip to content
Snippets Groups Projects
Unverified Commit 038f52c0 authored by Tyrone Meijn's avatar Tyrone Meijn Committed by GitHub
Browse files

fix(gitlabci): filter out !reference tags in gitlabci-include (#9741)

parent 135875d1
Branches
No related tags found
No related merge requests found
...@@ -7,3 +7,7 @@ include: ...@@ -7,3 +7,7 @@ include:
ref: master ref: master
- {"project":"mikebryant/include-source-example3", "file": "/template.yaml",} - {"project":"mikebryant/include-source-example3", "file": "/template.yaml",}
- {} - {}
script:
- !reference [.setup, script]
- !reference [arbitrary job name with space and no starting dot, nested1, nested2, nested3]
...@@ -3,6 +3,7 @@ import yaml from 'js-yaml'; ...@@ -3,6 +3,7 @@ import yaml from 'js-yaml';
import * as datasourceGitlabTags from '../../datasource/gitlab-tags'; import * as datasourceGitlabTags from '../../datasource/gitlab-tags';
import { logger } from '../../logger'; import { logger } from '../../logger';
import { SkipReason } from '../../types'; import { SkipReason } from '../../types';
import { replaceReferenceTags } from '../gitlabci/utils';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types';
function extractDepFromIncludeFile(includeObj: { function extractDepFromIncludeFile(includeObj: {
...@@ -31,7 +32,9 @@ export function extractPackageFile( ...@@ -31,7 +32,9 @@ export function extractPackageFile(
const deps: PackageDependency[] = []; const deps: PackageDependency[] = [];
try { try {
// TODO: fix me (#9610) // TODO: fix me (#9610)
const doc = yaml.safeLoad(content, { json: true }) as any; const doc = yaml.safeLoad(replaceReferenceTags(content), {
json: true,
}) as any;
if (doc?.include && is.array(doc.include)) { if (doc?.include && is.array(doc.include)) {
for (const includeObj of doc.include) { for (const includeObj of doc.include) {
if (includeObj.file && includeObj.project) { if (includeObj.file && includeObj.project) {
......
const re = /!reference \[\.\w+?(?:, \w+?)\]/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.
Please register or to comment