Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openshiftBuild should support binary build type. #165

Closed
etsauer opened this issue Feb 19, 2018 · 10 comments
Closed

openshiftBuild should support binary build type. #165

etsauer opened this issue Feb 19, 2018 · 10 comments
Assignees

Comments

@etsauer
Copy link

etsauer commented Feb 19, 2018

Many pipelines use openshift to simply deploy a jar/war/ear from the workspace to an s2i-enabled image. It would be nice to be able to use the pipeline plugin methods to do this rather than have to drop into the shell for a simple oc start-build foo --from-file/--from-dir command.

@gabemontero
Copy link
Contributor

Thanks for the interest @etsauer , but we are not taking on new enhancements for this plugin, as https://github.com/openshift/jenkins-client-plugin is now our strategic direction for openshift/jenkins integration from pipelines.

You can in fact perform binary builds with the openshift.startBuild(...) directive with that plugin.

@glenns1
Copy link

glenns1 commented Apr 14, 2019

Thanks @gabemontero - I know this is close, but it is not clear how to push a binary image (--from-file) through the openshift Jenkins plugin using 'openshift.startBuild(...)'. please elaborate.

@gabemontero
Copy link
Contributor

@glenns1 use existing pipeline function like https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#code-findfiles-code-find-files-in-the-workspace to find the binary file in your pipeline's workspace to find the fully qualified path of your binary file. Supply the right path as the value for --from-file in the args you pass to startbuild

@glenns1
Copy link

glenns1 commented Apr 24, 2019

@gabemontero Thanks for this feedback. I tried running that command, but not clear on the syntax and was failing. if you have an example with the --from-file option for a start build equivalent please?

@gabemontero
Copy link
Contributor

how about providing exactly what you tried @glenns1 and I'll modify it as needed

@glenns1
Copy link

glenns1 commented Apr 24, 2019

Thanks @gabemontero
Is there a way to take this offline?

This is what I use for pipeline script:

node(label 'ocpmaster'
{
stage 'gatherFiles'
def files = findFiles(glob: '**/*.jar') echo """${files[0].name} ${files[0].path} ${files[0].directory} ${files[0].length} ${files[0].lastModified}"""
}

@glenns1
Copy link

glenns1 commented Apr 29, 2019

hi @gabemontero
did you get a chance to look at this?
can we take it offline?
thanks

@gabemontero
Copy link
Contributor

@glenns1 how did you take the file gathering above and supply it to the openshift.startBuild(...) call?

Can you supply that syntax as well, and any error logs that may have occurred when you try it.

Lastly, are you famiilar with binary builds in general ... are you able to do them from the command line via the oc cli? See https://docs.okd.io/latest/dev_guide/builds/build_inputs.html#binary-source if you are unfamiliar.

Also, sorry, but I want to keep the discussion here, for other's benefits, including some new devs for the client plugin function.

@waveywaves fyi ^^

@glenns1
Copy link

glenns1 commented Apr 29, 2019

Hi @gabemontero

I am familiar with and using the binary builds. I currently use this:
oc start-build my-openjdk-app --from-file=/home/executable-sample-jar.jar

But I wish to run it in a Jenkins pipeline:
openshiftBuild(namespace: 'development', buildConfig: 'my-openjdk-app', showBuildLogs: 'true')

Therefore, I require the --from-file option, which is how I got to needing:
def files = findFiles(glob: '**/*.jar') echo """${files[0].name} ${files[0].path} ${files[0].directory} ${files[0].length} ${files[0].lastModified}"""

The error from running this stage:
[Pipeline] stage (definefiles)
Using the ‘stage’ step without a block argument is deprecated
Entering stage definefiles
Proceeding
[Pipeline] findFiles
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
/var/jenkins/workspace/testpipeline does not exist.
at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:483)
at hudson.FilePath.glob(FilePath.java:1759)
at hudson.FilePath.access$1700(FilePath.java:196)

Thanks

@gabemontero
Copy link
Contributor

@glenns1 ok we may not be on the same page here.

Earlier you mentioned openshift.startBuild(..) from the jenkins-client plugin.
But your last comment mentions
openshiftBuild which is for this plugin. This plugin is deprecated in favor of https://github.com/openshift/jenkins-client-plugin

We are not adding support for binary builds in this plugin.

Did you try it with the client-plugin? Can you provide the pipeline code and full log results when you tried it using the client plugin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants