Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gitlabci): gracefully handle errors (#9163)
* fix(gitlabci): gracefully handle errors * fix: remove debugging * Update lib/manager/gitlabci/utils.ts Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
- Loading branch information
1 parent
295d5ab
commit 668c879
Showing
9 changed files
with
90 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include: | ||
- local: 'lib/manager/gitlabci/__fixtures__/include.yml' | ||
|
||
test: | ||
script: | ||
- !abc [.setup, script] | ||
- echo running my own command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# not existing | ||
include: 'lib/manager/gitlabci/__fixtures__/include.2.yml' | ||
|
||
test: | ||
stage: test | ||
image: node:12 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
|
||
# Loop detection | ||
include: 'lib/manager/gitlabci/__fixtures__/include.yml' | ||
|
||
test: | ||
stage: test | ||
image: alpine:3.11 | ||
script: | ||
- echo test | ||
- !reference [.setup, script] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export interface GitlabInclude { | ||
local?: string; | ||
} | ||
|
||
export interface GitlabPipeline { | ||
include?: GitlabInclude[] | string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const re = /!reference \[\.\w+?(?:, \w+?)\]/g; | ||
|
||
/** | ||
* Replaces GitLab reference tags before parsing, because our yaml parser cannot process them anyway. | ||
* @param content pipeline yaml | ||
* @returns replaced pipeline content | ||
* https://docs.gitlab.com/ee/ci/yaml/#reference-tags | ||
*/ | ||
export function replaceReferenceTags(content: string): string { | ||
const res = content.replace(re, ''); | ||
return res; | ||
} |