Bug 1190588 - "Context Directory:"is MISSING in buildconfig description for "dockerStrategy"
Summary: "Context Directory:"is MISSING in buildconfig description for "dockerStrategy"
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Build
Version: 3.0.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Maciej Szulik
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-09 08:40 UTC by Wenjing Zheng
Modified: 2015-04-29 14:29 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-26 12:20:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Wenjing Zheng 2015-02-09 08:40:01 UTC
Description:
When docker build with contectDir buildconfig, the value defined in json file cannot be passed to buildconfig description and after import the buildconfig to a json file, the parameter displays like "dockerStrategy": {}, instead of "dockerBuildStrategy": {"contextDir": "./"}; If use "dockerStrategy": {} to reveal context folder, the item "Context Directory" in buildconfig description will disappear.

Version-Release number of selected component (if applicable):
openshift-master-0.2.2-0.git.83.6d09bd9.el7ose.x86_64
openshift-0.2.2-0.git.83.6d09bd9.el7ose.x86_64
openshift-sdn-master-0.4-1.el7.x86_64
openshift-sdn-0.4-1.el7.x86_64

How reproducible:
always

steps to Reproduce:
1. Create a project test
$osc create -f project.json
2. Edit application-template-dockerbuild.json to input directory which contains additional directory to source URI:
vim application-template-dockerbuild.json
 "parameters": {
        "source" : {
          "type" : "Git",
          "git" : {
            "uri": "git://github.com/openshift/ruby-hello-world.git"
          }
        },
        "strategy": {
          "type": "Docker",
          "dockerBuildStrategy": {
            "contextDir": "./config"
          }
        },
3.Submit the application template for processing and create the application using the processed template:
$osc process -n test -f application-template-dockerbuild.json | osc apply -n test -f -
4. Describe the buildconfig
5. Export the buildconfig
6. Do not change anything and update buildconfig with this json file
7. Describe the buildconfig again

Actual results:
4. 
[root@osev3-master sample-app]# osc describe buildconfigs ruby-sample-build -n wzheng2
Name:                ruby-sample-build
Annotations:            <none>
Created:            2015-02-09 01:14:51 -0500 EST
Strategy:            Docker
Context Directory:        <none>
BaseImage:            <none>
Source Type:            Git
URL:                git://github.com/wzheng1/ruby-hello-world.git
Output to:            origin-ruby-sample
Output Spec:            <none>
Webhook Github:            localhost/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/github
Webhook Generic:        localhost/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/generic
Image Repository Trigger:    ruby-20-centos
- Tag:                latest
- Image:            openshift/ruby-20-centos
- LastTriggeredImageID:        <none>
5. "dockerBuildStrategy" changed to "dockerStrategy":
    "parameters": {
        "source": {
            "type": "Git",
            "git": {
                "uri": "git://github.com/wzheng1/ruby-hello-world.git"
            }
        },
        "strategy": {
            "type": "Docker",
            "dockerStrategy": {
                "contextDir": "./config"
            }
        },
7. "Context Directory" is gone:
[root@osev3-master sample-app]# osc describe buildconfigs ruby-sample-build -n wzheng2
Name:                ruby-sample-build
Annotations:            <none>
Created:            2015-02-09 01:14:51 -0500 EST
Strategy:            Docker
BaseImage:            <none>
Source Type:            Git
URL:                git://github.com/wzheng1/ruby-hello-world.git
Output to:            origin-ruby-sample
Output Spec:            <none>
Webhook Github:            localhost/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/github
Webhook Generic:        localhost/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/generic
Image Repository Trigger:    ruby-20-centos
- Tag:                latest
- Image:            openshift/ruby-20-centos
- LastTriggeredImageID:        <none>

Expected results:
The parameter should be passed and works during docker build.

Additional info:

Comment 2 Maciej Szulik 2015-02-13 12:54:38 UTC
Since Nov 5th, 2014 parameter describing DockerBuildStrategy [1] is called 'dockerStrategy', I'm guessing you should update your test case for that to be relevant with current state of the system.

[1] https://github.com/openshift/origin/blob/b55a679e23e7fec2ab61d41428ca2ff0e064590a/pkg/build/api/v1beta1/types.go

Comment 3 Wenjing Zheng 2015-02-15 02:47:08 UTC
Reopen on fedora_791:
Yes, the 'dockerBuildStrategy' has changed to 'dockerStrategy'. But there is no item "Context Directory:" in the description of buildconfig for "dockerStrategy"; it has for 'dockerBuildStrategy'. Detailed display is in above Expected result part.

Comment 4 Maciej Szulik 2015-02-16 10:06:37 UTC
Yes there is contextDir in dockerStrategy and it works OK, look here [1]. The json might look like this:

"strategy": {
  "type": "Docker",
  "dockerStrategy": {
    "contextDir": "./config",
  },
},

[1] https://github.com/openshift/origin/blob/b55a679e23e7fec2ab61d41428ca2ff0e064590a/pkg/build/api/v1beta1/types.go#L146

Comment 5 Wenjing Zheng 2015-02-17 01:33:25 UTC
Yes, the contextDir works well. The bug I want to make clear is in buildconfig description which is invoked by "osc describe buildconfig ruby-sample-build": the only difference between the description of old "dockerBuildStrategy" and new "dockerStrategy" is there is no "Context Directory: " between line "
Strategy: " and "BaseImage: " for new "dockerStrategy" . 

So the bug here is about "Context Directory:"is MISSING in buildconfig description for "dockerStrategy" (I really wish I can make it highlight in the output in the Actual result of my original description).

I have also update the bug tiltle to make it clear, sorry for confusing you.

Comment 6 Maciej Szulik 2015-02-26 12:20:07 UTC
That is already handled in current version properly, see https://github.com/openshift/origin/blob/master/pkg/cmd/cli/describe/describer.go#L99, so I'm closing this bug as currentrelease.


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