Ways to Login Jenkins using Command line
&
Way to trigger Jenkins job using Command line or script
Wget
Note: If you are using wget 1.11, you might need to use the following options:
wget --auth-no-challenge --http-user=user --http-password=apiToken http://jenkins.yourcompany.com/job/your_job/build?token=TOKEN
With wget 1.10.x the following is enough (but will not work with 1.11.x) :
wget http://user:apiToken@jenkins.yourcompany.com/job/your_job/build?token=TOKEN
ex – wget http://yourserver/job/MyJobname/build?delay=0sec
CURL
Without authentication:
$ curl http://jenkins:8080/job/my%20job/build [ HTML page saying "Authentication required" ]
With authentication:
$ curl --user dbacher:$MY_API_TOKEN http://jenkins:8080/job/my%20job/build [ returns nothing and the build starts ]
curl -X POST http://server/view/name/job/jobname/build?delay=0sec --user 1019352:61bb8531292794315f5dda8113548630
Login Jenkins using groovy script or Perl Script or Java, please refer the reference page…
Reference:
https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients
https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API
- Best AI tools for Software Engineers - November 4, 2024
- Installing Jupyter: Get up and running on your computer - November 2, 2024
- An Introduction of SymOps by SymOps.com - October 30, 2024