Jenkins on openshift " Cartridge for not found" - jenkins

I tried to create a very simple Jenkins setup on openshift. Here are the steps I followed:
1. Create a new openshift app using the "Jenkins Server" cartridge.
2. Log in to the new Jenkins server using the supplied username and password.
3. Create a very simple freestyle build with a shell build step that echos some text.
4. Run the build
The new build appears briefly in the jenkins server UI and then disappears, so I checked the log in the jenkins server app to find some error messages.
May 29, 2014 4:55:41 PM hudson.plugins.openshift.OpenShiftCloud reloadConfig
INFO: Reload ResponseCode: 200
May 29, 2014 4:55:41 PM hudson.plugins.openshift.OpenShiftCloud reloadConfig
INFO: Config reload result:
May 29, 2014 4:55:41 PM hudson.plugins.openshift.OpenShiftSlave <init>
INFO: Creating slave with 15mins time-to-live
May 29, 2014 4:55:41 PM hudson.plugins.openshift.OpenShiftCloud provision
WARNING: Caught com.openshift.client.OpenShiftException: Cartridge for not found. Will retry 0 more times before canceling build.
May 29, 2014 4:55:46 PM hudson.plugins.openshift.OpenShiftCloud provision
WARNING: Cancelling build due to earlier exceptions
com.openshift.client.OpenShiftException: Cartridge for not found
at hudson.plugins.openshift.OpenShiftSlave.getCartridge(OpenShiftSlave.java:129)
at hudson.plugins.openshift.OpenShiftSlave.createApp(OpenShiftSlave.java:262)
at hudson.plugins.openshift.OpenShiftSlave.provision(OpenShiftSlave.java:253)
at hudson.plugins.openshift.OpenShiftCloud.provisionSlave(OpenShiftCloud.java:489)
at hudson.plugins.openshift.OpenShiftCloud.provision(OpenShiftCloud.java:413)
at hudson.slaves.NodeProvisioner.update(NodeProvisioner.java:264)
at hudson.slaves.NodeProvisioner.access$000(NodeProvisioner.java:51)
at hudson.slaves.NodeProvisioner$NodeProvisionerInvoker.doRun(NodeProvisioner.java:347)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
May 29, 2014 4:55:46 PM hudson.plugins.openshift.OpenShiftCloud cancelItem
INFO: Cancelling Item
It appears that some configuration is missing that would tell openshift which cartridge to use for the new slave, but I'm not sure where to configure this. Any help is greatly appreciated, thanks!

I am actually having the same issue.
If your code is configured with rhc already, run:
$ rhc cartridge add jenkins-client-1 -a jboss1
As per: https://www.openshift.com/developers/jenkins

Related

Gerrit trigger does not comments automaticly - error from jenkins: The url to submit to is not valid

I am trying to figure out why Gerrit Trigger in Jenkins does not report back to Gerrit output from job (leave comment).
Job is triggered by gerrit,proper git change is used in build,job completes,no error in build console.
Using ssh -p $GERRIT_PORT <gerrit_user>#$GERRIT_HOST gerrit review -m '"Comment"' --verified +1 $GERRIT_PATCHSET_REVISION makes a comment though.
This is the only log from var/log/jenkins:
Jun 09, 2017 11:27:05 AM com.sonymobile.tools.gerrit.gerritevents.workers.rest.AbstractRestCommandJob run
SEVERE: Gerrit response: Found
Jun 09, 2017 11:27:08 AM hudson.model.Run execute
INFO: RED_Gerrit_Main #80 main build action completed: SUCCESS
Jun 09, 2017 11:27:08 AM com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.ToGerritRunListener allBuildsCompleted
INFO: All Builds are completed for cause: GerritCause: PatchsetCreated: Change-Id for #146581: Ie3f68ce8a2c07190b22b982c66d0a65f67d2887d PatchSet: 1 silent: false
Jun 09, 2017 11:27:08 AM org.terracotta.jenkins.plugins.postcompleted.PostCompletedRunListener onCompleted
INFO: The url to submit to is not valid, please check your global configuration
Jun 09, 2017 11:27:08 AM com.sonymobile.tools.gerrit.gerritevents.workers.rest.AbstractRestCommandJob run
SEVERE: Gerrit response: Found
From user accounts POV, Jenkins account and node accounts are not valid gerrit ones,there is a predefined gerrit account with key pairs used in Gerrit Trigger configuration and Job configuration.
What can be an issue that Gerrit Trigger does not comment back?

