From bdbc80391e4a902e3b42232ca91e6354243c776d Mon Sep 17 00:00:00 2001 From: Tyrone Meijn Date: Tue, 27 Apr 2021 14:24:27 +0200 Subject: [PATCH 1/7] Update utils.ts --- lib/manager/gitlabci/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/manager/gitlabci/utils.ts b/lib/manager/gitlabci/utils.ts index 1cb036baefd756..f195c95abb91f1 100644 --- a/lib/manager/gitlabci/utils.ts +++ b/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. From 74cbf713002df549dcda6218fd2fc711f966a4e1 Mon Sep 17 00:00:00 2001 From: Tyrone Meijn Date: Tue, 27 Apr 2021 14:28:21 +0200 Subject: [PATCH 2/7] Update extract.ts --- lib/manager/gitlabci-include/extract.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/manager/gitlabci-include/extract.ts b/lib/manager/gitlabci-include/extract.ts index b3ba608b47ea04..ef2fb49286291d 100644 --- a/lib/manager/gitlabci-include/extract.ts +++ b/lib/manager/gitlabci-include/extract.ts @@ -4,6 +4,7 @@ import * as datasourceGitlabTags from '../../datasource/gitlab-tags'; import { logger } from '../../logger'; import { SkipReason } from '../../types'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; +import { replaceReferenceTags } from '../gitlabci/utils'; function extractDepFromIncludeFile(includeObj: { file: any; @@ -31,7 +32,7 @@ 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) { From 8a570d2197ace9d2f9a666d5efa6a658f1edc5de Mon Sep 17 00:00:00 2001 From: Tyrone Meijn Date: Tue, 27 Apr 2021 14:34:07 +0200 Subject: [PATCH 3/7] Update extract.ts --- lib/manager/gitlabci-include/extract.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/manager/gitlabci-include/extract.ts b/lib/manager/gitlabci-include/extract.ts index ef2fb49286291d..f7e1cc8ea23540 100644 --- a/lib/manager/gitlabci-include/extract.ts +++ b/lib/manager/gitlabci-include/extract.ts @@ -3,8 +3,8 @@ import yaml from 'js-yaml'; import * as datasourceGitlabTags from '../../datasource/gitlab-tags'; import { logger } from '../../logger'; import { SkipReason } from '../../types'; -import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import { replaceReferenceTags } from '../gitlabci/utils'; +import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; function extractDepFromIncludeFile(includeObj: { file: any; From c0f5f1d247200ffdd2755680d50bcc63fb0a3833 Mon Sep 17 00:00:00 2001 From: Tyrone Meijn Date: Tue, 27 Apr 2021 14:52:19 +0200 Subject: [PATCH 4/7] Update extract.ts --- lib/manager/gitlabci-include/extract.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/manager/gitlabci-include/extract.ts b/lib/manager/gitlabci-include/extract.ts index f7e1cc8ea23540..59465ac57098bc 100644 --- a/lib/manager/gitlabci-include/extract.ts +++ b/lib/manager/gitlabci-include/extract.ts @@ -32,7 +32,9 @@ export function extractPackageFile( const deps: PackageDependency[] = []; try { // TODO: fix me (#9610) - const doc = yaml.safeLoad(replaceReferenceTags(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) { From d26eecdc93fc89e7ecfe643a461500cdb3bf688f Mon Sep 17 00:00:00 2001 From: Tyrone Meijn Date: Tue, 27 Apr 2021 14:52:34 +0200 Subject: [PATCH 5/7] Update utils.ts --- lib/manager/gitlabci/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/manager/gitlabci/utils.ts b/lib/manager/gitlabci/utils.ts index f195c95abb91f1..28124d3179d82e 100644 --- a/lib/manager/gitlabci/utils.ts +++ b/lib/manager/gitlabci/utils.ts @@ -1,4 +1,4 @@ -const re = /!reference \[(.*?)]/g; +const re = /!reference \[(.*?)\]/g; /** * Replaces GitLab reference tags before parsing, because our yaml parser cannot process them anyway. From d8f2d0ab3134f3c183987cfe71e0a08225bf7b4b Mon Sep 17 00:00:00 2001 From: Tyrone Meijn Date: Tue, 27 Apr 2021 15:04:06 +0200 Subject: [PATCH 6/7] Update extract.ts --- lib/manager/gitlabci-include/extract.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/manager/gitlabci-include/extract.ts b/lib/manager/gitlabci-include/extract.ts index 59465ac57098bc..654f5db8efafaf 100644 --- a/lib/manager/gitlabci-include/extract.ts +++ b/lib/manager/gitlabci-include/extract.ts @@ -33,7 +33,7 @@ export function extractPackageFile( try { // TODO: fix me (#9610) const doc = yaml.safeLoad(replaceReferenceTags(content), { - json: true + json: true, }) as any; if (doc?.include && is.array(doc.include)) { for (const includeObj of doc.include) { From e55378a121460a8499664782b5ad9fad8eded20e Mon Sep 17 00:00:00 2001 From: Tyrone Meijn Date: Wed, 28 Apr 2021 11:35:20 +0200 Subject: [PATCH 7/7] Update gitlab-ci.1.yaml --- lib/manager/gitlabci-include/__fixtures__/gitlab-ci.1.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/manager/gitlabci-include/__fixtures__/gitlab-ci.1.yaml b/lib/manager/gitlabci-include/__fixtures__/gitlab-ci.1.yaml index 49b6ce2def6b9f..9f57e8ee9c8018 100644 --- a/lib/manager/gitlabci-include/__fixtures__/gitlab-ci.1.yaml +++ b/lib/manager/gitlabci-include/__fixtures__/gitlab-ci.1.yaml @@ -7,3 +7,7 @@ include: ref: master - {"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]