diff --git a/lib/manager/bazel/extract.js b/lib/manager/bazel/extract.js index 1b839b5a303a98fb9ff0caa4f31dc12fdf239f08..0ffa2a1b77bc7b15245b97d49931b558a9640009 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 47ce0d4d388cdd8cf3897633620a344737c21f37..609afe3125d90f7953def89081cdf492311dbf00 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",