Bug 1366475 - Cannot rebuild an existing image using s2i tool
Summary: Cannot rebuild an existing image using s2i tool
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Build
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Gabe Montero
QA Contact: Wang Haoran
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-12 05:35 UTC by Dongbo Yan
Modified: 2017-03-08 18:26 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: the s2i builder image value was not getting properly set on a s2i rebuild invocation. Consequence: all s2i rebuild invocations would fail. Fix: change the code so that it inspects the existing image on rebuild and populates the config from its labels instead of the builder's labels, but still inspect the builder image on typical s2i build invocations. Result: both s2i build and s2i rebuild now work.
Clone Of:
Environment:
Last Closed: 2016-09-27 09:43:54 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1933 normal SHIPPED_LIVE Red Hat OpenShift Container Platform 3.3 Release Advisory 2016-09-27 13:24:36 UTC

Description Dongbo Yan 2016-08-12 05:35:00 UTC
Description of problem:
Cannot rebuild an existing image using s2i tool

Version-Release number of selected component (if applicable):
s2i v1.1.1

How reproducible:
Always

Steps to Reproduce:
1.Build the image from source
 $ s2i build https://github.com/openshift/sti-php.git --context-dir=5.5/test/test-app registry.access.redhat.com/openshift3/php-55-rhel7 rack-test-app --incremental=true --loglevel=5

2.Rebuild the images
 $ s2i rebuild rack-test-app:latest rack-test-app:v1 --force-pull=false -p never --loglevel=5

Actual results:
Cannot rebuild
I0811 23:06:23.688845    2929 util.go:192] Checking if image "" is available locally ...
I0811 23:06:23.690092    2929 docker.go:459] error inspecting image :latest: no such image
E0811 23:06:23.690959    2929 main.go:355] An error occurred: unable to get metadata for :latest
E0811 23:06:23.690970    2929 main.go:356] Suggested solution: check image name
I0811 23:06:23.690975    2929 main.go:358] Details: no such image
E0811 23:06:23.690981    2929 main.go:362] If the problem persists consult the docs at https://github.com/openshift/source-to-image/tree/master/docs. Eventually reach us on freenode #openshift or file an issue at https://github.com/openshift/source-to-image/issues providing us with a log from your build using --loglevel=3

Expected results:
Rebuild image successfully

Additional info:
s2i tool
https://github.com/openshift/source-to-image/releases/download/v1.1.1/source-to-image-v1.1.1-724c0dd-linux-amd64.tar.gz

Comment 1 Gabe Montero 2016-08-12 14:21:18 UTC
So stepping through this in the delve debugger accelerated the diagnosis.

Turns out that the config.BuilderImage field is not set on `s2i rebuild` when docker.GetBuilderImage is called.

I tried to see if a given commit introduced this, but nothing conclusive came up.  Slava had a change back in May in the rebuild path but it seems unrelated.

I am going to work up a pull that inspects the existing image on rebuild and populates the config from its labels instead of the builder's labels.

Comment 3 openshift-github-bot 2016-08-12 19:14:50 UTC
Commits pushed to master at https://github.com/openshift/source-to-image

https://github.com/openshift/source-to-image/commit/8c24edb036b6bffa9292fc1afbe49b732faa99b5
s2i: s2i rebuild broken

Bug 1366475
Bugzilla link https://bugzilla.redhat.com/show_bug.cgi?id=1366475
Detailed explanation
an attempt to pull the builder image to obtain labels was made; the correct thing was
to pull the locally build image we were rebuilding

https://github.com/openshift/source-to-image/commit/89b96680e451c0fa438446043f967b5660942974
Merge pull request #570 from gabemontero/bug1366475

Merged by openshift-bot

Comment 4 Gabe Montero 2016-08-12 19:49:53 UTC
If QE can build a new version of s2i from https://github.com/openshift/source-to-image, they should be able to verify this defect.

Comment 5 Dongbo Yan 2016-08-15 03:28:31 UTC
Verified 
install s2i tool:
 $git clone https://github.com/openshift/source-to-image.git
 $cd source-to-image
 $hack/build-go.sh

s2i version:
s2i v1.1.1-24-g89b9668

