File tree Expand file tree Collapse file tree 2 files changed +52
-35
lines changed
Expand file tree Collapse file tree 2 files changed +52
-35
lines changed Original file line number Diff line number Diff line change @@ -28,41 +28,7 @@ node('docker') {
2828 }
2929 }
3030 dir(env. GIT_CHECKOUT_DIR ) {
31- stage(' Build, tagging and publishing from branch' ) {
32- if ( env. GIT_BRANCH_OR_TAG == ' branch' && jobCommon. launchedByUser() ) {
33- sshagent ([' jenkins-rsa' ]) {
34- sh ''' \
35- #!/bin/bash -ex
36- gbp dch --git-author -D stretch --ignore-branch --commit -N "${NEW_VERSION}" -a
37- git tag "${GIT_NEW_TAG}"
38- git tag "${NEW_VERSION}"
39-
40- debuild -b -us -uc
41- ''' . stripIndent()
42-
43- if ( ! sh(script : " git remote show ${ GIT_REMOTE} " , returnStdout : true ). contains(" HEAD branch: ${ env.GIT_LOCAL_BRANCH} " ) ) {
44- echo ' Pushing changes bask is disabled for non default branches'
45- return
46- }
47-
48- if (env. REPO_NAME ) {
49- withCredentials([string(credentialsId : ' DEB_DROP_TOKEN' , variable : ' DebDropToken' )]) {
50- jobCommon. uploadPackage file : " ${ env.WORKSPACE} /${ env.PACKAGE_NAME} _${ env.NEW_VERSION} _amd64.deb" , repo : env. REPO_NAME , token : DebDropToken
51- jobCommon. uploadPackage file : " ${ env.WORKSPACE} /${ env.PACKAGE_NAME} -dbgsym_${ env.NEW_VERSION} _amd64.deb" , repo : env. REPO_NAME , token : DebDropToken
52- }
53- }
54-
55- // We push changes back to git only after successful package uploading
56- sh ''' \
57- #!/bin/bash -ex
58-
59- git push ${GIT_REMOTE} HEAD:${GIT_LOCAL_BRANCH}
60- git push --tags ${GIT_REMOTE}
61- ''' . stripIndent()
62- }
63- }
64- }
65- stage(' Building from tag' ) {
31+ stage(' Building' ) {
6632 if ( env. GIT_BRANCH_OR_TAG == ' tag' && jobCommon. launchedByUser() ) {
6733 sshagent ([' jenkins-rsa' ]) {
6834 sh ''' \
Original file line number Diff line number Diff line change 1+ #! /bin/bash -e
2+
3+ MIN_GBP=' 0.9.12'
4+ GBP_VERSION=" $( gbp --version) "
5+ if ! (echo " gbp ${MIN_GBP} " ; echo " ${GBP_VERSION} " ) | sort -Vc 2> /dev/null ; then
6+ echo " Minimal version for git-buildpackage is ${MIN_GBP} . Provided is ${GBP_VERSION} "
7+ exit 1
8+ fi
9+
10+ # === FUNCTION ================================================================
11+ # NAME: usage
12+ # DESCRIPTION: Display usage information.
13+ # ===============================================================================
14+ function usage ()
15+ {
16+ echo " Usage : $0 [options] [--]
17+
18+ Options:
19+ -h|help Display this message
20+ -n|new-version New version for changelog"
21+
22+ } # ---------- end of function usage ----------
23+
24+ # -----------------------------------------------------------------------
25+ # Handle command line arguments
26+ # -----------------------------------------------------------------------
27+
28+ while getopts " :hn:" opt
29+ do
30+ case $opt in
31+
32+ h ) usage; exit 0 ;;
33+
34+ n ) NEW_VERSION=" ${OPTARG} " ;;
35+
36+ : ) echo " Invalid option: -$OPTARG requires an argument" 1>&2 ; exit 1 ;;
37+
38+ * ) echo -e " \n Option does not exist : $OPTARG \n"
39+ usage; exit 1 ;;
40+
41+ esac # --- end of case ---
42+ done
43+ shift $(( OPTIND - 1 ))
44+
45+ if [ -z " ${NEW_VERSION} " ]; then
46+ echo ' New debian version is not set' 1>&2
47+ exit 1
48+ fi
49+
50+ gbp dch --git-author --distribution=stretch --force-distribution --ignore-branch --commit -N " ${NEW_VERSION} " --auto
51+ git tag " v${NEW_VERSION} "
You can’t perform that action at this time.
0 commit comments