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

fixes #2689 Make the external url of cache server configurable if necessary #2690

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Zoupers
Copy link

@Zoupers Zoupers commented Mar 3, 2025

According to this pr, fix the test and optimize the code.
Fix #2689 .

linw1995 and others added 2 commits March 4, 2025 00:16
Signed-off-by: Zoupers <qy@zouper.cn>
@Zoupers Zoupers changed the title Make the external url of cache server configurable if necessary fix #2689 Make the external url of cache server configurable if necessary Mar 3, 2025
@Zoupers Zoupers changed the title fix #2689 Make the external url of cache server configurable if necessary fixes #2689 Make the external url of cache server configurable if necessary Mar 3, 2025
@ChristopherHX
Copy link
Contributor

I wanted to deploy the cache server as a separate Deployment/Service from the runner, so I had set 0.0.0.0 as the host for the cache server.

cache:
  enabled: true
  host: "0.0.0.0"
  port: 80

If you have the same usecase, we should add an subcommand to the act cli to start the cache server independently as well.

Per https://gitea.com/gitea/act_runner/issues/668#issuecomment-968966

I make the way free for a merge, looks good to me

Comment on lines +75 to +77
if advertiseURL != "" {
h.advertiseURL = advertiseURL
} else if outboundIP != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would still assign h.outboundIP here even if advertiseURL is passed, while it looks to be not necessary

Suggested change
if advertiseURL != "" {
h.advertiseURL = advertiseURL
} else if outboundIP != "" {
if advertiseURL != "" {
h.advertiseURL = advertiseURL
}
if outboundIP != "" {

Copy link
Author

Choose a reason for hiding this comment

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

OK, I have hesitated whether to assign values separately, because if in the future the function of outboundIP has changed to bind specific address, this change will be not cool. I will take your suggestion.

@@ -118,6 +118,7 @@ func createRootCommand(ctx context.Context, input *Input, version string) *cobra
rootCmd.PersistentFlags().BoolVarP(&input.noSkipCheckout, "no-skip-checkout", "", false, "Use actions/checkout instead of copying local files into container")
rootCmd.PersistentFlags().BoolVarP(&input.noCacheServer, "no-cache-server", "", false, "Disable cache server")
rootCmd.PersistentFlags().StringVarP(&input.cacheServerPath, "cache-server-path", "", filepath.Join(CacheHomeDir, "actcache"), "Defines the path where the cache server stores caches.")
rootCmd.PersistentFlags().StringVarP(&input.cacheServerAdvertiseURL, "cache-server-advertise-url", "", "", "Defines the URL for advertising the cache server behind a proxy. e.g.: https://act-cache-server.example.com. Be careful that there is no trailing slash.")
Copy link
Contributor

Choose a reason for hiding this comment

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

I like --cache-server-external-url more, including this makes cache-server-addr to be ignored.

Unrelated, based on the code the description of Defines the address to which the cache server binds feels wrong

Copy link
Author

Choose a reason for hiding this comment

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

OK, I will adjust the description and option.

Copy link

codecov bot commented Mar 3, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 74.42%. Comparing base (5a80a04) to head (5eb1e87).
Report is 185 commits behind head on master.

Files with missing lines Patch % Lines
pkg/artifactcache/handler.go 70.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2690       +/-   ##
===========================================
+ Coverage   61.56%   74.42%   +12.85%     
===========================================
  Files          53       72       +19     
  Lines        9002    11061     +2059     
===========================================
+ Hits         5542     8232     +2690     
+ Misses       3020     2192      -828     
- Partials      440      637      +197     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@actions/cache with external cache server connecting wrong IP (0.0.0.0)
3 participants