Issue installing Jenking ci on Linux mint - jenkins

when i try to install jenkins on Linux mint i am getting the following error.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
jenkins : Depends: daemon but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
I am not sure how to resolve the dependecy issue with daemon. I have tried to install daemon its not somehting which can be installed. I believe i may have to enable some setting for this daemon to work.

So, did you try to run apt-get -f install? It usually works.
It is, of course, possible that Mint has packaged daemon under a different name.
Please bear in mind that Jenkins does in no way depend on being installed from a Debian package. Jenkins is a single file (jenkins.war) that you can just download yourself and run java -jar jenkins.war to play with it.
When you have played enough and want to get serious, you probably want to install a web server that supports .war files, like Tomcat and use that to host Jenkins. See https://wiki.jenkins-ci.org/display/JENKINS/Containers

Related

Jenkins on ec2 not recognizing composer or npm - both are installed

I've installed Jenkins on an Amazon ec2 instance according to the instructions here https://www.jenkins.io/doc/book/installing/linux/#red-hat-centos and when I try to run a job that has an execute shell command step that does "composer install" or "npm install" it isn't recognizing either command. However from the terminal (as ec2-user) I can run both. Is there something I need to do to let Jenkins know where to find these commands?
I just realized I can sudo su jenkins and install composer as that user.
For NPM, this article helped. You need to install the nodejs plugin, restart Jenkins, then in the build environment section of the configuration of your job, choose "Provide Node & npm bin/ folder to PATH".
I was still having problems running ng commands - after installing the ng client as the jenkins user. This post helped - which says to add "npm run" before ng.
I hope this helps someone. Especially since I figured it out moments after offering my bounty!

npm library fails to install in GitLab CI

My Docker image build has been failing to build lately and I've managed to trace down
where exactly it struggles.
When the runner is executing RUN npm install react-scripts#2.1.8 -g --silent --no-optional (from Dockerfile)
it fails and gives no error output to work with. Job log shows no clue as to why it failed.
I figured I could SSH into the CI server but GitLab doesn't support direct SSH access into CI server for debugging purposes.
My question is how can I debug this ? What steps I should take ? I don't deal every day with
bug where I get no error output.
What are the conditions in which GitLab runner may fail to install it ?
Note:
I ran it locally and no problem whatsoever hence it must be problem within the CI.
is the build of your image is ok in your computer ? You can also install a gitlab runner in your computer to test your gitlabci file
Try removing the --silent flag from the npm install command. I reckon you'll see a bit more then.
Timeout of the build runner was to blame in this particular case. As soon as I reorganized the code in build script npm library was successfully installed.

Building jhipster in Windows Jenkins

When I try to build JHipster on a windows Jenkins instance, I get the following error
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.trecloux:yeoman-maven-plugin:0.4:build (run-frontend-build) on project jhipster: Error during : cmd /c bower --version
I tried running Pprod clean package from the commandline and it works fine.
Any thoughts / Help appreciated.
That's because Jenkins's node environment is not complete, make sure bower is in its path. Bower should be installed using npm install -g bower
Please refer to our documentation about Jenkins setup: http://jhipster.github.io/setting-up-ci/
Thanks to Gaël Marziou, I zeroed in on the problem to access issues for the Jenkins user. I was able to solve it using the NodeJS plugin.

How to auto-start Jenkins in Ubuntu?

I am using Ubuntu 12.04. And i want to Jenkins to get automatically start with my system to perform building the tasks. Kindly let me know the steps
The best way to achieve this, in case you want to use Jenkin's built-in web server, is just to install a prepacked version of the software available at official Jenkins Debian/Ubuntu repository. It's as easy as installing any other software on Debian/Ubuntu-like distro. The package will add a startup scripts to your installation which you can control as any other daemon.
If you preffer to use your own installation you can use a startup script that is available on Jenkin's GitHub repository. Quite possibly you will have to modify it to suite your installation, but it's a very good starting point...
Go to your /etc/rc.local file and add the line: /etc/init.d/jenkins start to your file
This will run your jenkins start command on startup.
If jenkins is not starting at boot time install the chkconfig package:
apt-get install chkconfig
And then issue the following command:
chkconfig --add jenkins
Finally, with chkconfig --list you should obtain a list with a line inside stating the runlevels at which jenkins will start:
jenkins 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Try this command in ubuntu
update -rc.d jenkins defaults

How to install a plugin in Jenkins manually

