diff --git a/lib/manager/circleci/__fixtures__/config2.yml b/lib/manager/circleci/__fixtures__/config2.yml index e69a586240b64a8dd17effa4a7f2e12aeb70ce3c..cf55b2aebc4d878e9754c89ba9884faeb72deabf 100644 --- a/lib/manager/circleci/__fixtures__/config2.yml +++ b/lib/manager/circleci/__fixtures__/config2.yml @@ -1,8 +1,14 @@ version: 2.1 +# There are blank lines and comments in this orbs section intentionally! orbs: release-workflows: hutson/library-release-workflows@4.1.0 + # Comments help me understand my work. + # The next line is intentionally just whitespace! + no-version: abc/def + + # Comments help me understand my work. volatile: zzz/zzz@volatile test_plan: &test_plan diff --git a/lib/manager/circleci/extract.ts b/lib/manager/circleci/extract.ts index 900105cc49546e39f2603b47d59002f456cddd35..f71a48a3b7a36ec546edc5c6ed4d239268a4a809 100644 --- a/lib/manager/circleci/extract.ts +++ b/lib/manager/circleci/extract.ts @@ -13,15 +13,22 @@ export function extractPackageFile(content: string): PackageFile | null { const orbs = /^\s*orbs:\s*$/.exec(line); if (orbs) { logger.trace(`Matched orbs on line ${lineNumber}`); - let foundOrb: boolean; + let foundOrbOrNoop: boolean; do { - foundOrb = false; + foundOrbOrNoop = false; const orbLine = lines[lineNumber + 1]; logger.trace(`orbLine: "${orbLine}"`); + const yamlNoop = /^\s*(#|$)/.exec(orbLine); + if (yamlNoop) { + logger.debug('orbNoop'); + foundOrbOrNoop = true; + lineNumber += 1; + continue; // eslint-disable-line no-continue + } const orbMatch = /^\s+([^:]+):\s(.+)$/.exec(orbLine); if (orbMatch) { logger.trace('orbMatch'); - foundOrb = true; + foundOrbOrNoop = true; lineNumber += 1; const depName = orbMatch[1]; const [orbName, currentValue] = orbMatch[2].split('@'); @@ -37,7 +44,7 @@ export function extractPackageFile(content: string): PackageFile | null { }; deps.push(dep); } - } while (foundOrb); + } while (foundOrbOrNoop); } const match = /^\s*-? image:\s*'?"?([^\s'"]+)'?"?\s*$/.exec(line); if (match) {