I am new to Jenkins, just finish to configure my first build. My question how can I run Jenkins build from my pc? I mean via command line or some script or java code, I just need to trigger it. Where do I start?
Try reading the documentation about consuming jenkins API, see the examples using curl CLI tool.
Also here's a Java API Client example for you to inspect.
Related
I am designing a setup to run a python script on a windows machine remotely. I am planning to install python and Jenkins as a windows service on this machine (alternatively with docker). The intention is that multiple users will be able to send a request to a Jenkins API endpoint and this will trigger the same build that runs a shell command and run that python script. Master and node pcs are in a company network so security would not be an issue in the first place.
I would like to know the possibility of doing this as I planned and I appreciate any guidance. Thanks in advance.
It's possible.
You can introduce with python api reference
https://python-jenkins.readthedocs.io/en/latest/index.html
I'm developing a web application using python django. I want a CI service which can automatically pull the latest code from my github and run some test then deploy. I'm not familiar with CI, after searching for a while I found Jenkins seems to be a good solution. Can Jenkins be used for this?
Jenkins can be used with any project.
Regarding pulling the latest code, add the Jenkins GitHub plugin in order to be able to check "Build when a change is pushed to GitHub" under "Build Triggers".
That will launch your job on any new pushed commit on the GitHub repo.
From there, a Jenkins job can execute any command that you would do in command-line, provided the agent on which said job will be scheduled and executed has the necessary tools in its PATH (here python)
An alternative (which does not involved Jenkins) is to setup a webhook and a listener on your server which will detect a "push event" sent by said webhook.
Developed few scripts using GATLING tool
Able to execute those scripts as a standalone basis
Execution done through GATLING provided .bat file
Triggering of the batch file will ask for user inputs during run time to
select which scenario to simulate
Trying to integrate these scripts and trigger via JENKINS -
As parameterizing the argument does not support the GATLING provided bat
file
Configuring the GATLING provided bat file results in failure of build -
as it requires a user input during run time
Please anyone can provide a step wise approach to integrate GATLING scripts in JENKINS
Gatling support passing parameter : http://gatling.io/docs/current/cookbook/passing_parameters/
Gatling seems a Java tool and execute script by a .bat/.sh file, so that you can inspect what command and parameters it used in backgounnd sence with some tool's help. like 'processhacker' is a enhancement of Windows Task Management. with it you can see the whole command to help you find out how to pass scenario you want to run in command line. If 'processhacker' can't help that, you need to read the souce code of Gatling or send support mail to its company to ask help.
I am trying to find a solution to automate installation and configuration of Jenkins & SonarQube. The idea is to provide an easy to use provisioning utility for setting up CI. Ideally I would love to automate the following
Installation
Set up users,Build, Unit testing and Code coverage
Is there an SDK, CLI or similar which can be used from batch script?
Thanks
You can use the Jenkins docker image for the installation part - even if you're not using Docker you can still copy the installation procedure:
https://github.com/jenkinsci/docker
For the setup of jobs I would recommend the Job DSL:
https://github.com/jenkinsci/job-dsl-plugin
For the rest you can use the Jenkins CLI or you can manually configure it once and then extract the corresponding XML file from the Jenkins home and copy it into other installations.
I want to build my maven project in Jenkins and copy all the the jar files to a remote Unix machine.
Also I want to connect to a LDAP data Store and start the services and test if the services are up and running
Basically I want to do the following tasks after my project is successfully build in Jenkins:-
1)Copy current version of my project to designated machine and location
2)Copy configure to connect to a designated integration test DS
3)Start the services in my project
4)Test that it is running.
Can I achieve this by Publish over SSH plugin provided in jenkins??
Or Shall I create some scripts which can automate the above tasks.The reason I am asking this is because I am not very familiar with Jenkins and Unix scripting.
Is there any good approach to do this task.
Thanks in advance.
Ansia
The Publish over SSH plugin will allow you copy files to remote server and execute arbitrary commands on the remote server.
Question is - do you know how you would achieve the following on the remote server?
2)Copy configure to connect to a designated integration test DS
3)Start the services in my project
4)Test that it is running
If yes, just enter those commands into Publish over SSH configuration. Or provide a script to be executed.
If you don't know how to achieve that, then that's a separate question.
Yes, you can use the publish over ssh plugin to copy the jars, and execute a script which launches your services. Take a look here to see how to launch a script "in the background" so it does not get killed when the session ends or to avoid blocking the Jenkins build by making it wait for the script to finish executing
Can't say much about LDAP as I haven't used it but depending on your needs I guess you could create a basic helper-jar with spring-ldap or any other similar library.