Bug 1363956 - Fail to do sti build with no inputs in buildConfig
Summary: Fail to do sti build with no inputs in buildConfig
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-04 06:54 UTC by Dongbo Yan
Modified: 2017-03-08 18:26 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2016-09-27 09:42:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


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

Description Dongbo Yan 2016-08-04 06:54:42 UTC
Description of problem:
When do sti build with no inputs in buildConfig, the build will fail

Version-Release number of selected component (if applicable):
openshift v3.3.0.14
kubernetes v1.3.0+57fb9ac
etcd 2.3.0+git

How reproducible:
Always

Steps to Reproduce:
1.Create a project, create bc with no inputs
 $ oc create -f https://raw.githubusercontent.com/openshift-qe/nosrc-extended-test-bldr/master/nosrc-setup.json
 $ oc start-build nosrc-bldr
 $ oc create -f https://raw.githubusercontent.com/openshift-qe/nosrc-extended-test-bldr/master/nosrc-test.json
2.Start a sti build
 $ oc start-build ruby-sample-build-ns
3.Check build status

Actual results:
Build is failed

Expected results:
Build is successful

Additional info:
Build-log:
oc logs -f build/ruby-sample-build-ns-2
I0804 01:33:51.728523       1 builder.go:53] $BUILD env var is {"kind":"Build","apiVersion":"v1","metadata":{"name":"ruby-sample-build-ns-2","namespace":"dyan-1","selfLink":"/oapi/v1/namespaces/dyan-1/builds/ruby-sample-build-ns-2","uid":"05ec657d-5a05-11e6-848b-fa163ece78fa","resourceVersion":"2171","creationTimestamp":"2016-08-04T05:33:50Z","labels":{"buildconfig":"ruby-sample-build-ns","name":"ruby-sample-build-ns","openshift.io/build-config.name":"ruby-sample-build-ns","openshift.io/build.start-policy":"Serial"},"annotations":{"openshift.io/build-config.name":"ruby-sample-build-ns","openshift.io/build.number":"2"}},"spec":{"serviceAccount":"builder","source":{"type":"None"},"strategy":{"type":"Source","sourceStrategy":{"from":{"kind":"DockerImage","name":"172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c"},"pullSecret":{"name":"builder-dockercfg-0bgjn"},"env":[{"name":"BUILD_LOGLEVEL","value":"5"}]}},"output":{},"resources":{},"postCommit":{},"triggeredBy":[{"message":"Manually triggered"}]},"status":{"phase":"New","config":{"kind":"BuildConfig","namespace":"dyan-1","name":"ruby-sample-build-ns"}}}
 
