mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-07-07 04:19:06 +00:00
Skip settings proxy config with WithProxy if its empty (#2242)
close #2208
This commit is contained in:
parent
a5ef372190
commit
55e98a186a
@ -25,6 +25,10 @@ import (
|
|||||||
// Option configures a compiler option.
|
// Option configures a compiler option.
|
||||||
type Option func(*Compiler)
|
type Option func(*Compiler)
|
||||||
|
|
||||||
|
func noopOption() Option {
|
||||||
|
return func(*Compiler) {}
|
||||||
|
}
|
||||||
|
|
||||||
// WithOption configures the compiler with the given option if
|
// WithOption configures the compiler with the given option if
|
||||||
// boolean b evaluates to true.
|
// boolean b evaluates to true.
|
||||||
func WithOption(option Option, b bool) Option {
|
func WithOption(option Option, b bool) Option {
|
||||||
@ -226,6 +230,11 @@ type ProxyOptions struct {
|
|||||||
// and NO_PROXY environment variables added by default to every
|
// and NO_PROXY environment variables added by default to every
|
||||||
// container in the pipeline.
|
// container in the pipeline.
|
||||||
func WithProxy(opt ProxyOptions) Option {
|
func WithProxy(opt ProxyOptions) Option {
|
||||||
|
if opt.HTTPProxy == "" &&
|
||||||
|
opt.HTTPSProxy == "" &&
|
||||||
|
opt.NoProxy == "" {
|
||||||
|
return noopOption()
|
||||||
|
}
|
||||||
return WithEnviron(
|
return WithEnviron(
|
||||||
map[string]string{
|
map[string]string{
|
||||||
"no_proxy": opt.NoProxy,
|
"no_proxy": opt.NoProxy,
|
||||||
|
Loading…
Reference in New Issue
Block a user