openshift / jenkins-plugin

Apache License 2.0
81 stars 50 forks source link

Adding exec function to Jenkins OpenShift Plugin #70

Closed jupierce closed 8 years ago

jupierce commented 8 years ago

Adding exec function for card: https://trello.com/c/Yl4qomsw/878-5-additional-jenkins-plugin-enhancement-requests-from-github

Depends on openshift/openshift-restclient-java#220

ptal @gabemontero , @bparees

Example verbose DSL:

       openshiftExec( apiURL: 'https://10.13.137.145:8443', 
        authToken: 'LsGHr_1XPhCkBVc7p6TivqVpvtDs0BDm9dIL8RdK0vU', 
        command: 'echo',
        arguments: [ [ value: 'hello'], [value: 'world'] ],
        namespace: 'myproject', 
        pod: 'ruby-hello-world-1-6939a', 
        verbose: 'true', 
        waitTime: '120000' 
       )

Example compact DSL (command and arguments in one groovy list):

       openshiftExec( apiURL: 'https://10.13.137.145:8443', 
         ...
        command: [ 'echo', 'hello', 'world' ],
       )

screenshot from 2016-10-04 11-43-07

jupierce commented 8 years ago

Note that test failure is expected until openshift/openshift-restclient-java#220 merges/installs.

gabemontero commented 8 years ago

On Tue, Oct 4, 2016 at 11:44 AM, Justin Pierce notifications@github.com wrote:

Adding exec function for card: https://trello.com/c/Yl4qomsw/878-5-additional-jenkins- plugin-enhancement-requests-from-github

Depends on openshift/openshift-restclient-java#220 https://github.com/openshift/openshift-restclient-java/pull/220

ptal @gabemontero https://github.com/gabemontero , @bparees https://github.com/bparees

Example verbose DSL:

   openshiftExec( apiURL: 'https://10.13.137.145:8443',
    authToken: 'LsGHr_1XPhCkBVc7p6TivqVpvtDs0BDm9dIL8RdK0vU',
    command: 'echo',
    arguments: [ [ value: 'hello'], [value: 'world'] ],
    namespace: 'myproject',
    pod: 'ruby-hello-world-1-6939a',
    verbose: 'true',
    waitTime: '120000'
   )

Example compact DSL (command and arguments in one groovy list):

   openshiftExec( apiURL: 'https://10.13.137.145:8443',
     ...
    command: [ 'echo', 'hello', 'world' ],
   )

[image: screenshot from 2016-10-04 11-43-07]

https://cloud.githubusercontent.com/assets/19783215/19081321/df53129e-8a27-11e6-8dcb-08d70435799d.png

You can view, comment on, or merge this pull request online at:

https://github.com/openshift/jenkins-plugin/pull/70 Commit Summary

  • Adding exec function to Jenkins OpenShift Plugin

File Changes

Yeah, the git file changed inventory doesn't convey (at least to my interpretation) whether the help and config files in this directory are linked with their analogous versions in the dsl subdirectory. So a query / reminder up top before officially reviewing on whether you linked the files. Thanks.

Patch Links:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openshift/jenkins-plugin/pull/70, or mute the thread https://github.com/notifications/unsubscribe-auth/ADbadPpxg3QxHqniTt6WkbWINKUnn0sUks5qwnRvgaJpZM4KN1pP .

jupierce commented 8 years ago

Yep. src/main/resources/com/openshift/jenkins/plugins/pipeline/dsl/OpenShiftExec contains only symlinks.

gabemontero commented 8 years ago

Seems plausible - let's go with what you've got.

On Wed, Oct 5, 2016 at 10:28 AM, Justin Pierce notifications@github.com wrote:

@jupierce commented on this pull request.

In src/main/java/com/openshift/jenkins/plugins/pipeline/dsl/ OpenShiftExec.java https://github.com/openshift/jenkins-plugin/pull/70:

  • if ( o == null ) {
  • return def;
  • }
  • return o.toString();
  • } +
  • private String argumentAsString(Map<String, Object> arguments, String arg ) throws IllegalArgumentException {
  • return requiredArgument(arguments, arg ).toString();
  • } +
  • @Override
  • public Step newInstance(Map<String, Object> arguments) throws Exception {
  • OpenShiftExec step = new OpenShiftExec( argumentAsString( arguments, "pod" ) );
  • step.setContainer( argumentAsString( arguments, "container", "" ) ); +
  • Object commandObject = requiredArgument( arguments, "command" );

My best assessment is that stapler does not support this scenario. You can have multiple DataBoundConstructors, but it is to add/deprecate parameters. It does not support the flexible unmarshalling this shorthand demands.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/openshift/jenkins-plugin/pull/70, or mute the thread https://github.com/notifications/unsubscribe-auth/ADbadPBvtTlwGWGllu6SZnpWNhcL3okeks5qw7QRgaJpZM4KN1pP .

jupierce commented 8 years ago

@gabemontero PR test flake has been addressed.

jupierce commented 8 years ago

Rebased.

jupierce commented 8 years ago

Failure is a dependency on #75

gabemontero commented 8 years ago

[test]

jupierce commented 8 years ago

[test]

gabemontero commented 8 years ago

IGTM ... will hit the button after the test job completes.