I0804 01:33:51.731434       1 builder.go:61] Build: &api.Build{TypeMeta:unversioned.TypeMeta{Kind:"", APIVersion:""}, ObjectMeta:api.ObjectMeta{Name:"ruby-sample-build-ns-2", GenerateName:"", Namespace:"dyan-1", SelfLink:"/oapi/v1/namespaces/dyan-1/builds/ruby-sample-build-ns-2", UID:"05ec657d-5a05-11e6-848b-fa163ece78fa", ResourceVersion:"2171", Generation:0, CreationTimestamp:unversioned.Time{Time:time.Time{sec:63605885630, nsec:0, loc:(*time.Location)(0x7f77d20)}}, DeletionTimestamp:(*unversioned.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{"name":"ruby-sample-build-ns", "openshift.io/build-config.name":"ruby-sample-build-ns", "openshift.io/build.start-policy":"Serial", "buildconfig":"ruby-sample-build-ns"}, Annotations:map[string]string{"openshift.io/build-config.name":"ruby-sample-build-ns", "openshift.io/build.number":"2"}, OwnerReferences:[]api.OwnerReference(nil), Finalizers:[]string(nil)}, Spec:api.BuildSpec{CommonSpec:api.CommonSpec{ServiceAccount:"builder", Source:api.BuildSource{Binary:(*api.BinaryBuildSource)(nil), Dockerfile:(*string)(nil), Git:(*api.GitBuildSource)(nil), Images:[]api.ImageSource(nil), ContextDir:"", SourceSecret:(*api.LocalObjectReference)(nil), Secrets:[]api.SecretBuildSource(nil)}, Revision:(*api.SourceRevision)(nil), Strategy:api.BuildStrategy{DockerStrategy:(*api.DockerBuildStrategy)(nil), SourceStrategy:(*api.SourceBuildStrategy)(0xc8208e2a90), CustomStrategy:(*api.CustomBuildStrategy)(nil), JenkinsPipelineStrategy:(*api.JenkinsPipelineBuildStrategy)(nil)}, Output:api.BuildOutput{To:(*api.ObjectReference)(nil), PushSecret:(*api.LocalObjectReference)(nil)}, Resources:api.ResourceRequirements{Limits:api.ResourceList(nil), Requests:api.ResourceList(nil)}, PostCommit:api.BuildPostCommitSpec{Command:[]string(nil), Args:[]string(nil), Script:""}, CompletionDeadlineSeconds:(*int64)(nil)}, TriggeredBy:[]api.BuildTriggerCause{api.BuildTriggerCause{Message:"Manually triggered", GenericWebHook:(*api.GenericWebHookCause)(nil), GitHubWebHook:(*api.GitHubWebHookCause)(nil), ImageChangeBuild:(*api.ImageChangeCause)(nil)}}}, Status:api.BuildStatus{Phase:"New", Cancelled:false, Reason:"", Message:"", StartTimestamp:(*unversioned.Time)(nil), CompletionTimestamp:(*unversioned.Time)(nil), Duration:0, OutputDockerImageReference:"", Config:(*api.ObjectReference)(0xc820251f80)}}
I0804 01:33:51.731574       1 builder.go:68] Master version "v3.3.0.14", Builder version "v3.3.0.14"
I0804 01:33:51.732058       1 builder.go:153] Running build with cgroup limits: api.CGroupLimits{MemoryLimitBytes:92233720368547, CPUShares:2, CPUPeriod:100000, CPUQuota:-1, MemorySwap:92233720368547}
I0804 01:33:51.734197       1 glog.go:50] With force pull false, setting policies to if-not-present
I0804 01:33:51.734212       1 glog.go:50] The value of ALLOWED_UIDS is [1-]
I0804 01:33:51.734222       1 glog.go:50] The value of DROP_CAPS is [KILL,MKNOD,SETGID,SETUID,SYS_CHROOT]
I0804 01:33:51.734230       1 cfg.go:45] Locating docker auth for image 172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c and type PULL_DOCKERCFG_PATH
I0804 01:33:51.734249       1 cfg.go:116] Using Docker authentication configuration in '/var/run/secrets/openshift.io/pull/.dockercfg'
I0804 01:33:51.734444       1 cfg.go:83] Using serviceaccount user for Docker authentication for image 172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c
I0804 01:33:51.734456       1 cfg.go:45] Locating docker auth for image ruby-sample-build-ns-2 and type PUSH_DOCKERCFG_PATH
I0804 01:33:51.734513       1 cfg.go:116] Using Docker authentication configuration in '/root/.docker/config.json'
I0804 01:33:51.735100       1 cfg.go:57] Problem accessing /root/.docker/config.json: stat /root/.docker/config.json: no such file or directory
I0804 01:33:51.737990       1 docker.go:450] Using locally available image "172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb2..."
I0804 01:33:51.740024       1 glog.go:50] Creating a new S2I builder with build config: "Builder Name:\t\t\tRuby 2.0\nBuilder Image:\t\t\t172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c\nBuilder Image Version:\t\t9151afcd54e33189cc9e06dce911aae9a758d1e8\nBuilder Base Version:\t\te178f1c\nSource:\t\t\t\tfile:///tmp/s2i-build020901590/upload/src\nOutput Image Tag:\t\tdyan-1/ruby-sample-build-ns-2:421798f0\nEnvironment:\t\t\tOPENSHIFT_BUILD_NAME=ruby-sample-build-ns-2,OPENSHIFT_BUILD_NAMESPACE=dyan-1,BUILD_LOGLEVEL=5\nIncremental Build:\t\tdisabled\nRemove Old Build:\t\tdisabled\nBuilder Pull Policy:\t\tif-not-present\nPrevious Image Pull Policy:\talways\nQuiet:\t\t\t\tdisabled\nLayered Build:\t\t\tdisabled\nWorkdir:\t\t\t/tmp/s2i-build020901590\nDocker NetworkMode:\t\tcontainer:70053a3bf9f6b34b620cd338e2a3050ec705a8ccfe57df218c6427a8eaacc755\nDocker Endpoint:\t\tunix:///var/run/docker.sock\nDocker Pull Config:\t\t/var/run/secrets/openshift.io/pull\nDocker Pull User:\t\tserviceaccount\n"
I0804 01:33:51.742015       1 docker.go:450] Using locally available image "172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb2..."
I0804 01:33:51.748079       1 docker.go:450] Using locally available image "172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb2..."
I0804 01:33:51.748098       1 docker.go:587] Image sha256:def0ce5023a39ce3bb26aa625f660c0eb703d12f5c87acc0b5909156dad755c4 contains io.openshift.s2i.scripts-url set to "image:///usr/libexec/s2i"
I0804 01:33:51.748149       1 glog.go:50] Starting S2I build from dyan-1/ruby-sample-build-ns-2 BuildConfig ...
I0804 01:33:51.748162       1 sti.go:170] Preparing to build dyan-1/ruby-sample-build-ns-2:421798f0
I0804 01:33:51.750568       1 install.go:250] Using "assemble" installed from "image:///usr/libexec/s2i/assemble"
I0804 01:33:51.750592       1 install.go:250] Using "run" installed from "image:///usr/libexec/s2i/run"
I0804 01:33:51.750605       1 install.go:250] Using "save-artifacts" installed from "image:///usr/libexec/s2i/save-artifacts"
I0804 01:33:51.750623       1 ignore.go:60] .s2iignore file does not exist
I0804 01:33:51.750633       1 sti.go:179] Clean build will be performed
I0804 01:33:51.750637       1 sti.go:182] Performing source build from file:///tmp/s2i-build020901590/upload/src
I0804 01:33:51.750648       1 sti.go:193] Running "assemble" in "dyan-1/ruby-sample-build-ns-2:421798f0"
I0804 01:33:51.750655       1 sti.go:441] Using image name 172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c
I0804 01:33:51.750668       1 sti.go:352] No user environment provided (no environment file found in application sources)
I0804 01:33:51.750788       1 sti.go:546] starting the source uploading ...
I0804 01:33:51.750817       1 tar.go:238] Adding "/tmp/s2i-build020901590/upload" to tar ...
I0804 01:33:51.750892       1 sti.go:565] 
I0804 01:33:51.754708       1 docker.go:587] Image sha256:def0ce5023a39ce3bb26aa625f660c0eb703d12f5c87acc0b5909156dad755c4 contains io.openshift.s2i.scripts-url set to "image:///usr/libexec/s2i"
I0804 01:33:51.754748       1 docker.go:662] Base directory for S2I scripts is '/usr/libexec/s2i'. Untarring destination is '/tmp'.
I0804 01:33:51.754765       1 docker.go:736] Setting "/bin/sh -c tar -C /tmp -xf - && /usr/libexec/s2i/assemble" command for container ...
I0804 01:33:51.754859       1 docker.go:741] Creating container with options {Name:"s2i_172_30_102_107_5000_dyan_1_nosrc_extended_test_builder_sha256_5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c_df02649a" Config:&{Hostname: Domainname: User: Memory:0 MemorySwap:0 MemoryReservation:0 KernelMemory:0 CPUShares:0 CPUSet: AttachStdin:false AttachStdout:true AttachStderr:false PortSpecs:[] ExposedPorts:map[] StopSignal: Tty:false OpenStdin:true StdinOnce:true Env:[OPENSHIFT_BUILD_NAME=ruby-sample-build-ns-2 OPENSHIFT_BUILD_NAMESPACE=dyan-1 BUILD_LOGLEVEL=5] Cmd:[/bin/sh -c tar -C /tmp -xf - && /usr/libexec/s2i/assemble] DNS:[] Image:172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c Volumes:map[] VolumeDriver: VolumesFrom: WorkingDir: MacAddress: Entrypoint:[/bin/env] NetworkDisabled:false SecurityOpts:[] OnBuild:[] Mounts:[] Labels:map[]} HostConfig:&{Binds:[] CapAdd:[] CapDrop:[KILL MKNOD SETGID SETUID SYS_CHROOT] GroupAdd:[] ContainerIDFile: LxcConf:[] Privileged:false PortBindings:map[] Links:[] PublishAllPorts:false DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] VolumesFrom:[] NetworkMode:container:70053a3bf9f6b34b620cd338e2a3050ec705a8ccfe57df218c6427a8eaacc755 IpcMode: PidMode: UTSMode: RestartPolicy:{Name: MaximumRetryCount:0} Devices:[] LogConfig:{Type: Config:map[]} ReadonlyRootfs:false SecurityOpt:[] CgroupParent: Memory:92233720368547 MemorySwap:92233720368547 MemorySwappiness:0 OOMKillDisable:false CPUShares:2 CPUSet: CPUSetCPUs: CPUSetMEMs: CPUQuota:-1 CPUPeriod:100000 BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteBps:[] BlkioDeviceWriteIOps:[] Ulimits:[] VolumeDriver: OomScoreAdj:0}} ...
I0804 01:33:51.950136       1 docker.go:772] Attaching to container "s2i_172_30_102_107_5000_dyan_1_nosrc_extended_test_builder_sha256_5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c_df02649a" ...
I0804 01:33:51.950313       1 docker.go:781] Starting container "s2i_172_30_102_107_5000_dyan_1_nosrc_extended_test_builder_sha256_5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c_df02649a" ...
I0804 01:33:52.067292       1 docker.go:805] Waiting for container "s2i_172_30_102_107_5000_dyan_1_nosrc_extended_test_builder_sha256_5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c_df02649a" to stop ...
I0804 01:33:52.195654       1 sti.go:580] ---> Installing application source ...
E0804 01:33:52.199033       1 postexecutorstep.go:328] mv: cannot stat '/tmp/src/*': No such file or directory
I0804 01:33:52.268238       1 docker.go:755] Removing container "s2i_172_30_102_107_5000_dyan_1_nosrc_extended_test_builder_sha256_5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c_df02649a" ...
I0804 01:33:52.287057       1 docker.go:759] Removed container "s2i_172_30_102_107_5000_dyan_1_nosrc_extended_test_builder_sha256_5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c_df02649a"
I0804 01:33:52.287258       1 cleanup.go:33] Removing temporary directory /tmp/s2i-build020901590
I0804 01:33:52.287287       1 fs.go:159] Removing directory '/tmp/s2i-build020901590'
F0804 01:33:52.287523       1 helpers.go:108] error: build error: non-zero (13) exit code from 172.30.102.107:5000/dyan-1/nosrc-extended-test-builder@sha256:5507b450bb23f794c4cf5c263d01d9bee52f30f72d49410e10d0b5df4d23742c

