Bug 1245609 - Custom build with imageStreamImage in buildConfig failed
Summary: Custom build with imageStreamImage in buildConfig failed
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Build
Version: 3.0.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Rodolfo Carvalho
QA Contact: Gaoyun Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-22 11:34 UTC by Anping Li
Modified: 2015-07-23 02:32 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-23 02:32:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Anping Li 2015-07-22 11:34:25 UTC
Description of problem:
Create application base on image anli/origin-custom-docker-builder:liap using custom build.
The Custom build with imageStreamImage in buildConfig failed. The error message is like "invalid value 'latest': no image recorded for p3/origin-ruby-sample:latest" in events 

Version-Release number of selected component (if applicable):
Openshift v3.0.1.0

How reproducible:
Always

Steps to Reproduce:
1. oc new-project p3
2. wget https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-custombuild.json
3. use private docker image anli/origin-custom-docker-builder

replace openshift/origin-custom-docker-builder with anli/origin-custom-docker-builder in application-template-custombuild.json as following
    {
      "kind": "ImageStream",
      "apiVersion": "v1beta3",
      "metadata": {
        "name": "origin-custom-docker-builder",
        "creationTimestamp": null
      },
      "spec": {
        "dockerImageRepository": "anli/origin-custom-docker-builder"
      },

4. use image ID of anli/origin-custom-docker-builder:liap

repalce kind from "ImageStreamTag" to "ImageStreamImage", replace name from "origin-custom-docker-builder:latest" to "origin-custom-docker-builder@d44f004c9195488f33cf5aedeb958758d66b1dcfc9c169e8a304111bb035d3ad" in application-template-custombuild.json as following

"strategy": {
          "type": "Custom",
          "customStrategy": {
            "from": {
              "kind": "ImageStreamImage",
              "name": "origin-custom-docker-builder@d44f004c9195488f33cf5aedeb958758d66b1dcfc9c169e8a304111bb035d3ad"
            },
            "env": [
              {
                "name": "OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE",
                "value": "openshift/origin-custom-docker-builder"
              }
            ],
            "exposeDockerSocket": true
          }
        },
5. create project and start-build.
oc process -f application-template-custombuild.json | oc create -f -
oc start-build ruby-sample-build

6. check openshift event
oc get event

7. check build status
oc get builds
oc build-logs  ruby-sample-build-1


Actual results:

6. It show invalid value 'latest'
Wed, 22 Jul 2015 17:43:58 +0800   Wed, 22 Jul 2015 17:43:58 +0800   1         ruby-sample-build-1-build   Pod                                                                 scheduled          {scheduler }                      Successfully assigned ruby-sample-build-1-build to minion1.cluster.local
Wed, 22 Jul 2015 17:43:23 +0800   Wed, 22 Jul 2015 17:44:27 +0800   2         frontend                    DeploymentConfig                                                    failedCreate       {deployer }                       Couldn't create initial deployment: DeploymentConfig "frontend" is invalid: triggers[0].imageChange.tag: invalid value 'latest': no image recorded for p3/origin-ruby-sample:latest

7. There isn't build-logs. the build status is "complete" at final.

[anli@master ~]$ oc get is
NAME                           DOCKER REPO                                 TAGS          UPDATED
origin-custom-docker-builder   anli/origin-custom-docker-builder           latest,liap   2 minutes ago
origin-ruby-sample             172.30.234.245:5000/p8/origin-ruby-sample           
      
[anli@master ~]$ oc get builds
NAME                  TYPE      STATUS     POD
ruby-sample-build-1   Custom    Complete   ruby-sample-build-1-build

[anli@master ~]$ oc get pods
NAME                        READY     STATUS       RESTARTS   AGE
database-1-w93x8            1/1       Running      0          2m
ruby-sample-build-1-build   0/1       ExitCode:0   0          1m



Expected results:
1).The build should be success
2) The build status should be error at final.[anli@master ~]$ oc get builds
NAME                  TYPE      STATUS     POD
ruby-sample-build-2   Custom    Complete   ruby-sample-build-2-build
[anli@master ~]$ oc get pods
NAME                        READY     STATUS       RESTARTS   AGE
database-1-uksdg            1/1       Running      0          17m
ruby-sample-build-2-build   0/1       ExitCode:0   0          7m
[anli@master ~]$ oc get pods
NAME                        READY     STATUS       RESTARTS   AGE
database-1-uksdg            1/1       Running      0          17m
ruby-sample-build-2-build   0/1       ExitCode:0   0          7m


Additional info:

Comment 1 Ben Parees 2015-07-22 20:14:47 UTC
Do you have an ImageStreamImage defined?  creating an imagestream doesn't get you an imagestreamimage.


please share the exact definition of the buildconfig you are using and the output of "oc get imagestreamimage" for the project you are referencing from your buildconfig.

also "oc describe build <buildid>"

