Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1229661

Summary: proxy setting in build config only take effect for the first time.
Product: OpenShift Container Platform Reporter: Johnny Liu <jialiu>
Component: BuildAssignee: Ben Parees <bparees>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0.0CC: jialiu
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-10 13:59:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Johnny Liu 2015-06-09 11:24:02 UTC
Description of problem:


Version-Release number of selected component (if applicable):
openshift-0.5.2.2-0.git.26.701be15.el7ose.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Create app from repo:
# osc new-app https://github.com/openshift/simple-openshift-sinatra-sti.git
2. Edit bc to add http_proxy var
# osc edit bc
<--snip-->
  strategy:
    sourceStrategy:
      env:
      - name: HTTPS_PROXY
        value: <---my-proxy-url--->
      from:
        kind: DockerImage
        name: openshift/ruby-20-centos7
    type: Source
<--snip-->
3. Start build
osc start-build simple-openshift-sinatra-sti
4. Check build log
osc build-logs simple-openshift-sinatra-sti-1
5. Trigger another build
6. Check build log again.

Actual results:
In step 4, I could see https_proxy is exported in build env.
I0609 06:25:27.811274       1 cfg.go:50] Problem accessing /root/.dockercfg: stat /root/.dockercfg: no such file or directory
I0609 06:25:27.812348       1 sti.go:67] Creating a new S2I builder with build request: api.Request{BaseImage:"openshift/ruby-20-centos7", DockerConfig:(*api.DockerConfig)(0xc20803b200), DockerCfgPath:"", PullAuthentication:docker.AuthConfiguration{Username:"", Password:"", Email:"", ServerAddress:""}, PreserveWorkingDir:false, Source:"https://github.com/openshift/simple-openshift-sinatra-sti.git", Ref:"", Tag:"172.30.16.32:5000/jialiu/simple-openshift-sinatra-sti:latest", Incremental:false, RemovePreviousImage:false, Environment:map[string]string{"OPENSHIFT_BUILD_NAME":"simple-openshift-sinatra-sti-5", "OPENSHIFT_BUILD_NAMESPACE":"jialiu", "OPENSHIFT_BUILD_SOURCE":"https://github.com/openshift/simple-openshift-sinatra-sti.git", "HTTPS_PROXY":"<---my-proxy-url--->"}, CallbackURL:"", ScriptsURL:"", Location:"", ForcePull:false, WorkingDir:"", LayeredBuild:false, InstallDestination:"", Quiet:false, ContextDir:""}


In step 6, "HTTPS_PROXY" var is seen in build log, but it does not take any effect, because download gem failed. 
0609 06:41:46.318695       1 docker.go:294] Creating container using config: {Hostname: Domainname: User: Memory:0 MemorySwap:0 CPUShares:0 CPUSet: AttachStdin:false AttachStdout:true AttachStderr:false PortSpecs:[] ExposedPorts:map[] Tty:false OpenStdin:true StdinOnce:true Env:[OPENSHIFT_BUILD_NAME=simple-openshift-sinatra-sti-6 OPENSHIFT_BUILD_NAMESPACE=jialiu OPENSHIFT_BUILD_SOURCE=https://github.com/openshift/simple-openshift-sinatra-sti.git HTTPS_PROXY=<---my-proxy-url--->] Cmd:[/bin/sh -c tar -C /tmp -xf - && /usr/local/sti/assemble] DNS:[] Image:openshift/ruby-20-centos7 Volumes:map[] VolumesFrom: WorkingDir: MacAddress: Entrypoint:[] NetworkDisabled:false SecurityOpts:[] OnBuild:[] Labels:map[]}
I0609 06:41:47.439405       1 docker.go:301] Attaching to container
I0609 06:41:47.444655       1 docker.go:354] Starting container
I0609 06:41:47.643346       1 docker.go:364] Waiting for container
I0609 06:41:48.025155       1 sti.go:392] ---> Installing application source
I0609 06:41:48.040129       1 sti.go:392] ---> Building your Ruby application from source
I0609 06:41:48.040175       1 sti.go:392] ---> Running 'bundle install --deployment'
I0609 06:41:54.056380       1 sti.go:392] Fetching gem metadata from https://rubygems.org/..........
I0609 06:41:59.174467       1 sti.go:392] 
I0609 06:41:59.174511       1 sti.go:392] Gem::RemoteFetcher::FetchError: Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/gems/rack-1.5.2.gem)
I0609 06:41:59.190462       1 sti.go:392] An error occurred while installing rack (1.5.2), and Bundler cannot continue.
I0609 06:41:59.190516       1 sti.go:392] Make sure that `gem install rack -v '1.5.2'` succeeds before bundling.
I0609 06:41:59.571938       1 docker.go:370] Container exited
I0609 06:42:01.577714       1 cleanup.go:24] Removing temporary directory /tmp/sti069837988
I0609 06:42:01.577760       1 fs.go:99] Removing directory '/tmp/sti069837988'
F0609 06:42:01.586675       1 builder.go:75] Build error: non-zero (13) exit code from openshift/ruby-20-centos7

After step 6, if I change HTTPS_PROXY to another proxy, it take effect again.

Expected results:
user's proxy setting should always take effect.

Additional info:
In my network, it is not allowed to connect outside network directly, have to use proxy, if you do have such specific network, I think you could set a invalid proxy to reprocue this issue. That means, after you set an invalid proxy, gem install would fail for the 1st time, but would succeed for the 2nd time.

Comment 1 Ben Parees 2015-06-09 18:31:22 UTC
Is this consistently reproducible?  Given that the environment variable is clearly being passed in to the container doing the assemble, it seems like it has to be getting picked up, i'm wondering if your gem fetch hit a different temporary error.

Comment 2 Ben Parees 2015-06-09 20:51:24 UTC
note that i've been seeing reports of other people having intermittent issues accessing rubygems, so it you can test this with a different site (or just try it a few times to confirm that it doesn't always fail) that'd be good.