Jenkins

From Andreida
Revision as of 16:40, 29 February 2020 by Andreas (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  • installation http://pkg.jenkins-ci.org/debian/
  • Default port is 8080
  • when using svn hooks with tokens, the called url must be in double quotes or you will lose the not-first get parameters ('cause').
  • svn hook (make sure: sh -> bash) if you have multiple projects in one repository but want to call Jenkins only for the current commit.
    • change JENKINS_IP and
    • PROJECTS=( YourProject1 YourProject2 )
#!/bin/bash

REPOS="$1"
REV="$2"
TXN_NAME="$3"

export PATH=$PATH:/usr/bin

PROJECTS=( YourProject1 YourProject2 )

for PROJECT in ${PROJECTS[@]}; do
   svnlook changed $REPOS --revision $REV | grep -q "$PROJECT" && wget -q "<JENKINS_IP>:8080/job/$PROJECT/build?token=$PROJECT"
done

exit 0


You might need to give the username/password for Jenkins, so the svnlook line above would be like:

svnlook changed $REPOS --revision $REV | grep -q "$PROJECT" && wget -q --auth-no-challenge --http-user=<jenkins-user> --http-password=<jenkins-password> "http://localhost:8080/job/$PROJECT/build?token=$TOKEN"