dependabot-core
dependabot-core copied to clipboard
Dependabot raises RuntimeError instead of opening PR for new version
Package ecosystem terraform Package manager version 1.x Language version 1.x Manifest location and content before the Dependabot update reference to a private terraform module dependabot.yml content
---
version: 2
registries:
coop-terraform:
type: terraform-registry
url: https://terraform.coop.no
token: ${{ secrets.TFE_TOKEN }}
coop-ghcr:
type: docker-registry
url: ghcr.io
username: CoopGithubServiceaccount
password: ${{ secrets.DEPENDABOT_GHCR_PULL }}
updates:
- package-ecosystem: "terraform"
directory: "/azure"
registries:
- coop-terraform
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: "terraform"
directory: "/management"
registries:
- coop-terraform
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: "terraform"
directory: "/projects"
registries:
- coop-terraform
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: "terraform"
directory: "/sandboxes"
registries:
- coop-terraform
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: "terraform"
directory: "/teams"
registries:
- coop-terraform
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: "terraform"
directory: "/tfe-workspaces"
registries:
- coop-terraform
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
- package-ecosystem: "docker"
directory: "/docker-compose"
registries:
- coop-ghcr
schedule:
interval: "daily"
Updated dependency from 0.8.0 to 1.0.5 (from old to new version model What you expected to see, versus what you actually saw Expected: A PR with an update for the new version Actually: Dependabot throws an error:
updater | ERROR <job_362442582> Error processing coopnorge/repos/github (RuntimeError)
updater | ERROR <job_362442582> Content didn't change!
Native package manager behavior
it will just update, this error above is from dependabot code ref, not terraform
For me, the question i, why is this raise
even there, why should it case about the non diff.
Images of the diff or a link to the PR, issue, or logs
https://terraform.coop.no:443/api/registry/v1/modules/coopnorge/repos/github/versions
proxy | 2022/05/10 16:44:57 [053] * authenticating terraform registry request (host: terraform.coop.no)
proxy | 2022/05/10 16:44:57 [053] 200 https://terraform.coop.no:443/api/registry/v1/modules/coopnorge/repos/github/versions
updater | INFO <job_362442582> Latest version is 1.8.0
updater | INFO <job_362442582> Requirements to unlock own
updater | INFO <job_362442582> Requirements update strategy
updater | INFO <job_362442582> Updating coopnorge/repos/github from 1.7.0 to 1.8.0
updater | I, [2022-05-10T16:44:57.967954 #7] INFO -- sentry: ** [Raven] Sending event ae837566be5549c0ae3582df2da0fecf to Sentry
proxy | 2022/05/10 16:44:58 [055] POST https://sentry.io:443/api/1451818/store/
proxy | 2022/05/10 16:44:58 [055] 200 https://sentry.io:443/api/1451818/store/
updater | ERROR <job_362442582> Error processing coopnorge/repos/github (RuntimeError)
updater | ERROR <job_362442582> Content didn't change!
updater | ERROR <job_362442582> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-terraform-0.185.0/lib/dependabot/terraform/file_updater.rb:30:in `block in updated_dependency_files'
Diff between 1.7.0 and 1.8.0 is
git diff 1.7.0 1.8.0
diff --git a/variables.tf b/variables.tf
index db45747..7cef4e4 100644
--- a/variables.tf
+++ b/variables.tf
@@ -159,7 +159,7 @@ variable "writeback_installation_id" {
variable "allow_auto_merge" {
type = bool
- default = false
+ default = true
description = "Allow pull requests to auto merge when requirements are met."
}
🕹 Bonus points: Smallest manifest that reproduces the issue
The repo (check also dependabot config) contains multiple directories, but this module is only used in the projects directory.
updated the module to 1.9.0 with the following change,
--- a/main.tf
+++ b/main.tf
@@ -17,6 +17,10 @@ locals {
labels = concat(local.default_labels, var.labels)
template = defaults(var.template, { owner = "coopnorge" })
+
+ migrate_repo_switch = var.mirror.source_repo_url == "" ? 0 : 1
+ migrate_repo_dependency = local.migrate_repo_switch == 0 ? [] : [null_resource.migrate_repo[0], ]
+
}
resource "github_issue_label" "repo-label" {
@@ -91,6 +95,8 @@ resource "github_repository" "repo" {
}
}
resource "null_resource" "migrate_repo" {
+ count = local.migrate_repo_switch
+
depends_on = [
github_repository.repo,
]
@@ -142,7 +148,7 @@ resource "github_team_repository" "access" {
resource "github_branch_protection" "protected_branch" {
depends_on = [
- null_resource.migrate_repo,
+ local.migrate_repo_dependency,
]
count = var.protect_default_branch ? 1 : 0
diff --git a/variables.tf b/variables.tf
index db45747..7cef4e4 100644
--- a/variables.tf
+++ b/variables.tf
@@ -159,7 +159,7 @@ variable "writeback_installation_id" {
variable "allow_auto_merge" {
type = bool
- default = false
+ default = true
description = "Allow pull requests to auto merge when requirements are met."
}
it then still shows the same error, but then instead of going form 1.7.0 to 1.8.0 , 1.7.0 to 1.9.0
Just a note, the module is used multiple times in this folder
@AtzeDeVries any interest in submitting a PR improving this? The discussion here might be helpful: https://github.com/dependabot/dependabot-core/pull/5168#issuecomment-1148006567
I am facing similar error too. The github private repo which i use in my terraform config has sub modules and it is able to identify the latest version but fails after that (RuntimeError)
updater | ERROR <job_445956799> Content didn't change!
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-terraform-0.211.0/lib/dependabot/terraform/file_updater.rb:30:in `block in updated_dependency_files'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-terraform-0.211.0/lib/dependabot/terraform/file_updater.rb:25:in `each'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/vendor/ruby/2.7.0/gems/dependabot-terraform-0.211.0/lib/dependabot/terraform/file_updater.rb:25:in `updated_dependency_files'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:713:in `generate_dependency_files_for'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:284:in `check_and_create_pull_request'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:86:in `check_and_create_pr_with_error_handling'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:57:in `block in run'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:57:in `each'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:57:in `run'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/lib/dependabot/update_files_job.rb:17:in `perform_job'
updater | ERROR <job_445956799> /home/dependabot/dependabot-updater/lib/dependabot/base_job.rb:35:in `run'
updater | ERROR <job_445956799> bin/update_files.rb:22:in `<main>'
updater | INFO <job_445956799> Finished job processing
updater | INFO Results:
updater | Dependabot encountered '1' error(s) during execution, please check the logs for more details.
updater | time="2022-08-25T07:09:16Z" level=info msg="task complete" container_id=job-445956799-updater exit_code=0 job_id=445956799 step=updater
Hmm, it looks like a pull request I prepared https://github.com/dependabot/dependabot-core/pull/5786 might address this issue.
@AtzeDeVries did #5786 resolve the problem for you?
@AtzeDeVries I'll just close assuming this has been fixed, but if you're still running into this feel free to reopen. Thanks!