@@ -4,21 +4,21 @@ parameters {
44 string(name: 'testServerUrl', defaultValue: 'https://api-qa.aspose.cloud', description: 'server url')
55 string(name: 'StartFromStage', defaultValue: '0', description: '0 based index of stage which will be started')
66}
7- node('billing-qa-ubuntu-16.04.4 ') {
7+ node('words-linux ') {
88 try {
9- stage('0:Merge master to testPackage'){
10- if (params.StartFromStage.toInteger() < 1) {
11- checkout([$class: 'GitSCM', branches: [[name: '*/release']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic. com/words-cloud/words-cloud-ruby.git']]])
12-
13- sh "git checkout --merge testPackage"
14- sh "git reset --hard origin/ testPackage"
15- sh "git merge --no-ff --allow-unrelated-histories origin/release "
16- sh "git diff --name-status"
17- sh ' git commit -am "Merged release branch to testPackage" || exit 0'
18-
19- withCredentials([usernamePassword(credentialsId: '361885ba-9425-4230-950e-0af201d90547', passwordVariable: 'gitPass', usernameVariable: 'gitUsername')]) {
20- sh "git push https://% gitUsername%:%gitPass%@git.auckland.dynabic.com/words-cloud/words-cloud-ruby.git testPackage"
21- }
9+ stage('0:Merge master to testPackage'){
10+ checkout([$class: 'GitSCM', branches: [[name: '*/release']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-ruby.git']]])
11+ sh "git config user.email 'jenkins.aspose@gmail. com'"
12+ sh "git config user.name 'jenkins'"
13+
14+ sh "git checkout --merge testPackage"
15+ sh "git reset --hard origin/testPackage "
16+ sh "git merge --no-ff --allow-unrelated-histories origin/release"
17+ sh " git diff --name-status"
18+ sh 'git commit -am "Merged release branch to testPackage" || exit 0'
19+
20+ withCredentials([usernamePassword(credentialsId: '361885ba-9425-4230-950e-0af201d90547', passwordVariable: 'gitPass', usernameVariable: ' gitUsername')]) {
21+ sh "git push https://$gitUsername:[email protected] /words-cloud/words-cloud-ruby.git testPackage" 2222 }
2323 }
2424 } finally {
@@ -27,10 +27,8 @@ node('billing-qa-ubuntu-16.04.4') {
2727}
2828
2929stage('1:wait for publishing'){
30- if (params.StartFromStage.toInteger() < 2) {
31- timeout(time:1, unit:'DAYS') {
32- input message:'Ready for publishing to rubygems?'
33- }
30+ timeout(time:1, unit:'DAYS') {
31+ input message:'Ready for publishing to rubygems?'
3432 }
3533}
3634
@@ -39,38 +37,34 @@ def testGemLocally()
3937{
4038 try {
4139 stage('2:checkout again'){
42- if (params.StartFromStage.toInteger() < 3) {
43- checkout([$class: 'GitSCM', branches: [[name: '*/testPackage']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-ruby.git']]])
44- withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'AppKey', usernameVariable: 'AppSid')]) {
45- sh 'mkdir -p Settings'
46- sh 'echo "{\\"AppSid\\": \\"$AppSid\\",\\"AppKey\\": \\"$AppKey\\", \\"BaseUrl\\": \\"${testServerUrl}\\"}" > Settings/servercreds.json'
47- }
48- }
40+ checkout([$class: 'GitSCM', branches: [[name: '*/testPackage']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-ruby.git']]])
41+ withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'AppKey', usernameVariable: 'AppSid')]) {
42+ sh 'mkdir -p Settings'
43+ sh 'echo "{\\"AppSid\\": \\"$AppSid\\",\\"AppKey\\": \\"$AppKey\\", \\"BaseUrl\\": \\"${testServerUrl}\\"}" > Settings/servercreds.json'
44+ }
4945 }
5046
5147 stage('3:build gem and test'){
52- if (params.StartFromStage.toInteger() < 4) {
53- docker.image('ruby:2.4').inside('-u root'){
54- stage('upload to rubygems'){
55- sh "gem build aspose_words_cloud.gemspec"
56- sh "gem install ./aspose_words_cloud-${version}.gem"
57- }
58-
59- stage('test gem locally'){
60- sh "mkdir testReports"
61- sh "gem install bundler && bundle install"
62- try{
63- sh 'rake test'
64- } finally{
65- junit 'testReports/report/*.xml'
66- }
67- }
68-
69- stage('clean-compiled'){
70- sh "rm -rf %s"
48+ docker.image('ruby:2.4').inside('-u root'){
49+ stage('upload to rubygems'){
50+ sh "gem build aspose_words_cloud.gemspec"
51+ sh "gem install ./aspose_words_cloud-${version}.gem"
52+ }
53+
54+ stage('test gem locally'){
55+ sh "mkdir testReports"
56+ sh "gem install bundler && bundle install"
57+ try{
58+ sh 'rake test'
59+ } finally{
60+ junit 'testReports/report/*.xml'
7161 }
72- }
73- }
62+ }
63+
64+ stage('clean-compiled'){
65+ sh "rm -rf %s"
66+ }
67+ }
7468 }
7569 } finally {
7670 cleanWs()
@@ -81,41 +75,37 @@ def publishGem()
8175{
8276 try {
8377 stage('4:checkout again'){
84- if (params.StartFromStage.toInteger() < 5) {
85- checkout([$class: 'GitSCM', branches: [[name: '*/release']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-ruby.git']]])
86- }
78+ checkout([$class: 'GitSCM', branches: [[name: '*/release']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-ruby.git']]])
8779 }
8880
8981 stage('5:build gem publish'){
90- if (params.StartFromStage.toInteger() < 6) {
91- docker.image('ruby:2.4').inside('-u root'){
92- stage('upload to rubygems'){
93- sh "gem build aspose_words_cloud.gemspec"
94- sh "mkdir ~/.gem"
95- sh "touch ~/.gem/credentials"
96- sh "echo ':rubygems_api_key: ${deployKey}' > ~/.gem/credentials"
97- sh "chmod 0600 ~/.gem/credentials"
98- sh "gem push aspose_words_cloud-${version}.gem"
99- }
100-
101- stage('clean-compiled'){
102- sh "rm -rf %s"
82+ docker.image('ruby:2.4').inside('-u root'){
83+ stage('upload to rubygems'){
84+ sh "gem build aspose_words_cloud.gemspec"
85+ sh "mkdir ~/.gem"
86+ sh "touch ~/.gem/credentials"
87+ withCredentials([string(credentialsId: 'bb609755-8dfb-4f45-819a-3dbfc85fc9fd', variable: 'deployKey')]) {
88+ sh "echo ':rubygems_api_key: $deployKey' > ~/.gem/credentials"
10389 }
90+ sh "chmod 0600 ~/.gem/credentials"
91+ sh "gem push aspose_words_cloud-${version}.gem"
92+ }
93+
94+ stage('clean-compiled'){
95+ sh "rm -rf %s"
10496 }
10597 }
10698 }
10799 stage('6:add version tag'){
108- if (params.StartFromStage.toInteger() < 6) {
109- checkout([$class: 'GitSCM', branches: [[name: '*/release']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-ruby.git']]])
100+ checkout([$class: 'GitSCM', branches: [[name: '*/release']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-ruby.git']]])
110101
111102 sh "git config user.email \"
[email protected] \""
112103 sh "git config user.name \"jenkins\""
113104 sh "git tag -a ${version} -m 'version ${version}' | exit 0"
114105
115106 withCredentials([usernamePassword(credentialsId: '361885ba-9425-4230-950e-0af201d90547', passwordVariable: 'gitPass', usernameVariable: 'gitUsername')]) {
116- sh "git push https://% gitUsername%:% gitPass% @git.auckland.dynabic.com/words-cloud/words-cloud-ruby.git ${version}"
107+ sh "git push https://
$ gitUsername
:$ [email protected] /words-cloud/words-cloud-ruby.git ${version}"
117108 }
118- }
119109 }
120110 } finally {
121111 cleanWs()
0 commit comments