3

We are implementing CICD pipeline in openshift 3.9. At a stage where I'm building a jboss image with war, I am getting an error. The pipeline is getting failed at the BUILD IMAGE WITH APP stage. It is getting successful runs sometimes and failures sometimes. Below is the piece of code in jenkins.

 stage('Build Image') {
        openshift.withCluster() {
            openshift.withProject(env.DEV_PROJECT) {
                        def bcSelector = openshift.selector("bc", "jboss")
                        def bcExists = bcSelector.exists()
                   if (!bcExists) { 
                    openshift.newBuild("--name=jboss", "--image-stream=jboss-eap70-openshift:1.5", "--binary=true") 
                   } else {
                       echo "The specified image already exists"
                   }

            }}

   }    
      stage('Build Image with app') {
        sh "rm -rf oc-build && mkdir -p oc-build/deployments"
        sh "cp /var/lib/jenkins/jobs/cicd/jobs/cicd-tasks-pipeline/workspace/target/hello-1.0.war oc-build/deployments/ROOT.war"                                
           openshift.withCluster() {
             openshift.withProject(env.DEV_PROJECT) {
               openshift.selector("bc", "jboss").startBuild("--from-dir=oc-build", "--wait=true")
             }
           }
      }

In the stage BUILD IMAGE, it is takingthe jboss image and has no problem in this stage. In the stage BUILD IMAGE WITH APP, jboss is bound up with the war build. Below is the jenkins output during pipeline build.

[workspace] Running shell script
+ rm -rf oc-build
+ mkdir -p oc-build/deployments
[Pipeline] sh
[workspace] Running shell script
+ cp /var/lib/jenkins/jobs/cicd/jobs/cicd-tasks-pipeline/workspace/target/hello-1.0.war oc-build/deployments/ROOT.war
[Pipeline] _OcContextInit
[Pipeline] _OcContextInit
[Pipeline] readFile
[Pipeline] _OcAction
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Error running start-build on at least one item: [buildconfig/jboss];
{reference={}, err=Uploading directory "oc-build" as binary input for the build ...
Error from server (BadRequest): build jboss-2 encountered an error: No logs are available., verb=start-build, cmd=oc --server=https://172.30.0.1:443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=cicd --token=XXXXX start-build buildconfig/jboss --from-dir=oc-build --wait=true -o=name , out=, status=1}

Finished: FAILURE

Could you please let us know why this error is happening frequently and why 5 builds 2 are failing with this error?

sudhir
  • 167
  • 1
  • 5
  • 16
  • I had the same error but with a different imagestream. Did you find out the solution to this problem? – bencampbell_14 Feb 28 '19 at 10:52
  • I'm having a similar issue and would be interested in how to fix it: `Uploading directory "." as binary input for the build ... Error from server (BadRequest): cannot upload file to build with status New` – Jack Apr 07 '19 at 20:51

0 Answers0