Comment 1 Gabe Montero 2016-08-04 13:24:59 UTC
The place to start appears to be this message from the actual build:

E0804 01:33:52.199033       1 postexecutorstep.go:328] mv: cannot stat '/tmp/src/*': No such file or directory

I've cc:ed Ben and Slava - any chance that the extended build stuff changed the starting point of where the code is located?  I vaguely recall such a thing but am not certain.

If it did, minimally the no src test cases didn't catch it, and those need to be bolstered.

I'll try to reproduce in the short term.

Comment 2 Gabe Montero 2016-08-04 13:40:02 UTC
Refreshing my memory with this ... the Dockerfile for the no-src bldr image is:

FROM openshift/ruby-20-centos7
RUN mkdir /tmp/src

Comment 3 Dongbo Yan 2016-08-05 02:34:48 UTC
yes, I use sti build instead of docker build to build nosrc-bldr image.
but it's the same issue with Dockerfile

Comment 4 Gabe Montero 2016-08-05 02:39:13 UTC
I'm seeing a different error than the one Dongbo Yan saw, but is the same one Slava saw today, which is something has undone the validation change to even allow a nosrc build:

The BuildConfig "ruby-sample-build-nd" is invalid.
spec.source: Invalid value: "": must provide a value for at least one source input(git, binary, dockerfile, images).

