Skip to content

fix(api): remove the terraform releases temp folder after each download - #4070

Open
dhananjay6561 wants to merge 2 commits into
terrakube-io:mainfrom
dhananjay6561:fix/terraform-releases-temp-dir
Open

dhananjay6561 wants to merge 2 commits into
terrakube-io:mainfrom
dhananjay6561:fix/terraform-releases-temp-dir

Conversation

@dhananjay6561

Copy link
Copy Markdown
Contributor

What changed and why?

Fixes #4069

GET /terraform/index.json downloads the releases into <tmpdir>/<uuid>/terraform-releases.json on every cache miss. On success only the file was deleted, so an empty folder stayed behind every refresh. On a failed download or read nothing was deleted, so the folder and the partial file stayed too.

The folder is now created path first and deleted with FileUtils.deleteQuietly in a finally block, so it goes away on both paths. The response and Redis caching are unchanged.

Testing

Ran: no local build, relying on CI
Checked: TerraformJsonControllerTest covers a successful download and a failed one that falls back to the stale cache, and checks the temp folder is gone after each

Signed-off-by: dhananjay6561 <dhananjayaggarwal6561@gmail.com>
Signed-off-by: dhananjay6561 <dhananjayaggarwal6561@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 04:36
@dhananjay6561

Copy link
Copy Markdown
Contributor Author

@Macbet @alfespa17 small one: the terraform releases proxy was leaving a temp folder behind on every cache refresh, this cleans it up in a finally block. Would appreciate a look when you get a chance, thanks!

@github-actions github-actions Bot added terrakube-api author/contributor Authored by a returning contributor size/M 50-249 lines changed type/fix Bug fix labels Nov 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/contributor Authored by a returning contributor size/M 50-249 lines changed terrakube-api type/fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terraform releases proxy leaves a temp folder behind on every cache refresh

2 participants