I am using Jenkins version 2.222.1 with EWM version 7.0 (Formerly known as RTC). When I am trying to save a build definition created in RTC I am getting this error.
I have checked the test connection was successful while creating build engine in RTC.
This is similar to this issue:
either the user for the test connection is not the same as the one used to access Jenkins Job in the RTC build definition
or it is, but without the right, on Jenkins permission matrix, to view jobs
or the user is Jenkins admin and has all the right anyway, but the Jenkins logs might include something like "WARNING hudson.security.csrf.CrumbFilter#doFilter: No valid crumb was included in request for ... by <aUser>: Returning 403"
The last case is an actual RTC issue, to be fixed with RTC 7.x (and seen with Jenkins 2.190 or later)
Related
When I do some code changes and push the code to Gerrit. Jenkins build gets triggered and we usually get verified voting +1 or -1 depending on the result on to the Gerrit UI for that change.
Currently, we observed that for any of the compilation errors it is not reporting on to the Gerrit. And this happens only for compilation errors, not for failing tests, failing git checkouts or other reasons that make a build fail.
Below I've mentioned the version details. Any suggestions will be highly appreciated.
Gerrit Version: 2.14.2
Jenkins Version: 1.642.3
Gerrit-Trigger plugin: 2.18.3
Project: Java project
Build Tool: Maven
Regards
Sharieff.
That's intended for an "Unstable build" (i.e. compile/build errors but not a test error) in the default Gerrit-trigger configuration.
Take a look at your "Gerrit Reporting Values" for the project/default configuration.
If you want to use the "verify" label for unstable (i.e. compile errors) and failed (test errors) builds, configure the verify values like seen below.
(iirc the default configuration uses code-review = -1 for unstable, for this the used gerrit account needs the permission to submit a code-review label)
I am using an TFS agent to schedule some Build using triggers. My issue is that when the build starts it wants to get latest version (sync repository). But I get an unusual error:
I have literally no ideea where to begin, it's like it could reach the server or something.
I could not comment. Hence providing an answer.
Does the account your agent is running under, has rights to the TFS repository mapped in the build?
For more logs check the logs in D:\Kits\agent_diag folder.
I’m using Jenkins v 1.61 with Java 7. I have a Maven job set up, using SVN for Source Code Management. I have a “Run buildstep before SCM runs” set up (courtesy of the pre-scm-buildstep plugin) and a pre-build step (a short script) set up prior to the Maven goals being run.
My question is, if any of these steps fails, how can I get notified via email of the failure?
Use Jenkins Mailer Plugin, This plugin allows you to configure email notifications for build results.
Plugin ID mailer
Latest Release 1.18
Latest Release Date Sep 04, 2016
Required Core 1.625.3
E-Mail notifications are configured in jobs by adding an E-mail notification Post-build Action. If configured, Jenkins will send out an e-mail to the specified recipients when a certain important event occurs:
Every failed build triggers a new e-mail.
A successful build after a failed (or unstable) build triggers a new
e-mail, indicating that a crisis is over.
An unstable build after a successful build triggers a new e-mail,
indicating that there's a regression.
Unless configured, every unstable build triggers a new e-mail,
indicating that regression is still there.
How about combining pre-scm-buildstep, conditional-buildstep and any-buildstep plugin.
This should allow you to run a publisher step like sending email notifications on a regular build step or a pre scm build step (feature provided by any-buildstep plugin). You could also add a condition check (feature provided by the conditional-buildstep plugin) on the pre-scm-buildstep phase.
You've mentioned that you use a short script prior to the pre-scm-buildstep, just in case you're exporting environment variables as input for your conditional check, remember that you'll also need to write that to a properties file (SEND_EMAIL=true >> my-job.properties) and use env inject plugin to load them on your job environment variables, freestyle jobs don't persist exported shell variables on build steps to be visible to the next steps that come after it.
Lot's of plugins right? Quite annoying. If you want something more elegant, I would recommend using pipeline as code plugin and wrapping everything on a try/catch/finally block, so you could raise an exception before the code checkout stage given a failed check, there are some examples in this article.
Is there any way in jenkins where as soon as we detect the failed build, job revert back the perforce code to the last successful build changelist and fire a build again.
Flow -
1. so as soon as we have failed build - Notifcation will be sent out to dev team with possible checkins which causing the build failure
Revert back the recent code to the last working code and submit it
Initiate a build.
It is possible, but I don't see any reasons or use case to do it as it is not a correct workflow and can be confusing.
But if you decided to do it, the next steps are required:
Example how to do it using Perforce source control.
Steps inside job settings:
Before build triggers you need to save latest changelist number $P4_CHANGELIST - 1
Perforce plugin for Jenkins: Perforce plugin for Jenkins
Build
Get last error code
Get last error code from the: batch
If code != 0 then checkout and build changelsit $P4_CHANGELIST - 1
Jenkins is not a production server. It runs tasks and do not have options that I know for that purpose.
What is your source code ? webapps ? others ?
What steps are you performing ?
Are you performing some automatic tests ?
My assumption is that you got some tests that may invalidate the build.
These tests should be runned :
* on a mock server to prevent deploying on your server
* or somewhere else
Like that, if build failed, nothing is deployed.
If build success, you can deploy your project normally.
If this not reply to your answer, please provide requested information to undestrand a bit more your job process.
If your using an artifact repository like Nexus or Artifactory to manage your project artifacts then you could always redeploy the previous working version of your application when a failure is detected.
Your not cancelling any checked in code that potentially broke the build but you are preserving your test environment. You can configure Jenkins to notify the user who checked in the latest erroneous change set and they can work on resolving the issue.
Jenkins also provides a rich API which allows you to delete a job, start a job, get information about previously run jobs. You could leverage some of these services along with your artifact repo to achieve the experience you described.
On our Jenkins (1.492) I have the Claim Plugin installed. Jenkins is configured to use LDAP using matrix authorization.
After installing the plugin and enabling the plugin in the configuration of each job the /claim view says "Welcome to the Hudson Claim Report. There are no failing builds. Excellent work!" and does not list any builds to claim.
I have both unstable and failed builds.
I have rebuilt the failing and unstable builds after installing the plugin and configuring the jobs.
I have also changed the default view back to "All" - I read somewhere that there may be a problem.
I did also restart Jenkins.
I am logged in with an LDAP user.
The claim view does not list anything.
I have no claim icon in the build history of the job.
I have no claim link on the build page beneathe "started by user".
I have added a "Claim" column to a custom view with failing tests - but it's empty.
But I can claim a single regression via the test report view on a unstable build.
What have I missed? How can I find the problem?
In order to activate the Claim Plugin you must first add the 'Allow broken build claiming' action to the 'Post-build Action' section of one or more jobs. The next time the job fails after adding this step, it should be available to claim.
Configuring this on a large number of jobs is a bit of a pain but fortunately someone has contributed a Groovy script to allow broken build claiming on every job.