How to give a user the Administer privilege in Jenkins via shell command

Accidentally I don't have my Administrator permissions in Jenkins anymore.
It seems everything is ok.
Jenkins log:
Jul 24, 2016 12:40:51 AM hudson.model.AsyncPeriodicWork$1 run
INFO: Finished Workspace clean-up. 7 ms
Jul 24, 2016 4:38:30 AM hudson.model.Run execute
INFO: job1 #91 main build action completed: FAILURE
Jul 24, 2016 4:38:39 AM hudson.model.Run execute
INFO: job2 #10 main build action completed: SUCCESS
Jul 24, 2016 9:10:18 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: While serving http://192.168.23.88:8080/restart: hudson.security.AccessDeniedException2:
ali71 is missing the Overall/Administer permission
How can I set the Administer permission for my account using a shell command?
As you have no way to authenticate against Jenkins, you (AFAIK) have to disable security first.
WARNING: DO NOT DO THIS ON A PUBLICLY ACCESSIBLE JENKINS INSTALLATION!
SSH into the Jenkins server and modify config.xml in Jenkins' home directory. Change
<useSecurity>true</useSecurity>
temporarily to
<useSecurity>false</useSecurity>
in order to give you administrator privileges back. Then enable and configure security according to your needs.
Be warned that anybody else, who is accessing Jenkins during that time, has Administer privileges.
This procedure is also described in the Jenkins Wiki.
go to config.xml and add this part temporarily to the role and it will give the admin right to user who have this role assigned.
<role name="admin" pattern=".*">
<permissions>
<permission>hudson.model.View.Delete</permission>
<permission>hudson.model.Computer.Connect</permission>
<permission>hudson.model.Run.Delete</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.ManageDomains</permission>
<permission>hudson.model.Computer.Create</permission>
<permission>hudson.model.View.Configure</permission>
<permission>hudson.model.Computer.Build</permission>
<permission>hudson.model.Item.Configure</permission>
<permission>hudson.model.Hudson.Administer</permission>
<permission>hudson.model.Item.Cancel</permission>
<permission>hudson.model.Item.Read</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.View</permission>
<permission>hudson.model.Computer.Delete</permission>
<permission>hudson.model.Item.Build</permission>
<permission>org.jenkins.plugins.lockableresources.LockableResourcesManager.Unlock</permission>
<permission>hudson.scm.SCM.Tag</permission>
<permission>hudson.model.Item.Move</permission>
<permission>hudson.model.Item.Discover</permission>
<permission>hudson.model.Hudson.Read</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.Update</permission>
<permission>hudson.model.Item.Create</permission>
<permission>hudson.model.Item.Workspace</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.Delete</permission>
<permission>hudson.model.Computer.Provision</permission>
<permission>hudson.model.Run.Replay</permission>
<permission>hudson.model.View.Read</permission>
<permission>org.jenkins.plugins.lockableresources.LockableResourcesManager.View</permission>
<permission>hudson.model.View.Create</permission>
<permission>hudson.model.Item.Delete</permission>
<permission>hudson.model.Computer.Configure</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.Create</permission>
<permission>hudson.model.Computer.Disconnect</permission>
<permission>org.jenkins.plugins.lockableresources.LockableResourcesManager.Reserve</permission>
<permission>hudson.model.Run.Update</permission>

Jenkins slave not working on mesos