Based on git blame, I suspect the change from Jimmi back in April for the Jenkinfile stuff:

1b81554b (Jimmi Dyson      2016-04-29 09:52:19 +0100 145) 	if s.DockerStrategy != nil && s.JenkinsPipelineStrategy == nil && spec.Source.Git == nil && spec.Source.Binary == nil && spec.Source.Dockerfile == nil && spec.Source.Images == nil {
bc80045d (Ben Parees       2016-07-01 17:56:44 -0400 146) 		allErrs = append(allErrs, field.Invalid(fldPath.Child("source"), "", "must provide a value for at least one source input(git, binary, dockerfile, images)."))

I'll see about working around this first, and then see if I see Dongbo Yan's error.

Comment 5 Gabe Montero 2016-08-05 02:43:04 UTC
Don't think it is line 145 ... something else must have change that altered the input into this method.

I'll dig more on Friday.

Comment 6 Gabe Montero 2016-08-05 12:05:06 UTC
Ah, how my memory fails as I get older :-) .... nosrc is not allowed with docker strategy :-) ... remember now.

Among other things, the validation unit tests confirm that.

I see the same error on the source strategy config.  I'll dig into it today.

Comment 7 Gabe Montero 2016-08-05 13:33:58 UTC
OK, I know what happened.  The s2i ruby assemble script changed 24 days ago with commit https://github.com/sclorg/s2i-ruby-container/commit/1824d81af60eb25e843f79176340d3870cd31e00#diff-4a51d1cc3110008c2ba32a490e14ec72
where the cp was changed to a mv to save space.

However, mv fails when trying to `mv /tmp/src/*` when there are no files there (the Dockerfile for our nosrc bldr image simply creates the /tmp/src dir currently).

I think the cp to mv change is valid for real world apps.

So the fix will be to update the Dockerfile in the QE's repo to also touch a file in /tmp/src in addition to the mkdir /tmp/src.

Sending the bug back to QE so they can update their repo's Dockerfile accordingly, and try again.

Comment 8 Gabe Montero 2016-08-05 14:02:34 UTC
I confirmed that adding 

RUN touch /tmp/src/DUMMY.txt

to the Docker file allows both the src and custom strategy bc's to build.

Comment 9 Dongbo Yan 2016-08-08 03:31:47 UTC
yes, after updating Dockerfile, it works well. thanks

openshift v3.3.0.14
kubernetes v1.3.0+57fb9ac
etcd 2.3.0+git

Comment 11 errata-xmlrpc 2016-09-27 09:42:32 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.