Skip to main content

Posts

Showing posts with the label jenkins

Change to jenkins user

Look at the shell specified in /etc/passwd for the jenkins user. You can do so by running something like: grep jenkins /etc/passwd The output will look similar to this: jenking:1001:1001::/usr/local/jenkins:/bin/false The last field is the login shell of the user. Here you can see it is set to /bin/false which will immediately exit. The solution is to specify which shell to use as you described: su -s /bin/bash jenkins Or modify the login shell of the jenkins user with “usermod(8)” (executed as a root user) : usermod -s /bin/bash jenkins Then  grep jenkins /etc/passwd  should now output something like: jenkins:1001:1001::/usr/local/jenkins:/bin/bash After which.  su - jenkins  will work as you expect.

Jenkins: publish over ssh does not put files to remote server

Problem : I have strange issue on the latest Jenkins 1.634. Publish over ssh writes to log that it puts correctly file but nothing appears on remote server. e.g. I have logs SSH: cd  [var/www/data-fb-localtest] SSH: OK SSH: put  [asm.js] SSH: OK SSH: put  [asm.js.gz] SSH: OK SSH: put  [hero.data] SSH: OK SSH: put  [hero_main.js] SSH: OK SSH: cd  [/home/dev] SSH: OK SSH: cd  [var/www/data-fb-localtest/] SSH: OK SSH: put  [achievements.exm] SSH: OK SSH: put  [ai.exm] SSH: OK SSH: put  [atlas0.atlas] SSH: OK SSH: put  [atlas0.rgbz] SSH: OK but nothing appears in var/www/data-fb-localtest Solution : I found the issue. I do not set root remote directory and in publish task use absolute path. But plugin does use not absolute path but path relative to my user’s home directory

Jenkins – Publish Over SSH Plugin: How to copy directory

Problem: I’m trying to use  Jenkins’ Publish Over SSH  plugin to copy all files AND sub-directories of some given directory, but so far, I’ve only able to copy files and NOT directory. I have a directory named  foo  in my workspace, and during the build, I want to copy everything in this directory to a remote server. I’ve tried this pattern  foo/** , but it doesn’t copy all sub-directories. Solution: For recursive copy of directory you should give foo/**/*

GoCD installation on centos 7

Installation of the GoCD server using the package manager will require root access on the machine. You are also required to have a java version 8 for the server to run. The installer will create a user called go if one does not exist on the machine. The home directory will be set to /var/go. If you want to create your own go user, make sure you do it before you install the GoCD server. RPM based distributions (ie RedHat/CentOS/Fedora) The GoCD server RPM installer has been tested on RedHat Enterprise Linux and CentOS. It should work on most RPM based Linux distributions. If you prefer to use the YUM repository and install via YUM, paste the following in your shell — sudo curl https://download.gocd.org/gocd.repo -o /etc/yum.repos.d/gocd.repo sudo yum install -y java-1.8.0-openjdk #atleast Java 8 is required, you may use other jre/jdk if you prefer Once you have the repository setup, execute sudo yum install -y go-server Alternatively, if you have the server RPM  d...

GoCD installation on centos 7

Installation of the GoCD server using the package manager will require root access on the machine. You are also required to have a java version 8 for the server to run. The installer will create a user called go if one does not exist on the machine. The home directory will be set to /var/go. If you want to create your own go user, make sure you do it before you install the GoCD server.   RPM based distributions (ie RedHat/CentOS/Fedora) The GoCD server RPM installer has been tested on RedHat Enterprise Linux and CentOS. It should work on most RPM based Linux distributions. If you prefer to use the YUM repository and install via YUM, paste the following in your shell — sudo curl https://download.gocd.org/gocd.repo -o /etc/yum.repos.d/gocd.repo sudo yum install -y java-1.8.0-openjdk #atleast Java 8 is required, you may use other jre/jdk if you prefer Once you have the repository setup, execute sudo yum install -y go-server Alternatively, if you have the server RPM  downloaded : sudo ...

Jenkins - Publish Over SSH Plugin: How to copy directory

Problem: I'm trying to use  Jenkins' Publish Over SSH  plugin to copy all files AND sub-directories of some given directory, but so far, I've only able to copy files and NOT directory. I have a directory named  foo  in my workspace, and during the build, I want to copy everything in this directory to a remote server. I've tried this pattern  foo/** , but it doesn't copy all sub-directories. Solution: For recursive copy of directory you should give foo/**/*

Jenkins: publish over ssh does not put files to remote server

Problem : I have strange issue on the latest Jenkins 1.634. Publish over ssh writes to log that it puts correctly file but nothing appears on remote server. e.g. I have logs SSH: cd  [var/www/data-fb-localtest] SSH: OK SSH: put  [asm.js] SSH: OK SSH: put  [asm.js.gz] SSH: OK SSH: put  [hero.data] SSH: OK SSH: put  [hero_main.js] SSH: OK SSH: cd  [/home/dev] SSH: OK SSH: cd  [var/www/data-fb-localtest/] SSH: OK SSH: put  [achievements.exm] SSH: OK SSH: put  [ai.exm] SSH: OK SSH: put  [atlas0.atlas] SSH: OK SSH: put  [atlas0.rgbz] SSH: OK but nothing appears in var/www/data-fb-localtest   Solution : I found the issue. I do not set root remote directory and in publish task use absolute path. But plugin does use not absolute path but path relative to my user's home directory

Change to jenkins user

Look at the shell specified in /etc/passwd for the jenkins user. You can do so by running something like: grep jenkins /etc/passwd The output will look similar to this: jenking:1001:1001::/usr/local/jenkins:/bin/false The last field is the login shell of the user. Here you can see it is set to /bin/false which will immediately exit. The solution is to specify which shell to use as you described: su -s /bin/bash jenkins Or modify the login shell of the jenkins user with "usermod(8)" (executed as a root user) : usermod -s /bin/bash jenkins Then  grep jenkins /etc/passwd  should now output something like: jenkins:1001:1001::/usr/local/jenkins:/bin/bash After which.  su - jenkins  will work as you expect.