I'm using the jenkins mesos plugin for CI.
Initially, I followed the following tutorial: http://www.ebaytechblog.com/2014/05/12/delivering-ebays-ci-solution-with-apache-mesos-part-ii/
but the jenkins itself was not being setup via this. (I got error could not load config.xml file, even there was one)
Then I followed https://rogerignazio.com/blog/scaling-jenkins-mesos-marathon/
, and I was able to run jenkins master (jenkin framework/scheduler), but when I define the scripts to run, the jenkins-slaves are not being created. I think I'm missing some configuration regarding slaves. Can you tell me, what's the reason that the slaves are not being created to run jobs.
On the jenkins build page, I'm getting :
(pending—Waiting for next available executor)
And in the jenkins-logs, i'm getting following error:
INFO: Provisioning Jenkins Slave on Mesos with 1 executors. Remaining excess workload: 0 executors)
Jun 19, 2015 4:02:55 PM hudson.slaves.NodeProvisioner$StandardStrategyImpl apply
INFO: Started provisioning MesosCloud from MesosCloud with 1 executors. Remaining excess workload: 0
Jun 19, 2015 4:02:55 PM org.jenkinsci.plugins.mesos.MesosComputerLauncher <init>
INFO: Constructing MesosComputerLauncher
Jun 19, 2015 4:02:55 PM org.jenkinsci.plugins.mesos.MesosSlave <init>
INFO: Constructing Mesos slave mesos-jenkins-1f8691df-9918-4175-87b3-bcc3de80b258 from cloud
Jun 19, 2015 4:03:05 PM org.jenkinsci.plugins.mesos.MesosComputerLauncher launch
INFO: Launching slave computer mesos-jenkins-1f8691df-9918-4175-87b3-bcc3de80b258
Jun 19, 2015 4:03:05 PM org.jenkinsci.plugins.mesos.MesosComputerLauncher launch
INFO: Sending a request to start jenkins slave mesos-jenkins-1f8691df-9918-4175-87b3-bcc3de80b258
Jun 19, 2015 4:03:05 PM org.jenkinsci.plugins.mesos.JenkinsScheduler requestJenkinsSlave
INFO: Enqueuing jenkins slave request
Jun 19, 2015 4:03:05 PM hudson.slaves.NodeProvisioner update
INFO: MesosCloud provisioning successfully completed. We have now 2 computer(s)
java.lang.NullPointerException
at org.jenkinsci.plugins.mesos.JenkinsScheduler.matches(JenkinsScheduler.java:306)
at org.jenkinsci.plugins.mesos.JenkinsScheduler.resourceOffers(JenkinsScheduler.java:252)
Jun 19, 2015 4:03:06 PM org.jenkinsci.plugins.mesos.JenkinsScheduler$1 run
SEVERE: The Mesos driver was aborted! Status code: 3
Edit: I think I'm getting error, because I've not defined any container port mappings.
Can anyone tell me how to do so?
Update : Actually there were many problems with 0.7 version of mesos plugin. So, I simply downgraded to 0.6 version.
For port mappings on marathon have a look here.
Hope this helps!

Openshift Jenkins does not appear to send Node label during build

