/tuleap-git-branch-source-plugin

Jenkins plugin to automate job creation out of Tuleap git repositories

Primary LanguageJavaMIT LicenseMIT

Tuleap Branch Source plugin for Jenkins

This jenkins plugin allow autodiscovery of Tuleap's git repositories and branches to automatically create jenkins jobs when branches have Jenkinsfile.

Works with any recent version of Jenkins >= 2 (latest LTS preferred).

How to use

  • Install the plugin (!)
  • In Jenkins global configuration you should reference your Tuleap instance (only one server ATM)
  • Then any Jenkins user can create a new "Tuleap project" job type
    • They should have a username/password jenkins credential with a user that can access the project you want to target
    • They need to select the project they want to work on
    • Update the filters (by default all repositories are ignored), for instance remove the "*" in "Exclude"
    • Save the conf
    • Then Jenkins should be automatically scanning the project
      • Find all matching git repositories
      • For each repo, scan all branches
      • For each branch, when there is a Jenkinsfile a job should be created and scheduled accordingly

Development

Todo

  • Make use of Tuleap API key instead of basic auth (server relief) This would be a really good stuff for better performances (basic auth is really CPU intensive) however we don't know how to do that properly today. There are 2 pain points
    • First, we should use "Secret key" (or token) to store the AccessKey (instead of user/password) but we didn't find a good documentation for that ATM.
    • Then the issue is that the same auth is used for API access and git operations (clone of repo, etc). However the access key cannot be used to do git operation so we should have 2 separated creds here.

On jenkins, connect to Tuleap

Configure Jenkins to accept a tuleap dev environment certificate

echo -n | openssl s_client -connect tuleap-web.tuleap-aio-dev.docker:443 |    sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'  > /usr/local/share/ca-certificates/tuleap-web.tuleap-aio-dev.docker.crt
keytool -keystore /docker-java-home/jre/lib/security/cacerts   -import -trustcacerts -storepass changeit -noprompt -alias tuleap-web-dev -file /usr/local/share/ca-certificates/tuleap-web.tuleap-aio-dev.docker.crt
update-ca-certificates

Build

You have a local java / maven env

Tested with OpenJDK 8

$> mvn clean install
$> cp target/tuleap-branch-source.hpi onto jenkins

With docker

docker run -it --rm -v ~/.m2:/var/maven/.m2 -u $(id -u) -e MAVEN_CONFIG=/var/maven/.m2 -v "$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.3-jdk-8 mvn -Duser.home=/var/maven clean install

Authors

  • RAMBELONTSALAMA Haja (project's initiator)
  • ROBINSON Clarck
  • VACELET Manuel