siamaksade / openshift-jenkins-demo

CI/CD Demo on OpenShift
http://www.openshift.com
530 stars 928 forks source link

stage-Build Image failure #112

Open babujii opened 5 years ago

babujii commented 5 years ago

While executing this step in the pipeline,

stage('Build Image') {
  steps {
    sh "cp target/openshift-tasks.war target/ROOT.war"
    script {
      openshift.withCluster() {
        openshift.withProject(env.DEV_PROJECT) {
              openshift.selector("bc", "tasks").startBuild("--from-file=target/ROOT.war", "--wait=true")
        }
      }
    }
  }
}

Error in the Jenkins Console :

ERROR: Error running start-build on at least one item: [buildconfig/tasks]; {reference={}, err=Uploading file "target/ROOT.war" as binary input for the build ... Error from server (NotFound): buildconfigs.build.openshift.io "tasks" not found, verb=start-build, cmd=oc --server=https://172.30.0.1:443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=dev --token=XXXXX start-build buildconfig/tasks --from-file=target/ROOT.war --wait=true -o=name , out=, status=1}

Finished: FAILURE

rperezsnap commented 5 years ago

Almost the same issue but when is making the deployment to stage:

ERROR: rollout:latest returned an error; {reference={}, err=Error from server (NotFound): deploymentconfigs.apps.openshift.io "tasks" not found, verb=rollout, cmd=oc rollout latest deploymentconfig/tasks --server=https://172.30.0.1:443 --namespace=stage --token=XXXXX , out=, status=1}

It says that the task is not found.

babujii commented 5 years ago

i am facing problem in Dev environment itself, Is it working for you Dev environment(deployment script) ? if yes, Could you please share your Dev deployment script.

rperezsnap commented 5 years ago

Hello Babujii, I'm using the same script from the project. I'm not replacing project values because I found several errors during the process. I mean if you change the dev project name and stage project name you can face several errors. Maybe those are the errors you are having.

The problem I was having is when i was deploying to stage and the script do not create the deployment config for that project, so I got " task not found"..

babujii commented 5 years ago

Thanks for update Rperezsnap ! Even i am suspecting with source code issue. Are you using same source code or different source code.. source code: https://github.com/OpenShiftDemos/openshift-tasks

babujii commented 5 years ago

We have followed with installation script instructions and working fines . It's solved issue. Thanks for your support.

rperezsnap commented 5 years ago

Hello Babujii, I'm glad it worked for you. Did your pipeline finish successfully from the beginning to the deployment stage?

babujii commented 5 years ago

Hi Rperezsnap,

Yes, It is working fine now(Dev,Stage). I was used below steps, MAKE SURE YOU ARE LOGGED IN:
Step1:$ oc login http://console.your.openshift.com ID:system password:admin

step2:git clone https://github.com/siamaksade/openshift-cd-demo.git (locally)

Step3:go to script path and run the script.

./provision.sh deploy

Step4: Deployment Stage(just click promote button)

Done ... Enjoy !!

babujii commented 5 years ago

you have to login : #oc login http://:8443

Johnny2136 commented 5 years ago

I get the same:

Error running start-build on at least one item: [buildconfig/tasks];

{reference={}, err=Uploading file "target/ROOT.war" as binary input for the build ...

Error from server (NotFound): buildconfigs.build.openshift.io "tasks" not found, verb=start-build, cmd=oc --server=https://172.30.0.1:443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=dev --token=XXXXX start-build buildconfig/tasks --from-file=target/ROOT.war --wait=true -o=name , out=, status=1}

What did you do to fix this?

rperezsnap commented 5 years ago

Seems that the buildconfig named "tasks" on the project dev, do not exists.

Maybe you need to recreate the builconfig with oc new-build

Those steps are inside the job in the yaml file. Maybe when you run the yaml it was not created.

You can check if the build config exists using the following command: oc get bc -n dev

The script to create the build config is the following: oc new-build --name=tasks --image-stream=wildfly:latest --binary=true -n dev


From: Johnny Johnson notifications@github.com Sent: Tuesday, November 27, 2018 9:30:27 AM To: siamaksade/openshift-cd-demo Cc: Ronny Perez Picado; Comment Subject: Re: [siamaksade/openshift-cd-demo] stage-Build Image failure (#112)

i get the same:

Error running start-build on at least one item: [buildconfig/tasks];

{reference={}, err=Uploading file "target/ROOT.war" as binary input for the build ...

Error from server (NotFound): buildconfigs.build.openshift.io "tasks" not found, verb=start-build, cmd=oc --server=https://172.30.0.1:443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=dev --token=XXXXX start-build buildconfig/tasks --from-file=target/ROOT.war --wait=true -o=name , out=, status=1}

What did you do to fix this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/siamaksade/openshift-cd-demo/issues/112#issuecomment-442100861, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aqg3wkKylHuP6_zvKoQwM3yYJXkksVEQks5uzVqTgaJpZM4YBnLu.

Johnny2136 commented 5 years ago

I tried that

C:\Users\johnn>oc get bc -n dev
NAME      TYPE      FROM      LATEST
tasks     Source    Binary    0
Johnny2136 commented 5 years ago

Step3:go to script path and run the script.

./provision.sh deploy

Step4: Deployment Stage(just click promote button)

So is this in a windows env or linux?

Johnny2136 commented 5 years ago

Well now I got past build but failed on deploy to dev:

[rollout:latest:deploymentconfig/tasks] 

rollout:latest returned an error;

{reference={}, err=Error from server (NotFound): deploymentconfigs.apps.openshift.io "tasks" not found, verb=rollout, cmd=oc --server=https://172.30.0.1:443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=dev --token=XXXXX rollout latest deploymentconfig/tasks , out=, status=1}
AnthonyWong1216 commented 4 years ago

I still have same error how you all fix it??

[cicd-admin-tasks-pipeline] Running shell script

[Pipeline] _OcContextInit [Pipeline] _OcContextInit [Pipeline] readFile [Pipeline] _OcAction [Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Deploy DEV) Stage "Deploy DEV" skipped due to earlier failure(s) [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Promote to STAGE?) Stage "Promote to STAGE?" skipped due to earlier failure(s) [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Deploy STAGE) Stage "Deploy STAGE" skipped due to earlier failure(s) [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: Error running start-build on at least one item: [buildconfig/tasks]; {reference={}, err=Uploading file "target/ROOT.war" as binary input for the build ... error: The build dev-admin/tasks-2 status is "Failed", verb=start-build, cmd=oc --server=https://172.30.0.1:443 --certificate-authority=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt --namespace=dev-admin --token=XXXXX start-build buildconfig/tasks --from-file=target/ROOT.war --wait=true -o=name , out=build/tasks-2, status=1}

Finished: FAILURE

dirtyA commented 4 years ago

docker pull openshift/wildfly-120-centos7@sha256:a1fbd1b235102ae18344527b44201c34ad4c2181b0b4cbf295b1a8f0cbde8e73

dirtyA commented 4 years ago

no wildfly-120-centos7 image