Installing a plugin from the Update center results in:
Checking internet connectivity Failed to connect to
http://www.google.com/. Perhaps you need to configure HTTP proxy? Deploy Plugin Failure - Details hudson.util.IOException2: Failed to download from
http://updates.jenkins-ci.org/download/plugins/deploy/1.9/deploy.hpi
Is it possible to download the plugin and install it manually into Jenkins?
Yes, you can. Download the plugin (*.hpi file) and put it in the following directory:
<jenkinsHome>/plugins/
Afterwards you will need to restart Jenkins.
Download the plugin.
Inside Jenkins: Manage Jenkins → Manage Plugins → There is a tab called Advanced and on that page there is an option to upload a plugin (the extension of the file must be hpi).
Sometimes, when you download plugins you may get (.zip) files then just rename with (.hpi) and use the UI to install the plugin.
If you use Docker, you should read this file: https://github.com/cloudbees/jenkins-ci.org-docker/blob/master/plugins.sh
Example of a parent Dockerfile:
FROM jenkins
COPY plugins.txt /plugins.txt
RUN /usr/local/bin/plugins.sh /plugins.txt
plugins.txt
<name>:<version>
<name2>:<version2>
I have created a simple script that does the following:
Download one or more plugins to the plugin directory
Scan all plugins in that directory for missing dependencies
download this dependencies as well
loop until no open dependencies are left
The script requires no running jenkins - I use it to provision a docker box.
https://gist.github.com/micw/e80d739c6099078ce0f3
Sometimes when you download plugins you may get (.zip) files then just rename with (.hpi) and then extract all the plugins and move to <jenkinsHome>/plugins/ directory.
Update for Docker: use the install-plugins.sh script. It takes a list of plugin names minus the '-plugin' extension. See the description here.
install-plugins.sh replaces the deprecated plugins.sh which now warns :
WARN: plugins.sh is deprecated, please switch to install-plugins.sh
To use a plugins.txt as per plugins.sh see this issue and this workaround:
RUN /usr/local/bin/install-plugins.sh $(cat /usr/share/jenkins/plugins.txt | tr '\n' ' ')
Use https://updates.jenkins-ci.org/download/plugins/. Download it from this central update repository for Jenkins.
The accepted answer is accurate, but make sure that you also install all necessary dependencies as well. Installing using the CLI or web seems to take care of this, but my plugins were not showing up in the browser or using java -jar jenkins-cli.jar -s http://localhost:8080 list-plugins until I also installed the dependencies.
The answers given work, with added plugins.
If you want to replace/update a built-in plugin like the credentials plugin, that has dependencies, then you have to use the frontend. To automate I use:
curl -i -F file=#pluginfilename.hpi http://jenkinshost/jenkins/pluginManager/uploadPlugin
In my case, I needed to install a plugin to an offline build server that's running a Windows Server (version won't matter here). I already installed Jenkins on my laptop to test out changes in advance and it is running on localhost:8080 as a windows service.
So if you are willing to take the time to setup Jenkins on a machine with Internet connection and carry these changes to the offline server Jenkins (it works, confirmed by me!), these are steps you could follow:
Jenkins on my laptop: Open up Jenkins, http://localhost:8080
Navigator: Manage Jenkins | Download plugin without install option
Windows Explorer: Copy the downloaded plugin file that is located at "c:\program files (x86)\Jenkins\plugins" folder (i.e. role-strategy.jpi)
Paste it into a shared folder in the offline server
Stop the Jenkins Service (Offline Server Jenkins) through Component Services, Jenkins Service
Copy the plugin file (i.e. role-strategy.jpi) into "c:\program files (x86)\Jenkins\plugins" folder on the (Offline Jenkins) server
Restart Jenkins and voila! It should be installed.
This is a way to copy plugins from one Jenkins box to another.
Copy over the plugins directory:
scp -r jenkins-box.url.com:/var/lib/jenkins/plugins .
Compress the plugins:
tar cvfJ plugins.tar.xz plugins
Copy them over to the other Jenkins box:
scp plugins.tar.xz different-jenkins-box.url.com
ssh different-jenkins-box.url.com "tar xvfJ plugins.tar.xz -C /var/lib/jenkins"
Restart Jenkins.
use this link to download the lastest version of the plugins' hpi. https://updates.jenkins-ci.org/download/plugins/
Then upload the plugin through 'manage plugin' in Jenkins
To install plugin "git" with all its dependencies:
curl -XPOST http://localhost:8080/pluginManager/installNecessaryPlugins -d '<install plugin="git#current" />'
Here, the plugin installed is git ; the version, specified as #current is ignored by Jenkins. Jenkins is running on localhost port 8080, change this as needed. As far as I know, this is the simplest way to install a plugin with all its dependencies 'by hand'. Tested on Jenkins v1.644
RUN /usr/local/bin/install-plugins.sh amazon-ecs:1.37 configuration-as-code:1.47 workflow-aggregator:2.6 \
cloudbees-folder:6.15 antisamy-markup-formatter:2.1 build-timeout:1.20 credentials-binding:1.24
Cat out the plugins.txt and install in Dockerfile as above.

Resources