I'm trying to get HA Openshift Origin working on CentOS 6.5 (Nightly packages, but may be a few days out) but one of the last things to get working is Jenkins.
When I start a build of an application, manually or after a git push, I get the following error:
Jun 06, 2014 2:24:52 PM hudson.plugins.openshift.OpenShiftCloud provision
INFO: Provisioning new node for workload = 2 and label = null in domain stu
Jun 06, 2014 2:24:52 PM hudson.plugins.openshift.OpenShiftCloud provision
INFO: Cancelling build - Label is null
Jun 06, 2014 2:24:52 PM hudson.plugins.openshift.OpenShiftCloud cancelBuild
INFO: Cancelling build
Jun 06, 2014 2:24:52 PM hudson.plugins.openshift.OpenShiftCloud cancelItem
INFO: Cancelling Item
Jun 06, 2014 2:24:52 PM hudson.plugins.openshift.OpenShiftCloud cancelItem
WARNING: Build null rawbldr has been canceled
Jun 06, 2014 2:24:52 PM hudson.triggers.SafeTimerTask run
SEVERE: Timer task hudson.slaves.NodeProvisioner$NodeProvisionerInvoker#f01ba81 failed
java.lang.UnsupportedOperationException: No Label
at hudson.plugins.openshift.OpenShiftCloud.provision(OpenShiftCloud.java:402)
at hudson.slaves.NodeProvisioner.update(NodeProvisioner.java:281)
at hudson.slaves.NodeProvisioner.access$000(NodeProvisioner.java:51)
at hudson.slaves.NodeProvisioner$NodeProvisionerInvoker.doRun(NodeProvisioner.java:366)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Looking at the code of the Jenkins plugin: https://github.com/openshift/jenkins-cloud-plugin/blob/master/src/main/java/hudson/plugins/openshift/OpenShiftCloud.java#L353 it just looks like the value of the label set in the job config isn't received for some odd reason, so a builder gear doesn't get spun up.
This is very similar to this old Q from Openshift Online, but it's unclear from the comments the actual cause other than "maintenance":
Cant build on openshift jenkins
Everything else that I've tried appears to work fine, so I'm not sure if it's a bug, or misconfiguration somewhere.
Thanks
Openshift-origin nightly packages
Jenkins 1.564 (1.564-1.1)
openshift-origin-cartridge-jenkins (1.22.1-1.git.0.3f73f10.el6)
openshift-origin-cartridge-jenkins-client (1.21.1-1.git.0.93d6489.el6)
Openshift Jenkins cloud plugin 1.4 (0.6.36-0.el6oso)
I have replicated the issue in a vagrant machine, so am currently assuming it's the combination of packages I'm running.
Could someone running from the nightly repos please specify which package versions of each of the above they have running without issue? Thanks
I got the same issue (that is how I got here), and the workaround for me was to go to Manage Jenkins > Configure system and then set the "# of executors" field to 1.
I've tried a few different versions of Jenkins with the latest Openshift cloud plugin
1.510 - works, but a bit old
1.554 - works if you set JENKINS_JAR_CACHE_PATH env var (see https://github.com/openshift/jenkins-cloud-plugin/issues/30)
1.564 - hits the above issue, doesn't ever spin up a gear let alone start the Jenkins slave
I'm currently running Jenkins v1.554 and setting an env var with the following Puppet
file { '/etc/openshift/env/JENKINS_JAR_CACHE_PATH':
ensure => present,
content => '/tmp/',
require => File['/etc/openshift/env/'],
owner => 'root',
group => 'root',
mode => '0644',
}
The Openshift guys will apparently be using v1.554 by default in the near future anyway.

Cant build on openshift jenkins

I am getting following exception when I try to build project on openshift jenkins
Apr 03, 2013 12:08:27 PM hudson.plugins.openshift.OpenShiftCloud provision
INFO: Provisioning new node for workload = 2 and label = null
Apr 03, 2013 12:08:27 PM hudson.plugins.openshift.OpenShiftCloud provision
INFO: Cancelling build - Label is null
Apr 03, 2013 12:08:27 PM hudson.plugins.openshift.OpenShiftCloud cancelBuild
INFO: Cancelling build
Apr 03, 2013 12:08:27 PM hudson.plugins.openshift.OpenShiftCloud cancelItem
INFO: Cancelling Item
Apr 03, 2013 12:08:27 PM hudson.plugins.openshift.OpenShiftCloud cancelItem
WARNING: Build null rawbldr has been canceled
Apr 03, 2013 12:08:27 PM hudson.triggers.SafeTimerTask run
SEVERE: Timer task hudson.slaves.NodeProvisioner$NodeProvisionerInvoker#6d7414 failed
java.lang.UnsupportedOperationException: No Label
at hudson.plugins.openshift.OpenShiftCloud.provision(OpenShiftCloud.java:391)
at hudson.slaves.NodeProvisioner.update(NodeProvisioner.java:227)
at hudson.slaves.NodeProvisioner.access$000(NodeProvisioner.java:51)
at hudson.slaves.NodeProvisioner$NodeProvisionerInvoker.doRun(NodeProvisioner.java:308)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
We are in midst of upgrade, that may be the cause here. Please try again after the upgrade is done. For up-to-date status check here: https://openshift.redhat.com/app/status
Issue was I have to "Restrict where this project can be run" and specify label (Earlier it worked without it..may be something else..)
If you want to build something on openshift jenkins it need to be connected with jenkins job workspace (you produce it when enabling in your openshift application by using Enable Jenkins builds option). Then to automatically created jenkins job option Restrict where this project can be run is added and there is placed reference to workspace.
Usually name looks like: {project_name}_build

Resources