[root@ip-172-18-8-65 ~]# s2i rebuild rack-test-app:latest rack-test-app:v1 --force-pull=false  -p never --loglevel=5
I0814 22:49:42.457265    3364 util.go:193] Checking if image "rack-test-app:latest" is available locally ...
I0814 22:49:42.462200    3364 util.go:193] Checking if image "registry.access.redhat.com/openshift3/php-55-rhel7" is available locally ...
I0814 22:49:42.465053    3364 main.go:242] 
Application Name:		rack-test-app
Description:			Platform for building and running PHP 5.5 applications
Builder Name:			Apache 2.4 with PHP 5.5
Builder Image:			registry.access.redhat.com/openshift3/php-55-rhel7
Source:				https://github.com/openshift/sti-php.git
Source Ref:			master
Context Directory:		5.5/test/test-app
Output Image Tag:		rack-test-app:v1
Environment:			
Incremental Build:		disabled
Remove Old Build:		disabled
Builder Pull Policy:		never
Previous Image Pull Policy:	if-not-present
Quiet:				disabled
Layered Build:			disabled
S2I Scripts URL:		image:///usr/libexec/s2i
Docker Endpoint:		unix:///var/run/docker.sock

I0814 22:49:42.465096    3364 util.go:193] Checking if image "registry.access.redhat.com/openshift3/php-55-rhel7" is available locally ...
I0814 22:49:42.469204    3364 docker.go:450] Using locally available image "registry.access.redhat.com/openshift3/php-55-rhel7:latest"
I0814 22:49:42.469225    3364 docker.go:587] Image sha256:fdb8a0bc7be0c4ba9f6c81df9bb8bfe91d1fe31f4b9016edd1f176f443b50fdd contains io.openshift.s2i.scripts-url set to "image:///usr/libexec/s2i"
I0814 22:49:42.469286    3364 scm.go:21] DownloadForSource https://github.com/openshift/sti-php.git
I0814 22:49:42.469298    3364 scm.go:28] return from ParseFile file exists false proto specified false use copy false
I0814 22:49:42.469341    3364 sti.go:176] Preparing to build rack-test-app:v1
I0814 22:49:42.469689    3364 clone.go:34] Downloading "https://github.com/openshift/sti-php.git" ("5.5/test/test-app") ...
I0814 22:49:42.469700    3364 clone.go:42] Cloning sources (deferring submodule init) into "/tmp/s2i068053321/upload/tmp"
Already on 'master'
I0814 22:49:42.724649    3364 clone.go:58] Checked out "master"
I0814 22:49:42.751185    3364 clone.go:63] Updated submodules for "master"
I0814 22:49:42.751205    3364 fs.go:159] Removing directory '/tmp/s2i068053321/upload/src'
I0814 22:49:42.751268    3364 fs.go:104] D "/tmp/s2i068053321/upload/tmp/5.5/test/test-app/." -> "/tmp/s2i068053321/upload/src"
I0814 22:49:42.751402    3364 fs.go:117] F "/tmp/s2i068053321/upload/tmp/5.5/test/test-app/composer.json" -> "/tmp/s2i068053321/upload/src/composer.json"
I0814 22:49:42.751485    3364 fs.go:117] F "/tmp/s2i068053321/upload/tmp/5.5/test/test-app/index.php" -> "/tmp/s2i068053321/upload/src/index.php"
I0814 22:49:42.762913    3364 fs.go:159] Removing directory '/tmp/s2i068053321/upload/tmp'
I0814 22:49:42.765223    3364 install.go:250] Using "assemble" installed from "image:///usr/libexec/s2i/assemble"
I0814 22:49:42.765239    3364 install.go:250] Using "run" installed from "image:///usr/libexec/s2i/run"
I0814 22:49:42.765251    3364 install.go:250] Using "save-artifacts" installed from "image:///usr/libexec/s2i/save-artifacts"
I0814 22:49:42.765270    3364 ignore.go:60] .s2iignore file does not exist
I0814 22:49:42.765277    3364 sti.go:185] Clean build will be performed
I0814 22:49:42.765282    3364 sti.go:188] Performing source build from https://github.com/openshift/sti-php.git
I0814 22:49:42.765302    3364 sti.go:199] Running "assemble" in "rack-test-app:v1"
I0814 22:49:42.765309    3364 sti.go:447] Using image name registry.access.redhat.com/openshift3/php-55-rhel7
I0814 22:49:42.765325    3364 sti.go:358] No user environment provided (no environment file found in application sources)
I0814 22:49:42.765541    3364 sti.go:552] starting the source uploading ...
I0814 22:49:42.765555    3364 tar.go:238] Adding "/tmp/s2i068053321/upload" to tar ...
I0814 22:49:42.765705    3364 tar.go:308] Adding to tar: /tmp/s2i068053321/upload/src/composer.json as src/composer.json
I0814 22:49:42.765754    3364 sti.go:571] 
I0814 22:49:42.768815    3364 docker.go:662] Base directory for S2I scripts is '/usr/libexec/s2i'. Untarring destination is '/tmp'.
I0814 22:49:42.768830    3364 docker.go:736] Setting "/bin/sh -c tar -C /tmp -xf - && /usr/libexec/s2i/assemble" command for container ...
I0814 22:49:42.768928    3364 docker.go:741] Creating container with options {Name:"s2i_registry_access_redhat_com_openshift3_php_55_rhel7_2e0cbcaf" Config:&{Hostname: Domainname: User: Memory:0 MemorySwap:0 MemoryReservation:0 KernelMemory:0 CPUShares:0 CPUSet: AttachStdin:false AttachStdout:true AttachStderr:false PortSpecs:[] ExposedPorts:map[] PublishService: ArgsEscaped:false StopSignal: Tty:false OpenStdin:true StdinOnce:true Env:[] Cmd:[/bin/sh -c tar -C /tmp -xf - && /usr/libexec/s2i/assemble] DNS:[] Image:registry.access.redhat.com/openshift3/php-55-rhel7:latest Volumes:map[] VolumeDriver: VolumesFrom: WorkingDir: MacAddress: Entrypoint:[/usr/bin/env] NetworkDisabled:false SecurityOpts:[] OnBuild:[] Mounts:[] Labels:map[]} HostConfig:&{Binds:[] CapAdd:[] CapDrop:[] GroupAdd:[] ContainerIDFile: LxcConf:[] Privileged:false PortBindings:map[] Links:[] PublishAllPorts:false DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] VolumesFrom:[] UsernsMode: NetworkMode: IpcMode: PidMode: UTSMode: RestartPolicy:{Name: MaximumRetryCount:0} Devices:[] LogConfig:{Type: Config:map[]} ReadonlyRootfs:false SecurityOpt:[] Cgroup: CgroupParent: Memory:0 MemoryReservation:0 KernelMemory:0 MemorySwap:0 MemorySwappiness:0 OOMKillDisable:false CPUShares:0 CPUSet: CPUSetCPUs: CPUSetMEMs: CPUQuota:0 CPUPeriod:0 BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteBps:[] BlkioDeviceWriteIOps:[] Ulimits:[] VolumeDriver: OomScoreAdj:0 PidsLimit:0 ShmSize:0 Tmpfs:map[] AutoRemove:false StorageOpt:map[] Sysctls:map[]}} ...
I0814 22:49:43.098173    3364 docker.go:772] Attaching to container "s2i_registry_access_redhat_com_openshift3_php_55_rhel7_2e0cbcaf" ...
I0814 22:49:43.098438    3364 docker.go:781] Starting container "s2i_registry_access_redhat_com_openshift3_php_55_rhel7_2e0cbcaf" ...
I0814 22:49:43.100854    3364 tar.go:308] Adding to tar: /tmp/s2i068053321/upload/src/index.php as src/index.php
I0814 22:49:43.412427    3364 docker.go:805] Waiting for container "s2i_registry_access_redhat_com_openshift3_php_55_rhel7_2e0cbcaf" to stop ...
I0814 22:49:43.479716    3364 sti.go:586] ---> Installing application source...
I0814 22:49:43.492867    3364 sti.go:586] Found 'composer.json', installing dependencies using composer.phar...
I0814 22:49:45.108099    3364 sti.go:586] Downloading 1.2.0...
I0814 22:49:46.391661    3364 sti.go:586] 
I0814 22:49:46.391696    3364 sti.go:586] Composer successfully installed to: /opt/app-root/src/composer.phar
I0814 22:49:46.391702    3364 sti.go:586] Use it: php composer.phar
I0814 22:49:46.391707    3364 sti.go:586] Some settings on your machine may cause stability issues with Composer.
I0814 22:49:46.391712    3364 sti.go:586] If you encounter issues, try to change the following:
I0814 22:49:46.391717    3364 sti.go:586] 
I0814 22:49:46.391735    3364 sti.go:586] The xdebug extension is loaded, this can slow down Composer a little.
I0814 22:49:46.391741    3364 sti.go:586] Disabling it when using Composer is recommended.
I0814 22:49:46.391745    3364 sti.go:586] 
I0814 22:49:46.548421    3364 sti.go:593] You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
I0814 22:49:46.560720    3364 sti.go:593] Loading composer repositories with package information
I0814 22:49:47.005063    3364 sti.go:593] Updating dependencies (including require-dev)
I0814 22:49:53.458595    3364 sti.go:593]   - Installing monolog/monolog (1.0.2)
I0814 22:49:53.460767    3364 sti.go:593]     Downloading
I0814 22:49:53.591779    3364 sti.go:593] 
I0814 22:49:54.028509    3364 sti.go:593] Writing lock file
I0814 22:49:54.029368    3364 sti.go:593] Generating optimized autoload files
I0814 22:49:54.545478    3364 docker.go:834] Invoking PostExecute function
I0814 22:49:54.545512    3364 postexecutorstep.go:59] Skipping step: store previous image
I0814 22:49:54.545519    3364 postexecutorstep.go:106] Executing step: commit image
I0814 22:49:54.545555    3364 sti.go:589] 
I0814 22:49:54.550579    3364 docker.go:882] Committing container with dockerOpts: {Container:70cf0c26a09e4047d1ef130e7f3a284309653f435a75d967a169ada9075dbc35 Repository:rack-test-app Tag:v1 Message: Author: Run:0xc8201914a0}, config: {Hostname: Domainname: User:1001 Memory:0 MemorySwap:0 MemoryReservation:0 KernelMemory:0 CPUShares:0 CPUSet: AttachStdin:false AttachStdout:false AttachStderr:false PortSpecs:[] ExposedPorts:map[] PublishService: ArgsEscaped:false StopSignal: Tty:false OpenStdin:false StdinOnce:false Env:[] Cmd:[/usr/libexec/s2i/run] DNS:[] Image: Volumes:map[] VolumeDriver: VolumesFrom: WorkingDir: MacAddress: Entrypoint:[container-entrypoint] NetworkDisabled:false SecurityOpts:[] OnBuild:[] Mounts:[] Labels:map[io.k8s.description:Platform for building and running PHP 5.5 applications architecture:x86_64 io.openshift.s2i.build.image:registry.access.redhat.com/openshift3/php-55-rhel7 io.openshift.s2i.build.source-context-dir:5.5/test/test-app distribution-scope:public io.openshift.s2i.build.commit.author:Andrew Lau <andrew@andrewklau.com> io.openshift.s2i.build.commit.id:9fbddc8f7951feaa069a7b3910c55f1d0b119f56 io.openshift.s2i.build.commit.message:Adding DOCUMENTROOT environment variable (#111) Vendor:Red Hat, Inc. Authoritative_Registry:registry.access.redhat.com io.openshift.s2i.build.commit.ref:master Build_Host:rcm-img-docker02.build.eng.bos.redhat.com Release:39 io.openshift.s2i.build.source-location:https://github.com/openshift/sti-php.git Name:openshift3/php-55-rhel7 vcs-ref:eafbac7f34fcffe1cc976e808da0ade4601122fe io.k8s.display-name:rack-test-app io.openshift.s2i.build.commit.date:Fri Jul 22 16:28:09 2016 +1000 com.redhat.build-host:rcm-img-docker02.build.eng.bos.redhat.com io.openshift.tags:builder,php,php55 io.s2i.scripts-url:image:///usr/libexec/s2i io.openshift.s2i.scripts-url:image:///usr/libexec/s2i Version:5.5 vcs-type:git Architecture:x86_64 build-date:2016-07-19T10:19:05.425390Z io.openshift.expose-services:8080:http BZComponent:openshift-sti-php-docker]}
I0814 22:50:00.346439    3364 postexecutorstep.go:362] Executing step: report success
I0814 22:50:00.346460    3364 postexecutorstep.go:367] Successfully built rack-test-app:v1
I0814 22:50:00.346467    3364 postexecutorstep.go:83] Skipping step: remove previous image
I0814 22:50:00.346472    3364 postexecutorstep.go:383] Skipping step: invoke callback url
I0814 22:50:00.346481    3364 docker.go:755] Removing container "s2i_registry_access_redhat_com_openshift3_php_55_rhel7_2e0cbcaf" ...
I0814 22:50:00.399373    3364 docker.go:759] Removed container "s2i_registry_access_redhat_com_openshift3_php_55_rhel7_2e0cbcaf"
I0814 22:50:00.399545    3364 cleanup.go:33] Removing temporary directory /tmp/s2i068053321
I0814 22:50:00.399555    3364 fs.go:159] Removing directory '/tmp/s2i068053321'

Comment 7 errata-xmlrpc 2016-09-27 09:43:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1933


Note You need to log in before you can comment on or make changes to this bug.