/stashbot

A plugin for Atlassian Stash to allow easy, self-service continuous integration with Jenkins

Primary LanguageJavaOtherNOASSERTION

Stashbot Helper is a plugin designed to enable a continuous integration workflow within stash (similar to gerrit + jenkins).

INSTALL GUIDE

To work with Jenkins, you MUST install the following jenkins plugins first.

  1. Jenkins GIT plugin
  2. Post build task

If either of these are missing, shit won't work.

DEV GUIDE

Eclipse

  1. Generate project files by running atlas-mvn eclipse:eclipse
  2. Load the code formatter settings by going to preferences, filtering on "formatter", selecting Java -> Code Style -> Formatter, and importing the xml file in code-style directory.
  3. Load the cleanup settings by going to preferences, filtering on "cleanup" (also under code style) and import the cleanup xml file from the code-style directory.
  4. Finally, again under preferences, filter on "save actions" for the java editor and check the options for "format source code", "format all lines", and "organize imports".

Doing these 4 things will ensure you do not introduce unneccessary whitespace changes.

NOTE: Please ensure you add a LICENSE block to the top of each newly added file.

Jenkins

To run jenkins for testing, simply obtain a suitable jenkins.war, then do the following to configure it:

  1. Run java -jar jenkins.war (or use the scripts in bin/)
  2. Navigate to http://localhost:8080 to configure
  3. Install the git plugin and post build task (required!)
  4. Ensure you navigate to a repository settings page and click "save", that is what initially creates/updates jobs in jenkins.

Custom Jenkins Client

Originally this plugin required a customized version of the jenkins-client library, but Cosmin, the author of this library, has generously (and expediently) accepted our patches, so the current version is maven is all that is required. If you are adding features which require patches to the library, however, you can do something like this to easily build your own copy and use it:

git clone https://github.com/RisingOak/jenkins-client.git $REPO_PATH
# make modifications, build jar using maven
atlas-mvn install:install-file -Dfile=$REPO_PATH/target/jenkins-client-0.1.5-SNAPSHOT.jar -DgroupId=com.offbytwo.jenkins -DartifactId=jenkins-client -Dversion=0.1.5-SNAPSHOT -Dpackaging=jar -DpomFile=$REPO_PATH/pom.xml

TODO

KNOWN BUGS

  • JenkinsManager.updateAllJobs() and createMissingJobs() are untested.

PLANNED FEATURES

POSSIBLE FUTURE FEATURES

  • Add authenticator to auth chain to allow dynamic credentials per-repo
  • Supposedly jenkins supports groovy scripting. We could possibly expose more functionality via arbitrary groovy by plugging into this.
  • Add support for using Bamboo for CI (or other CI tools)

LICENSE

Stashbot is released by Palantir Technologies, Inc. under the Apache 2.0 License. see the included LICENSE file for details.