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

Bug 918926

Summary: Should provide jenkins URL instead of IP for JBossTools
Product: OpenShift Container Platform Reporter: Ziqian SUN (Zamir) <zsun>
Component: ContainersAssignee: Lili Nader <lnader>
Status: CLOSED UPSTREAM QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 1.1.1CC: adietish, bleanhar, calfonso, dmcphers, jialiu, libra-onpremise-devel, mfisher, szhou
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: 2013-05-20 21:26:32 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:
Attachments:
Description Flags
JBT none

Description Ziqian SUN (Zamir) 2013-03-07 09:09:04 UTC
Created attachment 706424 [details]
JBT

Description of problem:
Given I have not created jenkins app, when I create a app with jenkins cartridge, it should provide the jenkins server URL created instead of the node IP

Version-Release number of selected component (if applicable):

Eclipse Juno build 20120920-0800
JBoss OpenShift Tools 2.4.1.Final-v20130302-0204-B128
OpenShift Enterprise puddle 2013-02-27.1

How reproducible:
Always

Steps to Reproduce:
1.Connect to OpenShift Enterprise using a user without jenkins server.
2.Right click on the username in OpenShift Explorer ->New OpenShift Application
3.Choose any type of app(Except jenkins) and select jenkins-client to embed.
4.Choose Apply when it prompts the suggestion to create jenkins and type an app name for that when it asks to.
5.Check the output window(as the attachement)
  
Actual results:
Application jenkins was created.10.4.59.222

Expected results:
It should show the url instead of a node IP

Additional info:

Comment 2 chris alfonso 2013-03-11 16:42:58 UTC
As part of the application creation process, the broker returns the message "Application #{application.name} was created."  However, it also adds and :info to the response that contains a key/value pair for 'current_ip'.  I don't think the current_ip should be used as part of the user notification message.

Since the application is also part of the response, the URL for the application should be read from there.  I've got an email to Max Anderson to get a hold of the source of JBoss OpenShift Tools to confirm the findings.

Comment 4 Andre Dietisheim 2013-04-29 16:13:00 UTC
What we show to the user is the following in case he chose to call the jenkins application "ci":

> ci
> ---------------------------------
> Application ci was created.192.168.59.154
> Jenkins created successfully.  Please make note of these credentials:
>
>   User: admin
>   Password: XXXXXXX
>
> Note:  You can change your password at: https://ci-XXXXX/me/configure

So the IP reported in the first line of the message is the internal one. The link printed further down that allows the user to change its credentials seems correct.

Comment 5 Andre Dietisheim 2013-04-29 16:42:16 UTC
In JBoss Tools and in the openshift-java-client we simply take whatever the REST endpoint is reporting to us:

We get some json in this form (https://github.com/adietish/openshift-java-client/blob/master/src/test/resources/samples/add-application.json#L3):
"messages":[
        {
            "field":null,
            "severity":"info",
            "exit_code":null,
            "text":"Application sample was created."
        }
    ],

take all the entries in the messages array and them into Message objects: 
https://github.com/adietish/openshift-java-client/blob/master/src/main/java/com/openshift/internal/client/response/ResourceDTOFactory.java#L139

We then concatenate the "text" property of those Message objects into a string (https://github.com/adietish/openshift-java-client/blob/master/src/main/java/com/openshift/internal/client/AbstractOpenShiftResource.java#L150):
public String getCreationLog() {
	if (!hasCreationLog()) {
		return null;
	}
	StringBuilder builder = new StringBuilder();
	for (Message message : creationLog) {
		builder.append(message.getText());
	}
	return builder.toString();
}

and show it to the user. IMHO if there's something wrong with what is being reported, then the messages we report should get changed. Furthermore we can only change for upcoming release but not for the existing ones. We have > 300k existing users that get affected by this.

Comment 6 Dan McPherson 2013-05-01 03:22:12 UTC
Andre,

  The results from the REST API have very specific meanings and you would be best off taking the values you want rather than just printing everything.  The logic should be:

- Always show info
- Show debug when in a debug mode
- On error show error
- On success show result and appinfo

If you don't follow this logic you might show a mixture of success and error message when an operation partially succeeds and then fails after.

-Dan

Comment 7 Andre Dietisheim 2013-05-17 13:10:17 UTC
As discussed on IRC/Mail with Brenton Leanhardt I'll only display the "field":"result" from the messages when creating jenkins and embedding cartridges:

<quote>
> In terms of json we get the following:
>
> "messages":[
>      {
>         "exit_code":null,
>         "field":null,
>         "severity":"info",
>         "text":"Application jekyll was created."
>      },
>      {
>         "exit_code":0,
>         "field":"current_ip",
>         "severity":"info",
>         "text":"107.21.169.102"
>      },
>      {
>         "exit_code":0,
>         "field":"result",
>         "severity":"info",
>         "text":"\nJenkins created successfully.  Please make note of these credentials:\n\n   User: admin\n   Password: edWlFXhq-BqY\n\nNote:  You can change your password at: https://jekyll-foobarz.rhcloud.com/me/configure\n\n"
>      }
>   ],
>
> When trying to apply Dan's comment then that would mean we'd only show the 3rd block "field": "result"?
>
> Applied to embedding mysql:
>
> "messages":[
>      {
>         "exit_code":null,
>         "field":null,
>         "severity":"info",
>         "text":"Added mysql-5.1 to application springeap6"
>      },
>      {
>         "exit_code":0,
>         "field":"result",
>         "severity":"info",
>         "text":"\nMySQL 5.1 database added.  Please make note of these credentials:\n\n       Root User: adminnFC22YQ\n   Root Password: U1IX8AIlrEcl\n   Database Name: springeap6\n\nConnection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/\n\nYou can manage your new MySQL database by also embedding phpmyadmin-3.4.\nThe phpmyadmin username and password will be the same as the MySQL credentials above.\n"
>      },
>      {
>         "exit_code":0,
>         "field":"appinfo",
>         "severity":"info",
>         "text":"Connection URL: mysql://127.13.125.1:3306/\n"
>      }
>
> We'd only show the 2nd ("field": "result") and ("field":"appinfo") 3rd block?

Personally I think "result" is the only thing that's useful.  It's not
like users can connect to mysql://127.13.125.1:3306 in the MySQL case
without port forwarding.  And we don't want them hardcoding IP
addresses either.  It's much better to use the ENV vars that are
printed in the "result" field. 
</quote>

Comment 8 Andre Dietisheim 2013-05-17 13:33:52 UTC
I filed an appropriate issue in JBoss Tools:

https://issues.jboss.org/browse/JBIDE-14509

I'll fix it for the upcoming Beta1 which we freeze today and release hopefully on the 31st of May

Comment 9 Brenton Leanhardt 2013-05-17 13:48:43 UTC
We really appreciate this.  I'm going to move this from our 1.2 release since it's technically not a blocker for us (and will be fixed before our release anyway)

Comment 10 Lili Nader 2013-05-20 21:26:32 UTC

*** This bug has been marked as a duplicate of bug 964337 ***

Comment 11 Johnny Liu 2013-05-23 09:26:15 UTC
Because another new upstream bug is opened for tracking this issue, so I closed this bug to "UPSTREAM".