Jenkins disable build now - jenkins

I need to disable "Build now" option on Jenkins, I have a job building a branch and deploy SNAPSHOTs to a server. I need a production Job, that generates only stable versions, using maven release, but for this job I think the best approach is disable "Build Now" option and use only Maven Release. So Can I do this?

Use Authorization strategy plugin to disallow running the job. If configured right - no one will see "Build Now" button. Another options is Job Restrictions plugin, but it looks a bit clumsy or simply not that good for this particular task.

Related

Avoid report to verified/code-review flag for a specific Jenkins Job

I'm using Jenkins with gerrit trigger.
We have a global gerrit trigger configuration that says that if a build is marked as NOT_BUILT the plugin should overwrite verified and code-review flag on gerrit with 0.
I can't change the default configuration of the plugin but for a certain job I need to avoid that overwrite in case the build is in NOT_BUILT status.
Is there an easy way to achieve that without installing additional plugins?
I suppose you don't want to "silence" the job (use the "Silent Mode" option), right?
You could try to use the "Skip Vote" option:
But I'm really not sure if it will work.

How to trigger a Jenkins build on a Perforce submit

I am using Jenkins with Perforce. I have downloaded the P4 Plugin, and I have read over the documentation but I am still a bit confused. In my Jenkins project, I have the build trigger set to "Perforce triggered build". I'm assuming that means I need to add a trigger to Perforce that tells Jenkins to run a build, but I have no idea on how to do that.
I have not been able to find any documentation on how to implement a trigger from Perforce to notify Jenkins it needs to run. I can find documentation from Perforce on how to setup basic triggers, but I can not find anything from Jenkins on how to set up the actual connection to trigger builds on Perforce submits.
On the "Changes" tab in Jenkins, I am able to see the what was submitted to Perforce, so I know that Perforce and Jenkins are at least communicating. Initially, I thought that Jenkins would just automatically run the build on a Perforce submit, if I had "Perforce triggered build" checked, but that doesn't seem to be the case.
So my questions are:
Am I correct in assuming that I need to manually create a trigger to be added to Perforce?
If so, does anyone know of any documentation or examples that I can look to as a guide?
Yes, you need to add a trigger to Perforce. It's well documented here.

Do Jenkins multibranch Pipelines allow remote triggers?

I am trying to to allow my multibranch Jenkins Pipeline to be triggered from a script. However each time I check the box and enter my token name and hit save, it does not save the configuration. When I next hit edit configuration the checkmark next to "Trigger builds remotely" is no longer checked.
Is this intentional? Do MultiBranch Pipeline jobs not support remote triggers?
Actually, for now, it is possible to trigger the build of a multibranch pipeline, but the token is simply ignored.
If you go in a branch of your multibranch pipeline and go to "View Configuration", you can try to check "Trigger builds remotely (e.g., from scripts)" and see that it gives you a link like JENKINS_URL/job/<your-multibranch-pipeline>/job/<your-branch>/build.
That sounds a bit like a hack, and you might have authentication problems depending on your setup, but otherwise it does trigger the build with Jenkins 2.30.
I have the same problem. Haven't found a solution yet, but there is a bug report open against it.

How to start rebuild in Jenkins?

Is there a way in Jenkins to rebuild the old build jobs ? For instance I want to build job with the build number #712 but when I click the job link's I don't see any build option to restart the build.
Jenkins provide a plugin called "Rebuild plugin" after installing this plugin user allows to rebuild a parametrized build without entering the parameters again.It will also allow the user to edit the parameters before rebuilding.
Is this what you are looking for?
In my (frustrating) experience, the "Build Now" or "Restart" or "Replay" buttons are not there because you didn't login Jenkins!
today, they name it "Restart From Stage"

Build Pipeline Plugin & Manual Deployment With Parameter

Let's say I have this situation. I have three jobs. Job number one has two manually triggered downstream jobs (deploy to test, deploy to prod for example). Something like this:
I want the deployment jobs (test-job-2, test-job-3) to require a password before they are triggered. How can I solve this with Jenkins?
The only option right now supported by the Build Pipeline Plugin is to have a manually deployed downstream job. But this job starts right after you click on it. I would like to require the user to manually enter some parameters (password for example).
Is there some workaround? I was thinking of using the Promoted Builds Plugin. So the deployment jobs would run in a "dry run mode" - just checking that we have ssh access to the server and some other basic stuff. And then in order to deploy you will have to promote the build.
This approach isn't very nice though. Build pipeline and promoted builds plugins don't interact with each other very well.
This is not exactly what you want, but I guess it would some how solve your problem.
View Job Filters
Using this feature in tandem with a security feature such as the Standard matrix based security can help you create a view that will show different jobs depending on who is logged in.
I use different Jenkins Servers to "complete the pipeline" using Build Publisher job to publish the last part of the pipeline job to the other jenkins. I then pick it up from there. Operations teams have access to the "prod" jenkins system, and developers have access to the "dev" system.

Resources