Hot answers tagged

49 votes

The option to "Launch slave agents via Java Web Start" is missing from new node configuration, how can I add it to the options menu?

This question was asked elsewhere: https://stackoverflow.com/a/38740924 You have to enable the TCP port of JNLP agents to enable this option for slaves. Manage Jenkins > Configure Global Security > ...
Adam Westhusing's user avatar
33 votes

Tell Jenkins to run a specific project on a particular slave node

If you are running a Pipeline job, you first want to add a label (e.g. 'slave') to the slave node (or agent as it seems to be called now). Then, in the pipeline script, you specify the label the job ...
jpyams's user avatar
  • 475
33 votes
Accepted

Allowing a non-root user to restart a service

sudo is the way to go. Create a new group (appadmin for example), put your jenkins user in it, and using visudo add a new entry with a limited list of commands, for example: Cmnd_Alias MYAPP_CMNDS = /...
brent's user avatar
  • 3,521
23 votes
Accepted

Using GIT variables in a declarative Jenkins pipeline

Finally I found an example and I was able to understand how to do this. I need to use a script command, obtain the Map returned by checkout and save the Map as environment variable: stage('Checkout ...
ColOfAbRiX's user avatar
  • 1,080
18 votes
Accepted

Jenkins: Trying to add a dumb slave but the option is missing, any idea how to add it?

I think the problem is in outdated Jenkins documentation. In 1.x version it was called "Dumb slave" and in modern versions "Permanent Agent". It is exactly the same.
toshyak's user avatar
  • 361
16 votes
Accepted

how to trigger jenkins job via curl command remotely

found the answer. Actually those steps are correct. I would like to mention the correct steps. Create a user in Jenkins, you can use that user password or API token for trigger Jenkins job. But ...
Prabath Dolawatta's user avatar
15 votes
Accepted

How to use for loop in Jenkins declarative pipeline

Pure declarative pipelines don't support loops. Use a script step. There's actually an example on that page that does exactly what you want. A more readable and concise (IMO) solution would use ...
simonz's user avatar
  • 371
13 votes
Accepted

Jenkins - Host key verification failed

There are two ways to fix that. First one is: Log into your Jenkins server and manually ssh to that machine and accept the key. Second one is: Add the following to your ssh command: -o ...
Itai Ganot's user avatar
  • 10.7k
12 votes

In Jenkins how to pass a parameter from Pipeline job to a freestyle job

ON THE CALLING JOB: pipeline { agent any parameters { string(defaultValue: "123", description: 'This is a parameter', name: 'PARAMETER01') } stages { stage('Start'){ ...
Lucas Henrique's user avatar
11 votes

Nginx - Forward HTTP AUTH - User

To get this to work with Jenkins reverse proxy auth plugin: proxy_set_header Authorization ""; proxy_set_header X-Forwarded-User $remote_user; If you don't reset Authorization header, nginx will ...
Olli's user avatar
  • 808
11 votes

How to make Jenkins CI use Local time instead of UTC on debian squeeze

Three years later, I found several gotchas getting this to work. So, I'll elaborate upon the accepted answer (which is correct) and add a complete answer for CentOS. Gotcha #1: The Jenkins settings ...
bishop's user avatar
  • 1,085
11 votes
Accepted

Safely delete the contents of 'workspace' and 'jobs' in Jenkins

Yes, you can delete the workspaces safely as well as jobs. The idea of the jobs directory is to allow you to display jobs history, if job history is not important for you then you can delete job ...
Itai Ganot's user avatar
  • 10.7k
10 votes

How to use Jenkins with SSL / https

For an Ubuntu server (assuming you installed with apt-get install jenkins): You'll want to edit /etc/default/jenkins at the bottom of the file, edit Jenkins_args. In my args, I've disabled http ...
Loren's user avatar
  • 233
10 votes
Accepted

Jenkins not starting in Ubuntu

Finally figured it out. I ran the command manually to run jenkins /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080 --...
NIlesh Sharma's user avatar
10 votes

How give aws credential to jenkins pipeline?

To be able to upload to S3, you need to save your credentials in environment variables on your Jenkins: AWS_DEFAULT_REGION=<region of bucket> AWS_ACCESS_KEY_ID=<aws id> ...
red.avtovo's user avatar
10 votes
Accepted

Installing Jenkins on Ubuntu tells me "Package 'jenkins' has no installation candidate"

You're following unofficial or out of date instructions. Because of this, you imported the wrong GPG key. Jenkins changed their GPG key on 16 April 2020. You need to import the correct key following ...
Michael Hampton's user avatar
8 votes

Jenkins/Hudson - LDAP group *lookup* does not work

had the same problem today with Jenkins 2. LDAP is configured working and I can login as AD user, I can add AD user to matrix, but when I add a group into matrix, it shows "user/group not found" for ...
jack.chen.job's user avatar
8 votes
Accepted

Using iptables port redirection with docker

A possible modification to the iptables rules is to remove both and replace with: iptables -t nat -A PREROUTING -p tcp -m tcp -i eth0 --dport 80 -j REDIRECT --to-ports 8080 This will ensure that, ...
davidA's user avatar
  • 383
7 votes

How to make Jenkins CI use Local time instead of UTC on debian squeeze

In Ubuntu 14.04, none of the above solutions worked for me, but I ended up running the following command, which pulls up an interface where the timezone can be changed from the default (none selected) ...
jmort253's user avatar
  • 449
7 votes
Accepted

Jenkins + LDAP Plugin --- Any way to have a login backdoor?

You're right that vanilla Jenkins can't do more than one authn/authz type, which makes local accounts infeasible. In the scenario where LDAP is unavailable temporarily, what I've done in the past is ...
jayhendren's user avatar
  • 1,024
7 votes
Accepted

Jenkins: Using Parameterized Trigger Plugin via Pipeline Script

You don't need a plugin at all to do this. The built-in Pipeline build step supports parameters. E.g.: build( job: 'my-job-name', parameters: [ [ $class: 'StringParameterValue', ...
jayhendren's user avatar
  • 1,024
6 votes

How do I check the build status of a Jenkins build from the command line?

Another Python solution: from jenkinsapi.jenkins import Jenkins jenkins_url = 'http://<server url>/' server = Jenkins(jenkins_url, username = 'myUser', password = myPass) job_instance = ...
ddtraveller's user avatar
6 votes

Trying to run Jenkins behind SSL reverse proxy - 404 http://localhost/jenkins/manage vs. https:

I had a problem like this just now, and what solved it for me was described in https://stackoverflow.com/a/20514632/1446479 My NOT working config used this line: proxy_pass http://127.0.0.1:8015/...
peedee's user avatar
  • 431
6 votes

Integrate Amazon Elastic Container Registry with Jenkins

This is now possible using amazon-ecr-credential-helper as described in https://aws.amazon.com/blogs/compute/authenticating-amazon-ecr-repositories-for-docker-cli-with-credential-helper/. The short ...
Klugscheißer's user avatar
6 votes
Accepted

Jenkins execute shell scp

echo 'password' | sudo -S scp ... no, it is not a good idea and it does not work, as discussed many times around SE. SSH flushes input before reading password. You should set up ssh keys. If keys ...
Jakuje's user avatar
  • 9,805
6 votes

Jenkins on Docker - Free Swap Space 0

Run the following command to see if your host has a swap file configured: free|grep -i Swap Swap: 0 0 0 If you get "Swap: 0 0 0" ...
AAber 's user avatar
  • 161
6 votes

Why is PATH different when launching Jenkins slave via launchctl?

I don't know for sure, but my first guess is that this is because Jenkins is not launching the subshell as a 'login shell'. When you log into a shell in an interactive environment, the shell loads ...
Jesse Adelman's user avatar
6 votes
Accepted

Per-job environments in Jenkins with virtualenv

I had the same issue. After talking with some veteran Jenkins admins, this is the solution I arrived at: def runCommandInMyEnvironment(cmd) { sh "setup_environment_command; source ./some/file; ${...
jayhendren's user avatar
  • 1,024
6 votes

Jenkins failing to run after attempting to implement AD login

This is likely because your /var/lib/jenkins/config.xml has a section in it that looks like the following: <securityRealm class="hudson.plugins.active_directory.ActiveDirectorySecurityRealm" ...
jayhendren's user avatar
  • 1,024
5 votes

How do I check the build status of a Jenkins build from the command line?

You can use a Groovy script: Via jenkins-cli echo 'println(jenkins.model.Jenkins.instance'\ '.getItem("<JOB-NAME>").lastBuild.building)' \ | java -jar jenkins-cli.jar -s <JENKINS-URL&...
tworec's user avatar
  • 163

Only top scored, non community-wiki answers of a minimum length are eligible