Comment 2 Anping Li 2015-07-23 01:14:10 UTC
(In reply to Ben Parees from comment #1)
> Do you have an ImageStreamImage defined?  creating an imagestream doesn't
> get you an imagestreamimage.
> 
Yes, The imagestreamimage had been defined. 
[anli@master ~]$ oc get is
NAME                           DOCKER REPO                                TAGS          UPDATED
origin-custom-docker-builder   anli/origin-custom-docker-builder          latest,liap   1 seconds ago
origin-ruby-sample 


> please share the exact definition of the buildconfig you are using and the
> output of "oc get imagestreamimage" for the project you are referencing from
> your buildconfig.
> 

[anli@master ~]$ oc get imagestreamimage origin-custom-docker-builder@d44f004c9195488f33cf5aedeb958758d66b1dcfc9c169e8a304111bb035d3ad
NAME                                   DOCKER REF                               UPDATED         IMAGENAME
origin-custom-docker-builder@d44f004   anli/origin-custom-docker-builder:liap   3 minutes ago   d44f004c9195488f33cf5aedeb958758d66b1dcfc9c169e8a304111bb035d3ad

> also "oc describe build <buildid>"

[anli@master ~]$ oc get builds
NAME                  TYPE      STATUS     POD
ruby-sample-build-1   Custom    Complete   ruby-sample-build-1-build
[anli@master ~]$ oc describe build ruby-sample-build-1
Name:			ruby-sample-build-1
Created:		42 seconds ago
Labels:			buildconfig=ruby-sample-build,name=ruby-sample-build,template=application-template-custombuild
Build Config:		ruby-sample-build
Status:			Complete
Started:		2015-07-23 09:13:24 +0800 CST
Finished:		2015-07-23 09:13:24 +0800 CST
Duration:		0
Build Pod:		ruby-sample-build-1-build
Strategy:		Custom
Image Reference:	DockerImage anli/origin-custom-docker-builder:liap
Expose Docker Socket:	yes
Environment:		OPENSHIFT_CUSTOM_BUILD_BASE_IMAGE=anli/origin-custom-docker-builder:liap
Source Type:		Git
URL:			git://github.com/openshift/ruby-hello-world.git
Output to:		ImageStreamTag origin-ruby-sample:latest
Push Secret:		builder-dockercfg-w2ecg
Events:
  FirstSeen				LastSeen			Count	From				SubobjectPath			Reason		Message
  Thu, 23 Jul 2015 09:13:00 +0800	Thu, 23 Jul 2015 09:13:00 +0800	1	{scheduler }							scheduled	Successfully assigned ruby-sample-build-1-build to minion2.cluster.local
  Thu, 23 Jul 2015 09:13:00 +0800	Thu, 23 Jul 2015 09:13:00 +0800	1	{kubelet minion2.cluster.local}	implicitly required container POD	pulled		Pod container image "registry.access.redhat.com/openshift3/ose-pod:v3.0.1.0" already present on machine
  Thu, 23 Jul 2015 09:13:00 +0800	Thu, 23 Jul 2015 09:13:00 +0800	1	{kubelet minion2.cluster.local}	implicitly required container POD	created		Created with docker id f8b501eac37f
  Thu, 23 Jul 2015 09:13:00 +0800	Thu, 23 Jul 2015 09:13:00 +0800	1	{kubelet minion2.cluster.local}	implicitly required container POD	started		Started with docker id f8b501eac37f
  Thu, 23 Jul 2015 09:13:23 +0800	Thu, 23 Jul 2015 09:13:23 +0800	1	{kubelet minion2.cluster.local}	spec.containers{custom-build}pulled		Successfully pulled image "anli/origin-custom-docker-builder:liap"
  Thu, 23 Jul 2015 09:13:24 +0800	Thu, 23 Jul 2015 09:13:24 +0800	1	{kubelet minion2.cluster.local}	spec.containers{custom-build}created		Created with docker id db049ae0031d
  Thu, 23 Jul 2015 09:13:24 +0800	Thu, 23 Jul 2015 09:13:24 +0800	1	{kubelet minion2.cluster.local}	spec.containers{custom-build}started		Started with docker id db049ae0031d
  Thu, 23 Jul 2015 09:13:30 +0800	Thu, 23 Jul 2015 09:13:30 +0800	1	{kubelet minion2.cluster.local}	implicitly required container POD	killing		Killing with docker id f8b501eac37f

Comment 3 Anping Li 2015-07-23 01:19:19 UTC
Following comment 2
[anli@master ~]$ oc get builds
NAME                  TYPE      STATUS     POD
ruby-sample-build-1   Custom    Complete   ruby-sample-build-1-build

[anli@master ~]$ oc get pods
NAME                        READY     STATUS       RESTARTS   AGE
database-1-ohojc            1/1       Running      0          8m
ruby-sample-build-1-build   0/1       ExitCode:0   0          3m


[anli@master ~]$ oc logs ruby-sample-build-1-build
[anli@master ~]$

Comment 4 Ben Parees 2015-07-23 02:11:53 UTC
The question then is, what is your custom builder image doing?  based on your results:

1) it's exiting with a successful (zero) return code
2) it's not pushing an image anywhere

it's the responsibility of the custom builder image to report success/failure (and output any log info you want to stdout) and push the result image to the registry, assuming that's what you want it to do.

for example see:
https://github.com/openshift/origin/tree/master/images/builder/docker/custom-docker-builder

Comment 5 Anping Li 2015-07-23 02:32:58 UTC
Yes, you are right. The image was started from /bin/bash rather than /bin/src/build.sh. So it should not a bug.


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