Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 8 commits into from Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/manager/gitlabci-include/extract.ts
Expand Up @@ -3,6 +3,7 @@ import yaml from 'js-yaml';
import * as datasourceGitlabTags from '../../datasource/gitlab-tags';
import { logger } from '../../logger';
import { SkipReason } from '../../types';
import { replaceReferenceTags } from '../gitlabci/utils';
import type { ExtractConfig, PackageDependency, PackageFile } from '../types';

function extractDepFromIncludeFile(includeObj: {
Expand Down Expand Up @@ -31,7 +32,9 @@ export function extractPackageFile(
const deps: PackageDependency[] = [];
try {
// 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)) {
for (const includeObj of doc.include) {
if (includeObj.file && includeObj.project) {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/gitlabci/utils.ts
@@ -1,4 +1,4 @@
const re = /!reference \[\.\w+?(?:, \w+?)\]/g;
const re = /!reference \[(.*?)\]/g;

/**
* Replaces GitLab reference tags before parsing, because our yaml parser cannot process them anyway.
Expand Down