Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid terraform HCL files crash renovate process #19777

Closed
recombinationgroup opened this issue Jan 11, 2023 · 4 comments · Fixed by #19778
Closed

Invalid terraform HCL files crash renovate process #19777

recombinationgroup opened this issue Jan 11, 2023 · 4 comments · Fixed by #19778
Labels
status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality

Comments

@recombinationgroup
Copy link

How are you running Renovate?

Self-hosted

If you're self-hosting Renovate, tell us what version of Renovate you run.

34.97.6

If you're self-hosting Renovate, select which platform you are using.

None

If you're self-hosting Renovate, tell us what version of the platform you run.

No response

Was this something which used to work for you, and then stopped?

It used to work, and then stopped

Describe the bug

I have a repository which contains a terraform HCL file with invalid syntax. I use this HCL file as a template in terragrunt, which is why it is not valid on its own. If this file is discovered by the Terraform manager in renovate versions above or equal to 34.95.0, the renovate process exits with error. Previous versions of renovate worked on this repository.

The reason seems to be that renovate replaced the HCL file ingestion with a parser, which is very good. However, in my opinion, only one of the following should happen instead of a crash:

  • renovate ignores the file in question
  • renovate ignores the repository

Minimal example repository: https://github.com/recombinationgroup/renovate-bug-minimal-example-terraform-invalid-hcl

Relevant debug logs

Logs
 INFO: Repository finished (repository=[REDACTED])
       "cloned": true,
       "durationMs": 6278
DEBUG: Renovate exiting
 INFO: Renovate is exiting with a non-zero code due to the following logged errors
       "loggerErrors": [
         {
           "name": "renovate",
           "level": 50,
           "logContext": "9yd_3MIBA0dOpju05hlWR",
           "repository": "[REDACTED]",
           "err": {
             "message": "Cannot read properties of null (reading 'provider')",
             "stack": "TypeError: Cannot read properties of null (reading 'provider')\n    at ProvidersExtractor.extract (/opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/modules/manager/terraform/extractors/others/providers.ts:12:35)\n    at Object.extractPackageFile (/opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/modules/manager/terraform/extract.ts:44:28)\n    at getManagerPackageFiles (/opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/workers/repository/extract/manager-files.ts:52:19)\n    at /opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/workers/repository/extract/index.ts:47:28\n    at async Promise.all (index 0)\n    at extractAllDependencies (/opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/workers/repository/extract/index.ts:45:26)\n    at extract (/opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/workers/repository/process/extract-update.ts:117:20)\n    at extractDependencies (/opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/workers/repository/process/index.ts:120:26)\n    at Object.renovateRepository (/opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/workers/repository/index.ts:49:52)\n    at attributes.repository (/opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/workers/global/index.ts:181:11)\n    at start (/opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/workers/global/index.ts:166:7)\n    at /opt/buildpack/tools/renovate/34.97.6/node_modules/renovate/lib/renovate.ts:18:22"
           },
           "msg": "Repository has unknown error"
         }
       ]

Have you created a minimal reproduction repository?

I have linked to a minimal reproduction repository in the bug description

@recombinationgroup recombinationgroup added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality labels Jan 11, 2023
@rarkins
Copy link
Collaborator

rarkins commented Jan 11, 2023

The error is not reproduced for me when I run against https://github.com/renovate-reproductions/19777

@rarkins
Copy link
Collaborator

rarkins commented Jan 11, 2023

DEBUG: Using file match: ^\.woodpecker(?:\/[^/]+)?\.ya?ml$ for manager woodpecker (repository=renovate-reproductions/19777)
DEBUG: Matched 1 file(s) for manager terraform: main.tf (repository=renovate-reproductions/19777)
DEBUG: Found 0 package file(s) (repository=renovate-reproductions/19777)

@secustor
Copy link
Collaborator

Found the issue and preparing a fix right now.

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 34.98.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality
Projects
None yet
4 participants