|
1 | | -Jenkins SSH Agent Plugin |
2 | | -======================== |
| 1 | +# SSH Agent Plugin |
3 | 2 |
|
4 | | -Read more: [http://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin](http://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin) |
| 3 | +This plugin allows you to provide SSH credentials to builds via a |
| 4 | +ssh-agent in Jenkins. |
5 | 5 |
|
6 | | -Development |
7 | | -=========== |
| 6 | +# Requirements |
8 | 7 |
|
9 | | -Start the local Jenkins instance: |
| 8 | +Currently all **Windows** nodes (including the master) on which this |
| 9 | +plugin will be used must have the [Apache Tomcat Native |
| 10 | +libraries](http://tomcat.apache.org/native-doc/) |
| 11 | +installed. As of 1.0 should be unnecessary for Unix nodes. As of 1.14 |
| 12 | +unnecessary if `ssh-agent` is installed. |
10 | 13 |
|
11 | | - mvn hpi:run |
| 14 | +# Configuring |
12 | 15 |
|
| 16 | +First you need to add some SSH Credentials to your instance: |
13 | 17 |
|
14 | | -How to install |
15 | | --------------- |
| 18 | +Jenkins \| Manage Jenkins \| Manage Credentials |
16 | 19 |
|
17 | | -Run |
| 20 | + |
18 | 21 |
|
19 | | - mvn clean package |
| 22 | +Note that only Private Key based credentials can be used. |
20 | 23 |
|
21 | | -to create the plugin .hpi file. |
| 24 | +Then configure your build to use the credentials: |
22 | 25 |
|
| 26 | + |
23 | 27 |
|
24 | | -To install: |
| 28 | +And then your build will have those credentials available, e.g. |
25 | 29 |
|
26 | | -1. copy the resulting ./target/ssh-agent.hpi file to the $JENKINS_HOME/plugins directory. Don't forget to restart Jenkins afterwards. |
| 30 | + |
27 | 31 |
|
28 | | -2. or use the plugin management console (http://example.com:8080/pluginManager/advanced) to upload the hpi file. You have to restart Jenkins in order to find the pluing in the installed plugins list. |
| 32 | +From a Pipeline job, use the `sshagent` step. |
29 | 33 |
|
| 34 | +# Installation Example: MacOSX (10.7.5) |
30 | 35 |
|
31 | | -Plugin releases |
32 | | ---------------- |
| 36 | +**Irrelevant in 1.14+ when `ssh-agent` is available in the path.** |
33 | 37 |
|
34 | | - mvn release:prepare release:perform -B |
| 38 | +Prerequisites: |
35 | 39 |
|
| 40 | +- JDK7. The tomcat native libraries target the java 7 version. |
| 41 | +- APR - this seems to be preinstalled in /usr/lib/apr. |
36 | 42 |
|
37 | | -License |
38 | | -------- |
| 43 | +Note that tomcat itself is not needed. This works fine with winstone |
| 44 | +(just running jenkins jar from command line). |
39 | 45 |
|
40 | | - (The MIT License) |
| 46 | +Download and extract the tomcat native |
| 47 | +library: <http://tomcat.apache.org/download-native.cgi> |
41 | 48 |
|
42 | | - Copyright © 2012, CloudBees, Inc., Stephen Connolly. |
| 49 | + tar -zxvf tomcat-native-1.1.XX-src.tar.gz |
43 | 50 |
|
44 | | - Permission is hereby granted, free of charge, to any person obtaining a copy |
45 | | - of this software and associated documentation files (the "Software"), to deal |
46 | | - in the Software without restriction, including without limitation the rights |
47 | | - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
48 | | - copies of the Software, and to permit persons to whom the Software is |
49 | | - furnished to do so, subject to the following conditions: |
| 51 | +Build the native library: |
50 | 52 |
|
51 | | - The above copyright notice and this permission notice shall be included in |
52 | | - all copies or substantial portions of the Software. |
| 53 | + cd tomcat-native-1.1.XX/jni/native |
53 | 54 |
|
54 | | - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
55 | | - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
56 | | - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
57 | | - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
58 | | - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
59 | | - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
60 | | - THE SOFTWARE. |
| 55 | + ./configure --with-apr=/usr/bin/apr-1-config |
| 56 | + |
| 57 | + make && sudo make install |
| 58 | + |
| 59 | +Build the java interface: |
| 60 | + |
| 61 | + cd .. |
| 62 | + export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home |
| 63 | + |
| 64 | + ant build |
| 65 | + |
| 66 | + ant jar |
| 67 | + |
| 68 | +Copy the output jar somewhere suitable for inclusion in your jenkins |
| 69 | +CLASSPATH. |
| 70 | + |
| 71 | +Set environment variables prior to starting jenkins: |
| 72 | + |
| 73 | + export DYLD_LIBRARY_PATH=/usr/local/apr/lib |
| 74 | + export CLASSPATH=/path/to/tomcat-native-1.1.XX.jar |
| 75 | + java -jar jenkins.war |
| 76 | + |
| 77 | +Additionally, you might have to add bouncycastle to your JCE providers. |
| 78 | +If you attempt to use the plugin and get an exception like the |
| 79 | +following: |
| 80 | + |
| 81 | + java.lang.IllegalStateException: BouncyCastle must be registered as a JCE provider |
| 82 | + |
| 83 | +Then you may need to configure the jce provider. One way is to do this |
| 84 | +right in the JRE, so if Jenkins is using the same jdk as above, edit |
| 85 | + |
| 86 | +/Library/Java/JavaVirtualMachines/jdk1.7.0\_17.jdk/Contents/Home/jre/lib/security/java.security, |
| 87 | +and add the following line: |
| 88 | + |
| 89 | + security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider |
| 90 | + |
| 91 | +Then, restart jenkins. |
| 92 | + |
| 93 | +From there, configure using the instructions above. |
| 94 | + |
| 95 | +# Version History |
| 96 | + |
| 97 | +For new versions, see [GitHub releases](https://github.com/jenkinsci/ssh-agent-plugin/releases). |
| 98 | + |
| 99 | +For old versions, see the [old changelog](docs/old-changelog.md). |
0 commit comments