From d20f64ad2a2d298d15e2ac7bde2d1e0c05735596 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Mon, 25 Feb 2019 22:35:25 +0100 Subject: [PATCH] feat(bazel): update git_repository commit hashes Closes https://github.com/renovatebot/config-help/issues/173 --- lib/manager/bazel/extract.js | 14 ++++++++++++-- .../bazel/__snapshots__/extract.spec.js.snap | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/lib/manager/bazel/extract.js b/lib/manager/bazel/extract.js index 1b839b5a30..0ffa2a1b77 100644 --- a/lib/manager/bazel/extract.js +++ b/lib/manager/bazel/extract.js @@ -85,10 +85,20 @@ function extractPackageFile(content) { [, importpath] = match; } logger.debug({ dependency: depName, remote, currentValue }); - if (depType === 'git_repository' && depName && remote && currentValue) { + if ( + depType === 'git_repository' && + depName && + remote && + (currentValue || commit) + ) { dep.depName = depName; dep.remote = remote; - dep.currentValue = currentValue; + if (currentValue) { + dep.currentValue = currentValue; + } + if (commit) { + dep.currentDigest = commit; + } const repo = parse(remote).substring('https://github.com/'.length); dep.datasource = 'github'; dep.lookupName = repo; diff --git a/test/manager/bazel/__snapshots__/extract.spec.js.snap b/test/manager/bazel/__snapshots__/extract.spec.js.snap index 47ce0d4d38..609afe3125 100644 --- a/test/manager/bazel/__snapshots__/extract.spec.js.snap +++ b/test/manager/bazel/__snapshots__/extract.spec.js.snap @@ -86,6 +86,21 @@ Array [ "lookupName": "bazelbuild/rules_sass", "remote": "https://github.com/bazelbuild/rules_sass.git", }, + Object { + "currentDigest": "b3b620e8bcff18ed3378cd3f35ebeb7016d71f71", + "datasource": "github", + "def": "git_repository( + name = \\"com_github_bazelbuild_buildtools\\", + remote = \\"https://github.com/bazelbuild/buildtools.git\\", + # Note, this commit matches the version of buildifier in angular/ngcontainer + commit = \\"b3b620e8bcff18ed3378cd3f35ebeb7016d71f71\\", +) +", + "depName": "com_github_bazelbuild_buildtools", + "depType": "git_repository", + "lookupName": "bazelbuild/buildtools", + "remote": "https://github.com/bazelbuild/buildtools.git", + }, Object { "currentValue": "0.7.1", "datasource": "github", -- GitLab