Skip to content

Uniform all temporary directories and allow customizing temp path #32352

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

Merged
merged 40 commits into from
Apr 8, 2025

Conversation

lunny
Copy link
Member

@lunny lunny commented Oct 27, 2024

This PR uniform all temporary directory usage so that it will be easier to manage.

Relate to #31792

  • Added a new setting to allow users to configure the global temporary directory.
  • Move all temporary files and directories to be placed under os.Temp()/gitea.
  • setting.Repository.Local.LocalCopyPath now will be setting.TempPath/local-repo and the customized path is removed.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;[repository.local]
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; Path for local repository copy. Defaults to  TEMP_PATH + `local-repo`, this is deprecated and cannot be changed
-;LOCAL_COPY_PATH = local-repo
  • setting.Repository.Upload.TempPath now will be settting.TempPath/uploads and the customized path is removed.
;[repository.upload]
-;;
-;; Path for uploads. Defaults to TEMP_PATH + `uploads`
-;TEMP_PATH = uploads
  • setting.Packages.ChunkedUploadPath now will be settting.TempPath/package-upload and the customized path is removed.
;[packages]
-;;
-;; Path for chunked uploads. Defaults it's `package-upload` under `TEMP_PATH` unless it's an absolute path.
-;CHUNKED_UPLOAD_PATH = package-upload
  • setting.SSH.KeyTestPath now will be settting.TempPath/ssh_key_test and the customized path is removed.
[server]
-;;
-;; Directory to create temporary files in when testing public keys using ssh-keygen,
-;; default is the system temporary directory.
-;SSH_KEY_TEST_PATH =

TODO:

  • setting.PprofDataPath haven't been changed because it may need to be kept until somebody read it but temp path may be clean up any time.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 27, 2024
@lunny lunny added type/refactoring Existing code has been cleaned up. There should be no new functionality. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/L labels Oct 27, 2024
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/migrations modifies/internal labels Oct 27, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 27, 2024
@github-actions github-actions bot added the docs-update-needed The document needs to be updated synchronously label Mar 27, 2025
@wxiaoguang wxiaoguang force-pushed the lunny/uniform-temp-dir branch 2 times, most recently from 4aefe79 to f31dc5f Compare April 7, 2025 05:01
@github-actions github-actions bot removed the modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin label Apr 7, 2025
@wxiaoguang wxiaoguang force-pushed the lunny/uniform-temp-dir branch from f31dc5f to dd72086 Compare April 7, 2025 05:19
@github-actions github-actions bot added the modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin label Apr 7, 2025
@wxiaoguang wxiaoguang changed the title Uniform all temporary directories and allow customize temp_path Uniform all temporary directories and disallow customizing temp path Apr 7, 2025
@wxiaoguang wxiaoguang force-pushed the lunny/uniform-temp-dir branch 2 times, most recently from bcaca91 to a1de833 Compare April 7, 2025 05:34
@wxiaoguang wxiaoguang force-pushed the lunny/uniform-temp-dir branch from a1de833 to e40bfb8 Compare April 7, 2025 05:59
@wxiaoguang
Copy link
Contributor

Feel free to complete RemoveOutdated and add more tests for TempDir

@wxiaoguang wxiaoguang force-pushed the lunny/uniform-temp-dir branch from 01b4cb2 to 47ea426 Compare April 7, 2025 08:13
@wxiaoguang wxiaoguang changed the title Uniform all temporary directories and disallow customizing temp path Uniform all temporary directories and allow customizing temp path Apr 7, 2025
@wxiaoguang
Copy link
Contributor

Does the new change look good to you?

@lunny
Copy link
Member Author

lunny commented Apr 8, 2025

Does the new change look good to you?

Looks good to me except left tasks.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 8, 2025
@wxiaoguang wxiaoguang force-pushed the lunny/uniform-temp-dir branch from dc6e816 to 60f8f10 Compare April 8, 2025 13:52
@wxiaoguang wxiaoguang force-pushed the lunny/uniform-temp-dir branch from 60f8f10 to a7371fa Compare April 8, 2025 14:05
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 8, 2025
@lunny lunny enabled auto-merge (squash) April 8, 2025 15:51
@lunny lunny merged commit 32b97b3 into go-gitea:main Apr 8, 2025
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 8, 2025
@wxiaoguang wxiaoguang deleted the lunny/uniform-temp-dir branch April 8, 2025 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-update-needed The document needs to be updated synchronously lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/go Pull requests that update Go code modifies/migrations modifies/templates This PR modifies the template files modifies/translation type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants