[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Pipelines: where to build?



Hi Ben,

Thanks! I didn't realize this was an option. I gave it a try, using your links and this blog post https://blog.openshift.com/binary-input-sources-openshift-3-2/ as a guide. I created a binary build based on my STI builder, and changed my pipeline to:

node('gradle') {
  stage('Checkout') {
    git credentialsId: 'project-app-jenkins-openshift', url: 'ssh://git /project/app.git'
  }

  stage('build') {
    sh './gradlew clean build'
    stash includes: 'build/libs/app.jar', name: 'app-jar'
  }
}

node('master') {
  // On master because we want to use the jenkins service account
  stage('create container') {
    unstash 'app-jar'
    sh 'oc start-build app-binary --from-file build/libs/app.jar'
  }
}

node { // Can happen anywhere
  stage('check bc') {
    openshiftVerifyBuild checkForTriggeredDeployments: 'true', bldCfg: 'app-binary'
  }
}

This works great and is fast too, since the jar is only shared inside of OpenShift.

Great stuff! Thx again,


Jens

On Tue, Feb 21, 2017 at 4:42 PM, Ben Parees <bparees redhat com> wrote:


On Tue, Feb 21, 2017 at 10:25 AM, Jens Geiregat <jens geiregat gmail com> wrote:
Hi,

I've been exploring the different ways to use a pipeline build strategy in OpenShift (enterprise, 3.4) and I keep running into the same issue:
- either I build my application in an other OpenShift buildconfig (sti) but I have no way to retrieve JUnit testing reports in Jenkins, leaving me kind of blind when things fail
- or I build my (Java 8, Gradle) application in Jenkins, get the benefits of being able to parse JUnit XMLs etc, but have to jump through hoops to get my build artifact into a deployable container image without running the build twice

What I'm doing/planning to do now is to:
- build in Jenkins
- upload the artifact to our Artifactory server
- use a custom sti builder that just downloads the artifact from Artifactory

But this seems weird? Ideally I would be able to 'unstash' Jenkins artifacts in my STI build, or extract build artifacts *from* an STI build?

​another option to consider would be to launch a binary build from your jenkins job:

https://docs.openshift.org/latest/dev_guide/builds/build_inputs.html#binary-source

to do this you'd need to either invoke the oc cli tool directly from your job (the oc binary is included in the jenkins master+slave images), or you can try our new experimental jenkins openshift client plugin:

https://github.com/openshift/jenkins-client-plugin.git

 

If you have tried one of these options, please let my know your experiences, so I can find the right flow.

Kind Regards,


Jens

_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users




--
Ben Parees | OpenShift



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]