echo "============================================"
}
+function doDebianPackaging {
+ if [[ -d "$WORKSPACE/debian" ]]; then
+ return 1
+ else
+ return 0
+ fi
+}
+
#############
# MAIN
#############
SUITE=$1 # this has to be either squeeze or wheezy currently
-if [[ -z "${SUITE}" ]]; then
- SUITE="squeeze"
- echo "Warning: SUITE not defined, defaulting to \"squeeze\"."
+
+if [[ doDebianPackaging ]]; then
+ if [[ -z "${SUITE}" ]]; then
+ SUITE="squeeze"
+ echo "Warning: SUITE not defined, defaulting to \"squeeze\"."
+ fi
fi
+
cd $WORKSPACE
-validateSettings
+
+if [[ doDebianPackaging ]]; then
+ validateSettings
+else
+ echo "No debian folder detected, skipping handling"
+fi
+
export
set -e # fail on error
set -x # echo commands executed
-# write correct debian/changelog
-if [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]]; then
- # generate debian/changelog entries since the last upload
- git-dch -a --ignore-branch --no-full --no-meta --id-length=7 -N $VERSION
- # make sure distribution in changelog is set correctly
- # (read the comments for the sed command 5 lines below to understand this)
- sed -i "0,/).*\$/s//) $DISTRIBUTION; urgency=low/" debian/changelog
-else
- # change version in changelog
- dch -i --no-auto-nmu "Generated by jenkins"
- git-dch -a --ignore-branch --no-full --no-meta --id-length=7
- # replace first occurance of a version (enclosed in brackets) with real version
- # (we cannot use (git-)dch as the version might be lower than the last),
- # and also set distribution here.
- # sed explained: look for the first occurance of (.*).*$ - so thats something
- # in brackets until the end of the line. = first line of a debian/changelog
- sed -i "0,/(.*).*\$/s//($VERSION) $DISTRIBUTION; urgency=low/" debian/changelog
-fi
-# check that we replaced things correctly...
-D=$(dpkg-parsechangelog 2>/dev/null|grep ^Distribution:|cut -d " " -f2)
-if [[ "$D" != "$DISTRIBUTION" ]]; then
- figlet "Wrong distribution!"
+if [[ doDebianPackaging ]]; then
+ # write correct debian/changelog
+ if [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]]; then
+ # generate debian/changelog entries since the last upload
+ git-dch -a --ignore-branch --no-full --no-meta --id-length=7 -N $VERSION
+ # make sure distribution in changelog is set correctly
+ # (read the comments for the sed command 5 lines below to understand this)
+ sed -i "0,/).*\$/s//) $DISTRIBUTION; urgency=low/" debian/changelog
+ else
+ # change version in changelog
+ dch -i --no-auto-nmu "Generated by jenkins"
+ git-dch -a --ignore-branch --no-full --no-meta --id-length=7
+ # replace first occurance of a version (enclosed in brackets) with real version
+ # (we cannot use (git-)dch as the version might be lower than the last),
+ # and also set distribution here.
+ # sed explained: look for the first occurance of (.*).*$ - so thats something
+ # in brackets until the end of the line. = first line of a debian/changelog
+ sed -i "0,/(.*).*\$/s//($VERSION) $DISTRIBUTION; urgency=low/" debian/changelog
+ fi
+ # check that we replaced things correctly...
+ D=$(dpkg-parsechangelog 2>/dev/null|grep ^Distribution:|cut -d " " -f2)
+ if [[ "$D" != "$DISTRIBUTION" ]]; then
+ figlet "Wrong distribution!"
+ dpkg-parsechangelog
+ exit 1
+ fi
+ figlet "$DISTRIBUTION"
+
+ # build debian package (just binary, no source package)
+ dpkg-buildpackage -us -uc -b
+
+ # upload to reprepro
+ CHANGES_FILE=${SOURCE}_${VERSION}_amd64.changes
+ cd $WORKSPACE/..
+ # upload
+ dcmd scp $CHANGES_FILE reprepro@alexandria.pb.local:/srv/$REPO/incoming/profitbricks/
+ ssh reprepro@alexandria.pb.local /srv/$REPO/bin/pb_processincoming
+ figlet "Uploaded."
+ # cleanup
+ dcmd rm $CHANGES_FILE
+ cd $WORKSPACE
+
+ # push back to git repo if build from master or hotfix/
+ if [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]]; then
+ git add debian/changelog
+ git commit -m "[no-jenkins] trigger - automatic commit by jenkins after build of $BUILD_NUMBER"
+ # ~ and : are not valid in git tags, replace them:
+ TAG=$(echo $VERSION | tr '~' '_' | tr ':' ',')
+ git tag $TAG
+ git push origin $GIT_BRANCH_NAME
+ git push origin $TAG
+ figlet "Tagged."
+ fi
+
+ # show the changelog
dpkg-parsechangelog
- exit 1
-fi
-figlet "$DISTRIBUTION"
-
-# build debian package (just binary, no source package)
-dpkg-buildpackage -us -uc -b
-
-# upload to reprepro
-CHANGES_FILE=${SOURCE}_${VERSION}_amd64.changes
-cd $WORKSPACE/..
-# upload
-dcmd scp $CHANGES_FILE reprepro@alexandria.pb.local:/srv/$REPO/incoming/profitbricks/
-ssh reprepro@alexandria.pb.local /srv/$REPO/bin/pb_processincoming
-figlet "Uploaded."
-# cleanup
-dcmd rm $CHANGES_FILE
-cd $WORKSPACE
-# push back to git repo if build from master or hotfix/
-if [[ "$GIT_BRANCH_NAME" = "master" ]] || [[ "${GIT_BRANCH_NAME:0:7}" = "hotfix/" ]]; then
- git add debian/changelog
- git commit -m "[no-jenkins] trigger - automatic commit by jenkins after build of $BUILD_NUMBER"
- # ~ and : are not valid in git tags, replace them:
- TAG=$(echo $VERSION | tr '~' '_' | tr ':' ',')
- git tag $TAG
- git push origin $GIT_BRANCH_NAME
- git push origin $TAG
- figlet "Tagged."
+ # call cleanup function
+ cleanup
fi
-# show the changelog
-dpkg-parsechangelog
-
-# call cleanup function
-cleanup
-
# push back integration branch if we merged a feature branch
if [[ ${GIT_BRANCH_NAME:0:8} = "feature/" ]] || [[ ${GIT_BRANCH_NAME:0:7} = "bugfix/" ]]; then
if [[ "$BUILD_TRIGGERS" = *"merge"* ]]; then