I am working with a Jenkins build server to run synthesis/simulation for FPGAs. Right now I have nightly builds and can start the build manually in Jenkins browser interface.
My question is:
Is there any possibility to start a job build with a batch script without using browser interface?
(I am running Jenkins on Windows 7 64bit.)
Add the batch command as run. Click on Apply and save the configuration then, you will redirect to the Project Workspace. Click on the Build Now, it will execute the given batch command that executes the run. bat file. You can see the console results on the Console Output.
Create a remote Jenkins build trigger in three stepsCreate a Jenkins build job and enable the Trigger builds remotely checkbox. Provide an authentication token; This can be any text string of your choice. Invoke the Jenkins build URL to remotely trigger the build job.
Run the command java -jar jenkins. war . Browse to http://localhost:8080 and wait until the Unlock Jenkins page appears.
In the new Jenkins Pipeline, under Build Triggers, select the checkbox Trigger builds remotely (e.g., from scripts). Then give Jenkins a token that will be required when triggering the build.
Not authorized
errorsA problem with triggering the builds remotely is, if you've set up Jenkins right and disabled anonymous user access, you will get Not authorized
errors when you try to trigger the build from a script (as @keocra pointed out). You now have two options:
To trigger the build remotely, run
curl JENKINS_URL/buildByToken/build?job=JobFoo&token=MyToken
Where JENKINS_URL
is the URL to your Jenkins instance, JobFoo
is the name of your job, and MyToken
is the token you entered under Trigger bulids remotely.
Of course, you don't need to use curl
; you can also use wget
or any other program that can make HTTP requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With