diff --git a/docs/adding-a-package-manager.md b/docs/adding-a-package-manager.md index c9bac8643f3dfe4e21227611eb167e349c82909b..522d68bc020f83c862d3c539b5fdeab527784386 100644 --- a/docs/adding-a-package-manager.md +++ b/docs/adding-a-package-manager.md @@ -37,7 +37,7 @@ This function is mandatory unless you use `extractAllPackageFiles` instead. It t - currentValue - version scheme used (e.g. semver, pep440) -The fields returned here can be customised to suit the package manager, e.g. Docker uses `currentFrom` +The fields returned here can be customised to suit the package manager, e.g. Dockerfile uses `lineNumber`. Custom fields should be added within a `managerData` object. This function doesn't necessarily need to _understand_ the file or even syntax that it is passed, instead it just needs to understand enough to extract the list of dependencies. diff --git a/lib/manager/ansible/extract.js b/lib/manager/ansible/extract.js index 78e5951231a2fe57fe400974ea86c3d0956d9f9b..44f38ebe5aeffa9ba82912955881fd5953bc7aee 100644 --- a/lib/manager/ansible/extract.js +++ b/lib/manager/ansible/extract.js @@ -22,7 +22,7 @@ function extractPackageFile(content) { }, 'Docker image inside ansible' ); - dep.lineNumber = lineNumber; + dep.managerData = { lineNumber }; dep.versionScheme = 'docker'; deps.push(dep); } diff --git a/lib/manager/ansible/update.js b/lib/manager/ansible/update.js index 3f7640961a07e098bc2ead17be806d325aca102d..ac2727a519962d647cbae3a6e18ad8cb855b4b3a 100644 --- a/lib/manager/ansible/update.js +++ b/lib/manager/ansible/update.js @@ -10,7 +10,7 @@ function updateDependency(fileContent, upgrade) { const newFrom = getNewFrom(upgrade); logger.debug(`ansible.updateDependency(): ${newFrom}`); const lines = fileContent.split('\n'); - const lineToChange = lines[upgrade.lineNumber]; + const lineToChange = lines[upgrade.managerData.lineNumber]; const imageLine = new RegExp(/^(\s*image:\s*'?"?)[^\s'"]+('?"?\s*)$/); if (!lineToChange.match(imageLine)) { logger.debug('No image line found'); @@ -21,7 +21,7 @@ function updateDependency(fileContent, upgrade) { logger.debug('No changes necessary'); return fileContent; } - lines[upgrade.lineNumber] = newLine; + lines[upgrade.managerData.lineNumber] = newLine; return lines.join('\n'); } catch (err) { logger.info({ err }, 'Error setting new Dockerfile value'); diff --git a/lib/manager/circleci/extract.js b/lib/manager/circleci/extract.js index 461a0fffcc9cb956a6470f449db344f37a25ddb6..ba5c971b483293540450a50d51881a6cc5442871 100644 --- a/lib/manager/circleci/extract.js +++ b/lib/manager/circleci/extract.js @@ -54,7 +54,7 @@ function extractPackageFile(content) { 'CircleCI docker image' ); dep.depType = 'docker'; - dep.lineNumber = lineNumber; + dep.managerData = { lineNumber }; deps.push(dep); } } diff --git a/lib/manager/circleci/update.js b/lib/manager/circleci/update.js index 47c523f6297204538a566dde34bcd37c7c4a3fa3..b81237f8b3cd2c0cfb5435c479ca4e2c9a821076 100644 --- a/lib/manager/circleci/update.js +++ b/lib/manager/circleci/update.js @@ -8,7 +8,7 @@ module.exports = { function updateDependency(fileContent, upgrade) { try { const lines = fileContent.split('\n'); - const lineToChange = lines[upgrade.lineNumber]; + const lineToChange = lines[upgrade.managerData.lineNumber]; if (upgrade.depType === 'docker') { const newFrom = getNewFrom(upgrade); logger.debug(`circleci.updateDependency(): ${newFrom}`); @@ -22,7 +22,7 @@ function updateDependency(fileContent, upgrade) { logger.debug('No changes necessary'); return fileContent; } - lines[upgrade.lineNumber] = newLine; + lines[upgrade.managerData.lineNumber] = newLine; return lines.join('\n'); } if (upgrade.depType === 'orb') { @@ -36,7 +36,7 @@ function updateDependency(fileContent, upgrade) { logger.debug('No changes necessary'); return fileContent; } - lines[upgrade.lineNumber] = newLine; + lines[upgrade.managerData.lineNumber] = newLine; return lines.join('\n'); } logger.error('Unknown circleci depType'); diff --git a/lib/manager/docker-compose/extract.js b/lib/manager/docker-compose/extract.js index aceaef115c857a87ad9236986601b0b9ccc2b694..5fb1b5f53f4090ebe0ebf1dfb50ff5d7695fee18 100644 --- a/lib/manager/docker-compose/extract.js +++ b/lib/manager/docker-compose/extract.js @@ -22,7 +22,7 @@ function extractPackageFile(content) { }, 'Docker Compose image' ); - dep.lineNumber = lineNumber; + dep.managerData = { lineNumber }; deps.push(dep); } lineNumber += 1; diff --git a/lib/manager/docker-compose/update.js b/lib/manager/docker-compose/update.js index 0d1f76ac87a1ec3d9ef3ecae0d78d8e6401f3a5e..3fd31907f54d41a6e8f05ed6f6dbb0ae87aff6d4 100644 --- a/lib/manager/docker-compose/update.js +++ b/lib/manager/docker-compose/update.js @@ -10,7 +10,7 @@ function updateDependency(fileContent, upgrade) { const newFrom = getNewFrom(upgrade); logger.debug(`docker-compose.updateDependency(): ${newFrom}`); const lines = fileContent.split('\n'); - const lineToChange = lines[upgrade.lineNumber]; + const lineToChange = lines[upgrade.managerData.lineNumber]; const imageLine = new RegExp(/^(\s*image:\s*'?"?)[^\s'"]+('?"?\s*)$/); if (!lineToChange.match(imageLine)) { logger.debug('No image line found'); @@ -21,7 +21,7 @@ function updateDependency(fileContent, upgrade) { logger.debug('No changes necessary'); return fileContent; } - lines[upgrade.lineNumber] = newLine; + lines[upgrade.managerData.lineNumber] = newLine; return lines.join('\n'); } catch (err) { logger.info({ err }, 'Error setting new Dockerfile value'); diff --git a/lib/manager/dockerfile/extract.js b/lib/manager/dockerfile/extract.js index 9786b23edead8f8b26fb7d1969db55a364da147e..46e4e67f15163c6d135c7399bbb97a3be2d5861d 100644 --- a/lib/manager/dockerfile/extract.js +++ b/lib/manager/dockerfile/extract.js @@ -27,10 +27,8 @@ function splitImageParts(currentFrom) { } const dep = { depName, - currentDigest, - currentFrom, - currentDepTag, currentValue, + currentDigest, }; return dep; } @@ -77,9 +75,11 @@ function extractPackageFile(content) { }, 'Dockerfile FROM' ); - dep.lineNumber = lineNumber; - dep.fromPrefix = fromPrefix; - dep.fromSuffix = fromSuffix; + dep.managerData = { + lineNumber, + fromPrefix, + fromSuffix, + }; deps.push(dep); } } @@ -102,9 +102,11 @@ function extractPackageFile(content) { }, 'Dockerfile COPY --from' ); - dep.lineNumber = lineNumber; - dep.fromPrefix = fromPrefix; - dep.fromSuffix = fromSuffix; + dep.managerData = { + lineNumber, + fromPrefix, + fromSuffix, + }; deps.push(dep); } } diff --git a/lib/manager/dockerfile/update.js b/lib/manager/dockerfile/update.js index 2b9a55036a46789cc4bec2694beffbfa59a95d18..b10f798e71b9c1921d352aa99606a2a8ed4f6272 100644 --- a/lib/manager/dockerfile/update.js +++ b/lib/manager/dockerfile/update.js @@ -19,8 +19,8 @@ function getNewFrom(upgrade) { function updateDependency(fileContent, upgrade) { try { - const { lineNumber, fromSuffix } = upgrade; - let { fromPrefix } = upgrade; + const { lineNumber, fromSuffix } = upgrade.managerData; + let { fromPrefix } = upgrade.managerData; const newFrom = getNewFrom(upgrade); logger.debug(`docker.updateDependency(): ${newFrom}`); const lines = fileContent.split('\n'); diff --git a/lib/manager/github-actions/extract.js b/lib/manager/github-actions/extract.js index 3e668af6653a5cb26f5e4240fa04789bd62cd715..bcd6d38f2840218903bde7b736eb7f03df29a5ee 100644 --- a/lib/manager/github-actions/extract.js +++ b/lib/manager/github-actions/extract.js @@ -23,7 +23,7 @@ function extractPackageFile(content) { }, 'Docker image inside GitHub Actions' ); - dep.lineNumber = lineNumber; + dep.managerData = { lineNumber }; dep.versionScheme = 'docker'; deps.push(dep); } diff --git a/lib/manager/github-actions/update.js b/lib/manager/github-actions/update.js index eab513410363ae87a53310abc0d6a7272a1abfd5..1f35a2697fc1f2f6a10392f0e066fec167939872 100644 --- a/lib/manager/github-actions/update.js +++ b/lib/manager/github-actions/update.js @@ -10,7 +10,7 @@ function updateDependency(fileContent, upgrade) { const newFrom = getNewFrom(upgrade); logger.debug(`github-actions.updateDependency(): ${newFrom}`); const lines = fileContent.split('\n'); - const lineToChange = lines[upgrade.lineNumber]; + const lineToChange = lines[upgrade.managerData.lineNumber]; const imageLine = new RegExp(/^(\s+uses = "docker:\/\/)[^"]+("\s*)$/); if (!lineToChange.match(imageLine)) { logger.debug('No image line found'); @@ -21,7 +21,7 @@ function updateDependency(fileContent, upgrade) { logger.debug('No changes necessary'); return fileContent; } - lines[upgrade.lineNumber] = newLine; + lines[upgrade.managerData.lineNumber] = newLine; return lines.join('\n'); } catch (err) { logger.info({ err }, 'Error setting new github-actions value'); diff --git a/lib/manager/gitlabci/extract.js b/lib/manager/gitlabci/extract.js index ff3480247ce2299a50c1fefe80f3a329acea0175..1c663445a863b9d89057817916f908974318c0a5 100644 --- a/lib/manager/gitlabci/extract.js +++ b/lib/manager/gitlabci/extract.js @@ -26,7 +26,7 @@ function extractPackageFile(content) { const currentFrom = imageNameMatch[1]; /** @type any */ const dep = getDep(currentFrom); - dep.lineNumber = lineNumber; + dep.managerData = { lineNumber }; dep.depType = 'image-name'; deps.push(dep); } @@ -37,7 +37,7 @@ function extractPackageFile(content) { const currentFrom = imageMatch[1]; /** @type any */ const dep = getDep(currentFrom); - dep.lineNumber = lineNumber; + dep.managerData = { lineNumber }; dep.depType = 'image'; deps.push(dep); } @@ -61,7 +61,7 @@ function extractPackageFile(content) { lineNumber += 1; /** @type any */ const dep = getDep(currentFrom); - dep.lineNumber = lineNumber; + dep.managerData = { lineNumber }; dep.depType = 'service-image'; deps.push(dep); } diff --git a/lib/manager/gitlabci/update.js b/lib/manager/gitlabci/update.js index 734ac96838d70e4c8ec5cc2266582a9e1f31e4b4..4e16b2e62d876bffec11b93e8f115684d04cb002 100644 --- a/lib/manager/gitlabci/update.js +++ b/lib/manager/gitlabci/update.js @@ -9,7 +9,7 @@ function updateDependency(currentFileContent, upgrade) { try { const newFrom = getNewFrom(upgrade); const lines = currentFileContent.split('\n'); - const lineToChange = lines[upgrade.lineNumber]; + const lineToChange = lines[upgrade.managerData.lineNumber]; if (['image', 'image-name'].includes(upgrade.depType)) { const imageLine = new RegExp( /^(\s*(?:image|name):\s*'?"?)[^\s'"]+('?"?\s*)$/ @@ -23,7 +23,7 @@ function updateDependency(currentFileContent, upgrade) { logger.debug('No changes necessary'); return currentFileContent; } - lines[upgrade.lineNumber] = newLine; + lines[upgrade.managerData.lineNumber] = newLine; return lines.join('\n'); } const serviceLine = new RegExp(/^(\s*-\s*'?"?)[^\s'"]+('?"?\s*)$/); @@ -36,7 +36,7 @@ function updateDependency(currentFileContent, upgrade) { logger.debug('No changes necessary'); return currentFileContent; } - lines[upgrade.lineNumber] = newLine; + lines[upgrade.managerData.lineNumber] = newLine; return lines.join('\n'); } catch (err) { logger.info({ err }, 'Error setting new Dockerfile value'); diff --git a/lib/manager/kubernetes/extract.js b/lib/manager/kubernetes/extract.js index 4e79fae8caa56128968d6b3ccef0edab98247165..8473b284deddd772b723585967cb7ce1623057a3 100644 --- a/lib/manager/kubernetes/extract.js +++ b/lib/manager/kubernetes/extract.js @@ -30,7 +30,7 @@ function extractPackageFile(content) { }, 'Kubernetes image' ); - dep.lineNumber = lineNumber; + dep.managerData = { lineNumber }; deps.push(dep); } lineNumber += 1; diff --git a/lib/manager/kubernetes/update.js b/lib/manager/kubernetes/update.js index e932d380c4cf11be3644a65099c742c844d9f126..6487c205732c3e62144321a1bde416b9e9487607 100644 --- a/lib/manager/kubernetes/update.js +++ b/lib/manager/kubernetes/update.js @@ -10,7 +10,7 @@ function updateDependency(fileContent, upgrade) { const newFrom = getNewFrom(upgrade); logger.debug(`kubernetes.updateDependency(): ${newFrom}`); const lines = fileContent.split('\n'); - const lineToChange = lines[upgrade.lineNumber]; + const lineToChange = lines[upgrade.managerData.lineNumber]; const imageLine = new RegExp(/^(\s*-?\s*image:\s*'?"?)[^\s'"]+('?"?\s*)$/); if (!lineToChange.match(imageLine)) { logger.debug('No image line found'); @@ -21,7 +21,7 @@ function updateDependency(fileContent, upgrade) { logger.debug('No changes necessary'); return fileContent; } - lines[upgrade.lineNumber] = newLine; + lines[upgrade.managerData.lineNumber] = newLine; return lines.join('\n'); } catch (err) { logger.info({ err }, 'Error setting new Kubernetes value'); diff --git a/test/manager/ansible/__snapshots__/extract.spec.js.snap b/test/manager/ansible/__snapshots__/extract.spec.js.snap index 9fff5627d90b267a19df8d11dde0634fd16d232f..e4abe9090ddc55954a3aab031e5d2d6e1e0db3a7 100644 --- a/test/manager/ansible/__snapshots__/extract.spec.js.snap +++ b/test/manager/ansible/__snapshots__/extract.spec.js.snap @@ -3,93 +3,93 @@ exports[`lib/manager/ansible/extract extractPackageFile() extracts multiple image lines from docker_container 1`] = ` Array [ Object { - "currentDepTag": "busybox", "currentDigest": undefined, - "currentFrom": "busybox", "currentValue": undefined, "datasource": "docker", "depName": "busybox", - "lineNumber": 4, + "managerData": Object { + "lineNumber": 4, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "redis", "currentDigest": undefined, - "currentFrom": "redis", "currentValue": undefined, "datasource": "docker", "depName": "redis", - "lineNumber": 11, + "managerData": Object { + "lineNumber": 11, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "someuser/appimage", "currentDigest": undefined, - "currentFrom": "someuser/appimage", "currentValue": undefined, "datasource": "docker", "depName": "someuser/appimage", - "lineNumber": 23, + "managerData": Object { + "lineNumber": 23, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "ubuntu:14.04", "currentDigest": undefined, - "currentFrom": "ubuntu:14.04", "currentValue": "14.04", "datasource": "docker", "depName": "ubuntu", - "lineNumber": 40, + "managerData": Object { + "lineNumber": 40, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "someuser/anotherappimage", "currentDigest": undefined, - "currentFrom": "someuser/anotherappimage", "currentValue": undefined, "datasource": "docker", "depName": "someuser/anotherappimage", - "lineNumber": 52, + "managerData": Object { + "lineNumber": 52, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "busybox", "currentDigest": undefined, - "currentFrom": "busybox", "currentValue": undefined, "datasource": "docker", "depName": "busybox", - "lineNumber": 64, + "managerData": Object { + "lineNumber": 64, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "postgres:latest", "currentDigest": undefined, - "currentFrom": "postgres:latest", "currentValue": "latest", "datasource": "docker", "depName": "postgres", - "lineNumber": 76, + "managerData": Object { + "lineNumber": 76, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "ubuntu:14.04", "currentDigest": undefined, - "currentFrom": "ubuntu:14.04", "currentValue": "14.04", "datasource": "docker", "depName": "ubuntu", - "lineNumber": 83, + "managerData": Object { + "lineNumber": 83, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "ubuntu:14.04", "currentDigest": undefined, - "currentFrom": "ubuntu:14.04", "currentValue": "14.04", "datasource": "docker", "depName": "ubuntu", - "lineNumber": 96, + "managerData": Object { + "lineNumber": 96, + }, "versionScheme": "docker", }, ] @@ -98,43 +98,43 @@ Array [ exports[`lib/manager/ansible/extract extractPackageFile() extracts multiple image lines from docker_service 1`] = ` Array [ Object { - "currentDepTag": "sameersbn/gitlab:11.5.1", "currentDigest": undefined, - "currentFrom": "sameersbn/gitlab:11.5.1", "currentValue": "11.5.1", "datasource": "docker", "depName": "sameersbn/gitlab", - "lineNumber": 8, + "managerData": Object { + "lineNumber": 8, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "sameersbn/postgresql:10", "currentDigest": undefined, - "currentFrom": "sameersbn/postgresql:10", "currentValue": "10", "datasource": "docker", "depName": "sameersbn/postgresql", - "lineNumber": 30, + "managerData": Object { + "lineNumber": 30, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "sameersbn/redis:4.0.9-1", "currentDigest": undefined, - "currentFrom": "sameersbn/redis:4.0.9-1", "currentValue": "4.0.9-1", "datasource": "docker", "depName": "sameersbn/redis", - "lineNumber": 38, + "managerData": Object { + "lineNumber": 38, + }, "versionScheme": "docker", }, Object { - "currentDepTag": "registry:2.6.2", "currentDigest": undefined, - "currentFrom": "registry:2.6.2", "currentValue": "2.6.2", "datasource": "docker", "depName": "registry", - "lineNumber": 43, + "managerData": Object { + "lineNumber": 43, + }, "versionScheme": "docker", }, ] diff --git a/test/manager/ansible/update.spec.js b/test/manager/ansible/update.spec.js index b71eb25fa8fafafdff1c3dffb1b697ede9864eaa..b00f9e2ae3f731a2fcddbe31898655968fda2be8 100644 --- a/test/manager/ansible/update.spec.js +++ b/test/manager/ansible/update.spec.js @@ -14,7 +14,7 @@ describe('manager/ansible/update', () => { describe('updateDependency', () => { it('replaces existing value from docker_container', () => { const upgrade = { - lineNumber: 4, + managerData: { lineNumber: 4 }, depName: 'busybox', newValue: '1.29.3', newDigest: 'sha256:abcdefghijklmnop', @@ -25,7 +25,7 @@ describe('manager/ansible/update', () => { }); it('replaces existing value from docker_service', () => { const upgrade = { - lineNumber: 8, + managerData: { lineNumber: 8 }, depName: 'sameersbn/gitlab', newValue: '11.5.1', newDigest: 'sha256:abcdefghijklmnop', @@ -36,7 +36,7 @@ describe('manager/ansible/update', () => { }); it('returns same', () => { const upgrade = { - lineNumber: 38, + managerData: { lineNumber: 38 }, depName: 'sameersbn/redis', newValue: '4.0.9-1', }; @@ -45,7 +45,7 @@ describe('manager/ansible/update', () => { }); it('returns null if mismatch', () => { const upgrade = { - lineNumber: 52, + managerData: { lineNumber: 52 }, newFrom: 'registry:2.6.2@sha256:abcdefghijklmnop', }; const res = dcUpdate.updateDependency(yamlFile2, upgrade); diff --git a/test/manager/circleci/__snapshots__/extract.spec.js.snap b/test/manager/circleci/__snapshots__/extract.spec.js.snap index 676008d5ef5a605989991c91c7bab676dc3bd550..c39eea60db89ced384fbef3eb52e06c0b92ff91c 100644 --- a/test/manager/circleci/__snapshots__/extract.spec.js.snap +++ b/test/manager/circleci/__snapshots__/extract.spec.js.snap @@ -4,47 +4,47 @@ exports[`lib/manager/circleci/extract extractPackageFile() extracts multiple ima Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node", "currentDigest": undefined, - "currentFrom": "node", "currentValue": undefined, "datasource": "docker", "depName": "node", "depType": "docker", - "lineNumber": 12, + "managerData": Object { + "lineNumber": 12, + }, }, Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:4", "currentDigest": undefined, - "currentFrom": "node:4", "currentValue": "4", "datasource": "docker", "depName": "node", "depType": "docker", - "lineNumber": 57, + "managerData": Object { + "lineNumber": 57, + }, }, Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:6", "currentDigest": undefined, - "currentFrom": "node:6", "currentValue": "6", "datasource": "docker", "depName": "node", "depType": "docker", - "lineNumber": 61, + "managerData": Object { + "lineNumber": 61, + }, }, Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:8.9.0", "currentDigest": undefined, - "currentFrom": "node:8.9.0", "currentValue": "8.9.0", "datasource": "docker", "depName": "node", "depType": "docker", - "lineNumber": 65, + "managerData": Object { + "lineNumber": 65, + }, }, ] `; @@ -85,64 +85,64 @@ Array [ "versionScheme": "npm", }, Object { - "currentDepTag": "python:3.7", "currentDigest": "sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", - "currentFrom": "python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", "currentValue": "3.7", "datasource": "docker", "depName": "python", "depType": "docker", - "lineNumber": 20, + "managerData": Object { + "lineNumber": 20, + }, }, Object { - "currentDepTag": "python:3.7", "currentDigest": "sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", - "currentFrom": "python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", "currentValue": "3.7", "datasource": "docker", "depName": "python", "depType": "docker", - "lineNumber": 27, + "managerData": Object { + "lineNumber": 27, + }, }, Object { - "currentDepTag": "python:3.7", "currentDigest": "sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", - "currentFrom": "python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", "currentValue": "3.7", "datasource": "docker", "depName": "python", "depType": "docker", - "lineNumber": 34, + "managerData": Object { + "lineNumber": 34, + }, }, Object { - "currentDepTag": "python:3.7", "currentDigest": "sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", - "currentFrom": "python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", "currentValue": "3.7", "datasource": "docker", "depName": "python", "depType": "docker", - "lineNumber": 41, + "managerData": Object { + "lineNumber": 41, + }, }, Object { - "currentDepTag": "pypy:3-6", "currentDigest": "sha256:eb6325b75c1c70b4992eaa1bdd29e24e5f14d5324b4714a49f3e67783473214b", - "currentFrom": "pypy:3-6@sha256:eb6325b75c1c70b4992eaa1bdd29e24e5f14d5324b4714a49f3e67783473214b", "currentValue": "3-6", "datasource": "docker", "depName": "pypy", "depType": "docker", - "lineNumber": 50, + "managerData": Object { + "lineNumber": 50, + }, }, Object { - "currentDepTag": "python:3.7", "currentDigest": "sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", - "currentFrom": "python:3.7@sha256:3870d35b962a943df72d948580fc66ceaaee1c4fbd205930f32e0f0760eb1077", "currentValue": "3.7", "datasource": "docker", "depName": "python", "depType": "docker", - "lineNumber": 57, + "managerData": Object { + "lineNumber": 57, + }, }, ] `; diff --git a/test/manager/circleci/update.spec.js b/test/manager/circleci/update.spec.js index a633840b07a7ae654aceb9cad4bcbd5e4dc93e91..a4357ba3b61d99545fcd27179345a0da95bd59d3 100644 --- a/test/manager/circleci/update.spec.js +++ b/test/manager/circleci/update.spec.js @@ -14,7 +14,7 @@ describe('manager/circleci/update', () => { describe('updateDependency', () => { it('replaces existing value', () => { const upgrade = { - lineNumber: 65, + managerData: { lineNumber: 65 }, depType: 'docker', depName: 'node', newValue: '8.10.0', @@ -26,7 +26,7 @@ describe('manager/circleci/update', () => { }); it('returns same', () => { const upgrade = { - lineNumber: 12, + managerData: { lineNumber: 12 }, depType: 'docker', depName: 'node', }; @@ -35,7 +35,7 @@ describe('manager/circleci/update', () => { }); it('returns null if mismatch', () => { const upgrade = { - lineNumber: 17, + managerData: { lineNumber: 17 }, depType: 'docker', depName: 'postgres', newValue: '9.6.8', @@ -53,7 +53,7 @@ describe('manager/circleci/update', () => { currentValue: '4.1.0', depName: 'release-workflows', depType: 'orb', - lineNumber: 3, + managerData: { lineNumber: 3 }, newValue: '4.2.0', }; const res = dcUpdate.updateDependency(yamlFile2, upgrade); @@ -65,7 +65,7 @@ describe('manager/circleci/update', () => { currentValue: '4.0.0', depName: 'release-workflows', depType: 'orb', - lineNumber: 3, + managerData: { lineNumber: 3 }, newValue: '4.1.0', }; const res = dcUpdate.updateDependency(yamlFile2, upgrade); @@ -76,7 +76,7 @@ describe('manager/circleci/update', () => { currentValue: '4.1.0', depName: 'release-workflows', depType: 'orb', - lineNumber: 2, + managerData: { lineNumber: 2 }, newValue: '4.2.0', }; const res = dcUpdate.updateDependency(yamlFile2, upgrade); @@ -86,7 +86,7 @@ describe('manager/circleci/update', () => { const upgrade = { currentValue: '4.1.0', depName: 'release-workflows', - lineNumber: 3, + managerData: { lineNumber: 3 }, newValue: '4.2.0', }; const res = dcUpdate.updateDependency(yamlFile2, upgrade); diff --git a/test/manager/docker-compose/__snapshots__/extract.spec.js.snap b/test/manager/docker-compose/__snapshots__/extract.spec.js.snap index 3dd49b2a20792528ab649d2170a7279ad59d3065..9939d59beaf1254977f2f90fc198751bc80fa40c 100644 --- a/test/manager/docker-compose/__snapshots__/extract.spec.js.snap +++ b/test/manager/docker-compose/__snapshots__/extract.spec.js.snap @@ -3,72 +3,74 @@ exports[`lib/manager/docker-compose/extract extractPackageFile() extracts multiple image lines 1`] = ` Array [ Object { - "currentDepTag": "quay.io/something/redis:alpine", "currentDigest": undefined, - "currentFrom": "quay.io/something/redis:alpine", "currentValue": "alpine", "datasource": "docker", "depName": "quay.io/something/redis", - "lineNumber": 4, + "managerData": Object { + "lineNumber": 4, + }, }, Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:10.0.0", "currentDigest": undefined, - "currentFrom": "node:10.0.0", "currentValue": "10.0.0", "datasource": "docker", "depName": "node", - "lineNumber": 18, + "managerData": Object { + "lineNumber": 18, + }, }, Object { - "currentDepTag": "postgres:9.4.0", "currentDigest": undefined, - "currentFrom": "postgres:9.4.0", "currentValue": "9.4.0", "datasource": "docker", "depName": "postgres", - "lineNumber": 21, + "managerData": Object { + "lineNumber": 21, + }, }, Object { - "currentDepTag": "dockersamples/examplevotingapp_vote:before", "currentDigest": undefined, - "currentFrom": "dockersamples/examplevotingapp_vote:before", "currentValue": "before", "datasource": "docker", "depName": "dockersamples/examplevotingapp_vote", - "lineNumber": 31, + "managerData": Object { + "lineNumber": 31, + }, }, Object { - "currentDepTag": "dockersamples/examplevotingapp_result:before", "currentDigest": undefined, - "currentFrom": "dockersamples/examplevotingapp_result:before", "currentValue": "before", "datasource": "docker", "depName": "dockersamples/examplevotingapp_result", - "lineNumber": 46, + "managerData": Object { + "lineNumber": 46, + }, }, Object { - "currentDepTag": "dockersamples/examplevotingapp_worker", "currentDigest": undefined, - "currentFrom": "dockersamples/examplevotingapp_worker", "currentValue": undefined, "datasource": "docker", "depName": "dockersamples/examplevotingapp_worker", - "lineNumber": 62, + "managerData": Object { + "lineNumber": 62, + }, }, Object { - "currentDepTag": "dockersamples/visualizer:stable", "currentDigest": undefined, - "currentFrom": "dockersamples/visualizer:stable", "currentValue": "stable", "datasource": "docker", "depName": "dockersamples/visualizer", - "lineNumber": 79, + "managerData": Object { + "lineNumber": 79, + }, }, Object { "datasource": "docker", - "lineNumber": 90, + "managerData": Object { + "lineNumber": 90, + }, "skipReason": "contains-variable", }, ] diff --git a/test/manager/docker-compose/update.spec.js b/test/manager/docker-compose/update.spec.js index daa239b6cae481e356d9fd2758e9290d2738e700..b23a1543aded026eafc019a7bb0d4e5d700b29b2 100644 --- a/test/manager/docker-compose/update.spec.js +++ b/test/manager/docker-compose/update.spec.js @@ -10,7 +10,7 @@ describe('manager/docker-compose/update', () => { describe('updateDependency', () => { it('replaces existing value', () => { const upgrade = { - lineNumber: 18, + managerData: { lineNumber: 18 }, depName: 'postgres', newValue: '9.6.8', newDigest: 'sha256:abcdefghijklmnop', @@ -21,7 +21,7 @@ describe('manager/docker-compose/update', () => { }); it('returns same', () => { const upgrade = { - lineNumber: 4, + managerData: { lineNumber: 4 }, depName: 'quay.io/something/redis', newValue: 'alpine', }; @@ -30,7 +30,7 @@ describe('manager/docker-compose/update', () => { }); it('returns null if mismatch', () => { const upgrade = { - lineNumber: 17, + managerData: { lineNumber: 17 }, newFrom: 'postgres:9.6.8@sha256:abcdefghijklmnop', }; const res = dcUpdate.updateDependency(yamlFile, upgrade); diff --git a/test/manager/dockerfile/__snapshots__/extract.spec.js.snap b/test/manager/dockerfile/__snapshots__/extract.spec.js.snap index c3d4d0f497f1e60c83ff6fcba6dcd8a3d905945c..38ba0fa9c41e4783cc5d40df26c9ffc3cb99b35a 100644 --- a/test/manager/dockerfile/__snapshots__/extract.spec.js.snap +++ b/test/manager/dockerfile/__snapshots__/extract.spec.js.snap @@ -4,40 +4,40 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() detects ["stage"] a Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:8.15.1-alpine", "currentDigest": undefined, - "currentFrom": "node:8.15.1-alpine", "currentValue": "8.15.1-alpine", "datasource": "docker", "depName": "node", "depType": "stage", - "fromPrefix": "FROM", - "fromSuffix": "as skippedfrom", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "as skippedfrom", + "lineNumber": 0, + }, }, Object { - "currentDepTag": "golang:1.7.3", "currentDigest": undefined, - "currentFrom": "golang:1.7.3", "currentValue": "1.7.3", "datasource": "docker", "depName": "golang", "depType": "stage", - "fromPrefix": "FROM", - "fromSuffix": "as builder", - "lineNumber": 1, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "as builder", + "lineNumber": 1, + }, }, Object { - "currentDepTag": "alpine:latest", "currentDigest": undefined, - "currentFrom": "alpine:latest", "currentValue": "latest", "datasource": "docker", "depName": "alpine", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 9, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 9, + }, }, ] `; @@ -46,28 +46,28 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() extracts images on Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:8.11.3-alpine", "currentDigest": "sha256:d743b4141b02fcfb8beb68f92b4cd164f60ee457bf2d053f36785bf86de16b0d", - "currentFrom": "node:8.11.3-alpine@sha256:d743b4141b02fcfb8beb68f92b4cd164f60ee457bf2d053f36785bf86de16b0d", "currentValue": "8.11.3-alpine", "datasource": "docker", "depName": "node", "depType": "stage", - "fromPrefix": "FROM", - "fromSuffix": "AS node", - "lineNumber": 2, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "AS node", + "lineNumber": 2, + }, }, Object { - "currentDepTag": "buildkite/puppeteer:1.1.1", "currentDigest": undefined, - "currentFrom": "buildkite/puppeteer:1.1.1", "currentValue": "1.1.1", "datasource": "docker", "depName": "buildkite/puppeteer", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "AS puppeteer", - "lineNumber": 3, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "AS puppeteer", + "lineNumber": 3, + }, }, ] `; @@ -76,28 +76,28 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() extracts multiple F Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:6.12.3", "currentDigest": undefined, - "currentFrom": "node:6.12.3", "currentValue": "6.12.3", "datasource": "docker", "depName": "node", "depType": "stage", - "fromPrefix": "FROM", - "fromSuffix": "as frontend", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "as frontend", + "lineNumber": 0, + }, }, Object { - "currentDepTag": "python:3.6-slim", "currentDigest": undefined, - "currentFrom": "python:3.6-slim", "currentValue": "3.6-slim", "datasource": "docker", "depName": "python", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 4, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 4, + }, }, ] `; @@ -105,16 +105,16 @@ Array [ exports[`lib/manager/dockerfile/extract extractPackageFile() handles COPY --from 1`] = ` Array [ Object { - "currentDepTag": "gcr.io/k8s-skaffold/skaffold:v0.11.0", "currentDigest": undefined, - "currentFrom": "gcr.io/k8s-skaffold/skaffold:v0.11.0", "currentValue": "v0.11.0", "datasource": "docker", "depName": "gcr.io/k8s-skaffold/skaffold", "depType": "final", - "fromPrefix": "COPY --from=", - "fromSuffix": "/usr/bin/skaffold /usr/bin/skaffold", - "lineNumber": 1, + "managerData": Object { + "fromPrefix": "COPY --from=", + "fromSuffix": "/usr/bin/skaffold /usr/bin/skaffold", + "lineNumber": 1, + }, }, ] `; @@ -123,16 +123,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles abnoral spa Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "registry.allmine.info:5005/node:8.7.0", "currentDigest": undefined, - "currentFrom": "registry.allmine.info:5005/node:8.7.0", "currentValue": "8.7.0", "datasource": "docker", "depName": "registry.allmine.info:5005/node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -140,16 +140,16 @@ Array [ exports[`lib/manager/dockerfile/extract extractPackageFile() handles calico/node 1`] = ` Array [ Object { - "currentDepTag": "calico/node", "currentDigest": undefined, - "currentFrom": "calico/node", "currentValue": undefined, "datasource": "docker", "depName": "calico/node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -158,16 +158,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles comments 1` Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node", "currentDigest": undefined, - "currentFrom": "node", "currentValue": undefined, "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 3, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 3, + }, }, ] `; @@ -176,16 +176,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles custom host Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "registry2.something.info/node:8", "currentDigest": undefined, - "currentFrom": "registry2.something.info/node:8", "currentValue": "8", "datasource": "docker", "depName": "registry2.something.info/node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -194,16 +194,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles custom host Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "registry2.something.info/node:8-alpine", "currentDigest": undefined, - "currentFrom": "registry2.something.info/node:8-alpine", "currentValue": "8-alpine", "datasource": "docker", "depName": "registry2.something.info/node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -212,16 +212,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles custom host Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "registry2.something.info/someaccount/node:8", "currentDigest": undefined, - "currentFrom": "registry2.something.info/someaccount/node:8", "currentValue": "8", "datasource": "docker", "depName": "registry2.something.info/someaccount/node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -230,16 +230,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles custom host Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "registry2.something.info:5005/node:8", "currentDigest": undefined, - "currentFrom": "registry2.something.info:5005/node:8", "currentValue": "8", "datasource": "docker", "depName": "registry2.something.info:5005/node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -248,16 +248,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles custom host Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "registry2.something.info:5005/node", "currentDigest": undefined, - "currentFrom": "registry2.something.info:5005/node", "currentValue": undefined, "datasource": "docker", "depName": "registry2.something.info:5005/node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -266,16 +266,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles digest 1`] Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node", "currentDigest": "sha256:eb85fc5b1198f5e1ec025ea07586bdbbf397e7d82df66c90d7511f533517e063", - "currentFrom": "node@sha256:eb85fc5b1198f5e1ec025ea07586bdbbf397e7d82df66c90d7511f533517e063", "currentValue": undefined, "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -284,16 +284,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles from as 1`] Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:8.9.0-alpine", "currentDigest": undefined, - "currentFrom": "node:8.9.0-alpine", "currentValue": "8.9.0-alpine", "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "as base", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "as base", + "lineNumber": 0, + }, }, ] `; @@ -302,16 +302,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles naked dep 1 Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node", "currentDigest": undefined, - "currentFrom": "node", "currentValue": undefined, "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -320,16 +320,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles namespaced Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "mynamespace/node:8", "currentDigest": undefined, - "currentFrom": "mynamespace/node:8", "currentValue": "8", "datasource": "docker", "depName": "mynamespace/node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -338,16 +338,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles tag 1`] = ` Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:8.9.0-alpine", "currentDigest": undefined, - "currentFrom": "node:8.9.0-alpine", "currentValue": "8.9.0-alpine", "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -356,16 +356,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() handles tag and dig Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:8.9.0", "currentDigest": "sha256:eb85fc5b1198f5e1ec025ea07586bdbbf397e7d82df66c90d7511f533517e063", - "currentFrom": "node:8.9.0@sha256:eb85fc5b1198f5e1ec025ea07586bdbbf397e7d82df66c90d7511f533517e063", "currentValue": "8.9.0", "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -374,16 +374,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() is case insensitive Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node", "currentDigest": undefined, - "currentFrom": "node", "currentValue": undefined, "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "From", - "fromSuffix": "", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "From", + "fromSuffix": "", + "lineNumber": 0, + }, }, ] `; @@ -392,16 +392,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() skips index referen Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:6.12.3", "currentDigest": undefined, - "currentFrom": "node:6.12.3", "currentValue": "6.12.3", "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "as frontend", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "as frontend", + "lineNumber": 0, + }, }, ] `; @@ -410,16 +410,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() skips named multist Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:6.12.3", "currentDigest": undefined, - "currentFrom": "node:6.12.3", "currentValue": "6.12.3", "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "as frontend", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "as frontend", + "lineNumber": 0, + }, }, ] `; @@ -428,16 +428,16 @@ exports[`lib/manager/dockerfile/extract extractPackageFile() skips named multist Array [ Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:6.12.3", "currentDigest": undefined, - "currentFrom": "node:6.12.3", "currentValue": "6.12.3", "datasource": "docker", "depName": "node", "depType": "final", - "fromPrefix": "FROM", - "fromSuffix": "as frontend", - "lineNumber": 0, + "managerData": Object { + "fromPrefix": "FROM", + "fromSuffix": "as frontend", + "lineNumber": 0, + }, }, ] `; diff --git a/test/manager/dockerfile/extract.spec.js b/test/manager/dockerfile/extract.spec.js index 19dec3b0fad26d4c01d99d391417d28cf107d47d..e348ea6fc2e5862d938d911a6b94176ec2382628 100644 --- a/test/manager/dockerfile/extract.spec.js +++ b/test/manager/dockerfile/extract.spec.js @@ -136,8 +136,8 @@ describe('lib/manager/dockerfile/extract', () => { res[2].depType === 'final', res[1].depType === 'stage', res[0].depType === 'stage', - res[2].lineNumber > res[1].lineNumber, - res[2].lineNumber > res[0].lineNumber, + res[2].managerData.lineNumber > res[1].managerData.lineNumber, + res[2].managerData.lineNumber > res[0].managerData.lineNumber, ].every(Boolean); expect(passed).toBe(true); }); diff --git a/test/manager/dockerfile/update.spec.js b/test/manager/dockerfile/update.spec.js index db2836befa44cc2261b8c8be39391f3a06e242a4..5a9280a9423bada45e71ed26c1832e02ab7b573d 100644 --- a/test/manager/dockerfile/update.spec.js +++ b/test/manager/dockerfile/update.spec.js @@ -5,11 +5,9 @@ describe('manager/dockerfile/update', () => { it('replaces existing value', () => { const fileContent = '# comment FROM node:8\nFROM node:8\nRUN something\n'; const upgrade = { - lineNumber: 1, + managerData: { lineNumber: 1, fromPrefix: 'FROM', fromSuffix: '' }, depName: 'node', newValue: '8.1-alpine', - fromPrefix: 'FROM', - fromSuffix: '', newDigest: 'sha256:abcdefghijklmnop', }; const res = dockerfile.updateDependency(fileContent, upgrade); @@ -19,11 +17,13 @@ describe('manager/dockerfile/update', () => { const fileContent = '# comment FROM node:8\nFROM node:8 as base\nRUN something\n'; const upgrade = { - lineNumber: 1, + managerData: { + lineNumber: 1, + fromPrefix: 'FROM', + fromSuffix: 'as base', + }, depName: 'node', newValue: '8', - fromPrefix: 'FROM', - fromSuffix: 'as base', newDigest: 'sha256:abcdefghijklmnop', }; const res = dockerfile.updateDependency(fileContent, upgrade); @@ -33,11 +33,14 @@ describe('manager/dockerfile/update', () => { const fileContent = '# comment FROM node:8\nFROM node:8 as base\nRUN something\n'; const upgrade = { - lineNumber: 1, + managerData: { + lineNumber: 1, + fromPrefix: 'FROM', + fromSuffix: 'as base', + }, depName: 'node', newValue: '8', - fromPrefix: 'FROM', - fromSuffix: 'as base', + newDigest: 'sha256:abcdefghijklmnop', }; const res = dockerfile.updateDependency(fileContent, upgrade); @@ -47,11 +50,9 @@ describe('manager/dockerfile/update', () => { const fileContent = '# comment FROM node:8\nFROM node:8 as base\nRUN something\n'; const upgrade = { - lineNumber: 0, + managerData: { lineNumber: 0, fromPrefix: 'FROM', fromSuffix: '' }, depName: 'node', newValue: '8', - fromPrefix: 'FROM', - fromSuffix: '', newDigest: 'sha256:abcdefghijklmnop', }; const res = dockerfile.updateDependency(fileContent, upgrade); @@ -61,11 +62,13 @@ describe('manager/dockerfile/update', () => { const fileContent = '# comment FROM node:8\nFROM node:8 as base\nRUN something\n'; const upgrade = { - lineNumber: 1, + managerData: { + lineNumber: 1, + fromPrefix: 'FROM', + fromSuffix: 'as base', + }, depName: 'node', newValue: '8', - fromPrefix: 'FROM', - fromSuffix: 'as base', }; const res = dockerfile.updateDependency(fileContent, upgrade); expect(res).toBe(fileContent); @@ -73,11 +76,9 @@ describe('manager/dockerfile/update', () => { it('returns null on error', () => { const fileContent = null; const upgrade = { - lineNumber: 1, + managerData: { lineNumber: 1, fromPrefix: 'FROM', fromSuffix: '' }, depName: 'node', newValue: '8', - fromPrefix: 'FROM', - fromSuffix: '', newDigest: 'sha256:abcdefghijklmnop', }; const res = dockerfile.updateDependency(fileContent, upgrade); @@ -87,19 +88,19 @@ describe('manager/dockerfile/update', () => { const fileContent = 'FROM debian:wheezy as stage-1\nRUN something\nFROM debian:wheezy\nRUN something else'; const upgrade1 = { - lineNumber: 0, + managerData: { + lineNumber: 0, + fromPrefix: 'FROM', + fromSuffix: 'as stage-1', + }, depName: 'debian', newValue: 'wheezy', - fromPrefix: 'FROM', - fromSuffix: 'as stage-1', newDigest: 'sha256:abcdefghijklmnop', }; const upgrade2 = { - lineNumber: 2, + managerData: { lineNumber: 2, fromPrefix: 'FROM', fromSuffix: '' }, depName: 'debian', newValue: 'wheezy', - fromPrefix: 'FROM', - fromSuffix: '', newDigest: 'sha256:abcdefghijklmnop', }; let res = dockerfile.updateDependency(fileContent, upgrade1); @@ -111,11 +112,13 @@ describe('manager/dockerfile/update', () => { const fileContent = 'FROM scratch\nCOPY --from=gcr.io/k8s-skaffold/skaffold:v0.11.0 /usr/bin/skaffold /usr/bin/skaffold\n'; const upgrade = { - lineNumber: 1, + managerData: { + lineNumber: 1, + fromPrefix: 'COPY --from=', + fromSuffix: '/usr/bin/skaffold /usr/bin/skaffold', + }, depName: 'gcr.io/k8s-skaffold/skaffold', newValue: 'v0.12.0', - fromPrefix: 'COPY --from=', - fromSuffix: '/usr/bin/skaffold /usr/bin/skaffold', }; const res = dockerfile.updateDependency(fileContent, upgrade); expect(res).toMatchSnapshot(); diff --git a/test/manager/github-actions/__snapshots__/extract.spec.js.snap b/test/manager/github-actions/__snapshots__/extract.spec.js.snap index 5bf8cc6dc9237d1a8e9cbb1fa2a7af7bde9cbe3a..350f74b4f33d57bf0994b660ccc1727ea4141769 100644 --- a/test/manager/github-actions/__snapshots__/extract.spec.js.snap +++ b/test/manager/github-actions/__snapshots__/extract.spec.js.snap @@ -3,24 +3,24 @@ exports[`lib/manager/github-actions/extract extractPackageFile() extracts multiple image lines from docker_container 1`] = ` Array [ Object { - "currentDepTag": "replicated/dockerfilelint", "currentDigest": undefined, - "currentFrom": "replicated/dockerfilelint", "currentValue": undefined, "datasource": "docker", "depName": "replicated/dockerfilelint", - "lineNumber": 11, + "managerData": Object { + "lineNumber": 11, + }, "versionScheme": "docker", }, Object { "commitMessageTopic": "Node.js", - "currentDepTag": "node:6", "currentDigest": "sha256:7b65413af120ec5328077775022c78101f103258a1876ec2f83890bce416e896", - "currentFrom": "node:6@sha256:7b65413af120ec5328077775022c78101f103258a1876ec2f83890bce416e896", "currentValue": "6", "datasource": "docker", "depName": "node", - "lineNumber": 36, + "managerData": Object { + "lineNumber": 36, + }, "versionScheme": "docker", }, ] diff --git a/test/manager/github-actions/update.spec.js b/test/manager/github-actions/update.spec.js index 986079533cece7f9ffdf7902a869ff4477227f82..1022c4e3be720dcf1df2b7865781cd4115446200 100644 --- a/test/manager/github-actions/update.spec.js +++ b/test/manager/github-actions/update.spec.js @@ -10,7 +10,7 @@ describe('manager/github-actions/update', () => { describe('updateDependency', () => { it('replaces existing uses value', () => { const upgrade = { - lineNumber: 11, + managerData: { lineNumber: 11 }, depName: 'replicated/dockerfilelint', newDigest: 'sha256:abcdefghijklmnop', }; @@ -20,7 +20,7 @@ describe('manager/github-actions/update', () => { }); it('returns same', () => { const upgrade = { - lineNumber: 11, + managerData: { lineNumber: 11 }, depName: 'replicated/dockerfilelint', }; const res = dcUpdate.updateDependency(workflow1, upgrade); @@ -28,7 +28,7 @@ describe('manager/github-actions/update', () => { }); it('returns null if mismatch', () => { const upgrade = { - lineNumber: 12, + managerData: { lineNumber: 12 }, newFrom: 'registry:2.6.2@sha256:abcdefghijklmnop', }; const res = dcUpdate.updateDependency(workflow1, upgrade); diff --git a/test/manager/gitlabci/__snapshots__/extract.spec.js.snap b/test/manager/gitlabci/__snapshots__/extract.spec.js.snap index 400ffc3800c6b6315f1a064608d85e3934db7fa3..63aee2df5624635b85933385c7d697b57b96b145 100644 --- a/test/manager/gitlabci/__snapshots__/extract.spec.js.snap +++ b/test/manager/gitlabci/__snapshots__/extract.spec.js.snap @@ -3,64 +3,64 @@ exports[`lib/manager/gitlabci/extract extractPackageFile() extracts multiple image lines 1`] = ` Array [ Object { - "currentDepTag": "hadolint/hadolint:latest", "currentDigest": undefined, - "currentFrom": "hadolint/hadolint:latest", "currentValue": "latest", "datasource": "docker", "depName": "hadolint/hadolint", "depType": "image", - "lineNumber": 36, + "managerData": Object { + "lineNumber": 36, + }, }, Object { - "currentDepTag": "docker:latest", "currentDigest": undefined, - "currentFrom": "docker:latest", "currentValue": "latest", "datasource": "docker", "depName": "docker", "depType": "image", - "lineNumber": 53, + "managerData": Object { + "lineNumber": 53, + }, }, Object { - "currentDepTag": "docker:dind", "currentDigest": undefined, - "currentFrom": "docker:dind", "currentValue": "dind", "datasource": "docker", "depName": "docker", "depType": "service-image", - "lineNumber": 55, + "managerData": Object { + "lineNumber": 55, + }, }, Object { - "currentDepTag": "docker:latest", "currentDigest": undefined, - "currentFrom": "docker:latest", "currentValue": "latest", "datasource": "docker", "depName": "docker", "depType": "image", - "lineNumber": 75, + "managerData": Object { + "lineNumber": 75, + }, }, Object { - "currentDepTag": "docker:dind", "currentDigest": undefined, - "currentFrom": "docker:dind", "currentValue": "dind", "datasource": "docker", "depName": "docker", "depType": "service-image", - "lineNumber": 77, + "managerData": Object { + "lineNumber": 77, + }, }, Object { - "currentDepTag": "image-name-test:1.15", "currentDigest": undefined, - "currentFrom": "image-name-test:1.15", "currentValue": "1.15", "datasource": "docker", "depName": "image-name-test", "depType": "image-name", - "lineNumber": 102, + "managerData": Object { + "lineNumber": 102, + }, }, ] `; diff --git a/test/manager/gitlabci/update.spec.js b/test/manager/gitlabci/update.spec.js index 2707900248e9738f02960d5551a1e386f45a223d..b08a0b58327a365237187291888610cc5c745323 100644 --- a/test/manager/gitlabci/update.spec.js +++ b/test/manager/gitlabci/update.spec.js @@ -10,7 +10,7 @@ describe('manager/gitlabci/update', () => { describe('updateDependency', () => { it('replaces existing value', () => { const upgrade = { - lineNumber: 36, + managerData: { lineNumber: 36 }, depType: 'image', depName: 'hadolint/hadolint', newValue: '7.0.0', @@ -23,7 +23,7 @@ describe('manager/gitlabci/update', () => { it('returns same', () => { const upgrade = { depType: 'image', - lineNumber: 36, + managerData: { lineNumber: 36 }, depName: 'hadolint/hadolint', newValue: 'latest', }; @@ -32,7 +32,7 @@ describe('manager/gitlabci/update', () => { }); it('returns null if mismatch', () => { const upgrade = { - lineNumber: 17, + managerData: { lineNumber: 17 }, depType: 'image', depName: 'postgres', newValue: '9.6.8', @@ -43,7 +43,7 @@ describe('manager/gitlabci/update', () => { }); it('replaces image-name value', () => { const upgrade = { - lineNumber: 102, + managerData: { lineNumber: 102 }, depType: 'image-name', depName: 'image-name-test', newValue: '1.35', @@ -53,7 +53,7 @@ describe('manager/gitlabci/update', () => { }); it('returns same image-name value', () => { const upgrade = { - lineNumber: 102, + managerData: { lineNumber: 102 }, depType: 'image-name', depName: 'image-name-test', newValue: '1.15', @@ -63,7 +63,7 @@ describe('manager/gitlabci/update', () => { }); it('replaces service-image update', () => { const upgrade = { - lineNumber: 55, + managerData: { lineNumber: 55 }, depType: 'service-image', depName: 'hadolint/hadolint', newValue: '7.0.0', @@ -75,7 +75,7 @@ describe('manager/gitlabci/update', () => { }); it('returns null if service-image mismatch', () => { const upgrade = { - lineNumber: 17, + managerData: { lineNumber: 17 }, depType: 'service-image', depName: 'postgres', newValue: '9.6.8', @@ -87,7 +87,7 @@ describe('manager/gitlabci/update', () => { it('returns service-image same', () => { const upgrade = { depType: 'serviceimage', - lineNumber: 55, + managerData: { lineNumber: 55 }, depName: 'docker', newValue: 'dind', }; diff --git a/test/manager/kubernetes/__snapshots__/extract.spec.js.snap b/test/manager/kubernetes/__snapshots__/extract.spec.js.snap index 3ba76e62227194b01884fb93ea200522a5c73d15..7454d333c04212e50722d7ce41e587526b208e80 100644 --- a/test/manager/kubernetes/__snapshots__/extract.spec.js.snap +++ b/test/manager/kubernetes/__snapshots__/extract.spec.js.snap @@ -3,13 +3,13 @@ exports[`lib/manager/kubernetes/extract extractPackageFile() extracts image line in a YAML array 1`] = ` Array [ Object { - "currentDepTag": "quay.io/external_storage/local-volume-provisioner:v2.1.0", "currentDigest": undefined, - "currentFrom": "quay.io/external_storage/local-volume-provisioner:v2.1.0", "currentValue": "v2.1.0", "datasource": "docker", "depName": "quay.io/external_storage/local-volume-provisioner", - "lineNumber": 14, + "managerData": Object { + "lineNumber": 14, + }, }, ] `; @@ -17,22 +17,22 @@ Array [ exports[`lib/manager/kubernetes/extract extractPackageFile() extracts multiple image lines 1`] = ` Array [ Object { - "currentDepTag": "nginx:1.7.9", "currentDigest": undefined, - "currentFrom": "nginx:1.7.9", "currentValue": "1.7.9", "datasource": "docker", "depName": "nginx", - "lineNumber": 18, + "managerData": Object { + "lineNumber": 18, + }, }, Object { - "currentDepTag": "k8s.gcr.io/kube-proxy-amd64:v1.11.1", "currentDigest": undefined, - "currentFrom": "k8s.gcr.io/kube-proxy-amd64:v1.11.1", "currentValue": "v1.11.1", "datasource": "docker", "depName": "k8s.gcr.io/kube-proxy-amd64", - "lineNumber": 46, + "managerData": Object { + "lineNumber": 46, + }, }, ] `; diff --git a/test/manager/kubernetes/update.spec.js b/test/manager/kubernetes/update.spec.js index b9699e90a185ab83c240f52dba06fda835446e1d..df19b6fb6bedfc69a1523ec11568aef68f6c81dc 100644 --- a/test/manager/kubernetes/update.spec.js +++ b/test/manager/kubernetes/update.spec.js @@ -15,7 +15,7 @@ describe('manager/kubernetes/update', () => { describe('updateDependency', () => { it('replaces existing value', () => { const upgrade = { - lineNumber: 18, + managerData: { lineNumber: 18 }, depName: 'nginx', newValue: '1.15.1', newDigest: 'sha256:abcdefghijklmnop', @@ -26,7 +26,7 @@ describe('manager/kubernetes/update', () => { }); it('returns same', () => { const upgrade = { - lineNumber: 46, + managerData: { lineNumber: 46 }, depName: 'k8s.gcr.io/kube-proxy-amd64', newValue: 'v1.11.1', }; @@ -35,7 +35,7 @@ describe('manager/kubernetes/update', () => { }); it('returns null if mismatch', () => { const upgrade = { - lineNumber: 1, + managerData: { lineNumber: 1 }, newFrom: 'k8s.gcr.io/kube-proxy-amd64:v1.11.1', }; const res = dcUpdate.updateDependency(yamlFile, upgrade); @@ -47,7 +47,7 @@ describe('manager/kubernetes/update', () => { }); it('replaces image inside YAML array', () => { const upgrade = { - lineNumber: 14, + managerData: { lineNumber: 14 }, depName: 'quay.io/external_storage/local-volume-provisioner', newValue: 'v2.2.0', };