From 55e98a186a4aab80cbb149b14de1fcdf85779703 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Aug 2023 13:09:28 +0200 Subject: [PATCH] Skip settings proxy config with WithProxy if its empty (#2242) close #2208 --- pipeline/frontend/yaml/compiler/option.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pipeline/frontend/yaml/compiler/option.go b/pipeline/frontend/yaml/compiler/option.go index 65d9908f9..d451ef6b4 100644 --- a/pipeline/frontend/yaml/compiler/option.go +++ b/pipeline/frontend/yaml/compiler/option.go @@ -25,6 +25,10 @@ import ( // Option configures a compiler option. type Option func(*Compiler) +func noopOption() Option { + return func(*Compiler) {} +} + // WithOption configures the compiler with the given option if // boolean b evaluates to true. func WithOption(option Option, b bool) Option { @@ -226,6 +230,11 @@ type ProxyOptions struct { // and NO_PROXY environment variables added by default to every // container in the pipeline. func WithProxy(opt ProxyOptions) Option { + if opt.HTTPProxy == "" && + opt.HTTPSProxy == "" && + opt.NoProxy == "" { + return noopOption() + } return WithEnviron( map[string]string{ "no_proxy": opt.NoProxy,