Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.59 KB | None | 0 0
  1. properties([[$class: 'jenkins.model.BuildDiscarderProperty',
  2. strategy: [$class: 'LogRotator', numToKeepStr: '30', artifactNumToKeepStr: '1']]])
  3.  
  4. node('web-app-build') {
  5. try {
  6.  
  7. stage('Clean workspace') {
  8. deleteDir()
  9. }
  10.  
  11. stage('Install NodeJS and NPM') {
  12. def nodeHome = tool name: 'NodeJS 7.2.0', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
  13. env.PATH = "${nodeHome}/bin:${env.PATH}"
  14. }
  15.  
  16. stage('Checkout') {
  17. checkout scm
  18. }
  19.  
  20. stage('Install Dependencies') {
  21. sh "npm install --silent"
  22. sh "npm install -g @angular/cli@latest"
  23. sh "ng set --global warnings.versionMismatch=false"
  24.  
  25. sh "npm install protractor -g"
  26.  
  27. }
  28.  
  29. stage('Run E2E tests') {
  30. sh "webdriver-manager update --versions.chrome=2.30 --gecko=false"
  31. sh "ng e2e"
  32. }
  33.  
  34. stage('Publish Reports') {
  35. publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'coverage', reportFiles: 'index.html', reportName: 'HTML Report'])
  36. step([$class: 'JUnitResultArchiver', testResults: '**/junit/junit.xml'])
  37. step([
  38. $class: 'CloverPublisher',
  39. cloverReportDir: 'coverage',
  40. cloverReportFileName: 'clover.xml',
  41. healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80],
  42. unhealthyTarget: [methodCoverage: 50, conditionalCoverage: 50, statementCoverage: 50],
  43. failingTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0]
  44. ])
  45. }
  46.  
  47. if (env.BRANCH_NAME == 'develop') {
  48.  
  49. stage('Create env=staging build ready for S3') {
  50. sh "ng build --env=staging --output-hashing=all"
  51. }
  52.  
  53. stage('Deploy Build to S3 development.faberodt.com') {
  54. env.AWS_ACCESS_KEY_ID = 'AKIAILXMLIURVMYSBANQ'
  55. env.AWS_SECRET_ACCESS_KEY = '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'
  56.  
  57. sh "npm install s3-deploy -g"
  58. sh "s3-deploy 'dist/**' --cwd './dist' --region 'us-west-2' --bucket 'development.faberodt.com' --cache 60 --etag"
  59. }
  60.  
  61. stage('Create env=ci build ready for S3') {
  62. sh "ng build --env=ci --output-hashing=all"
  63. }
  64.  
  65. stage('Deploy Build to S3 ci.faberodt.com') {
  66. env.AWS_ACCESS_KEY_ID = 'AKIAILXMLIURVMYSBANQ'
  67. env.AWS_SECRET_ACCESS_KEY = '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'
  68.  
  69. sh "npm install s3-deploy -g"
  70. sh "s3-deploy 'dist/**' --cwd './dist' --region 'us-west-2' --bucket 'ci.faberodt.com' --cache 60 --etag"
  71. }
  72.  
  73. stage('Create env=e2e build ready for S3 e2e.faber.work') {
  74. sh "ng build --env=e2e --output-hashing=all"
  75. }
  76.  
  77. stage('Deploy Build to S3 e2e.faberodt.com') {
  78. env.AWS_ACCESS_KEY_ID = 'AKIAILXMLIURVMYSBANQ'
  79. env.AWS_SECRET_ACCESS_KEY = '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'
  80.  
  81. sh "npm install s3-deploy -g"
  82. sh "s3-deploy 'dist/**' --cwd './dist' --region 'us-west-2' --bucket 'e2e.faberodt.com' --cache 60 --etag"
  83. }
  84.  
  85. stage('Run "Web App e2e" Tests') {
  86. build job: '../Web App e2e', wait: false
  87. }
  88. }
  89.  
  90. } catch (e) {
  91. throw e
  92. }
  93.  
  94. }
  95.  
  96. properties([[$class: 'jenkins.model.BuildDiscarderProperty',
  97. strategy: [$class: 'LogRotator', numToKeepStr: '30', artifactNumToKeepStr: '1']]])
  98.  
  99. node('web-app-build') {
  100. try {
  101.  
  102. stage('Clean workspace') {
  103. deleteDir()
  104. }
  105.  
  106. stage('Install NodeJS and NPM') {
  107. def nodeHome = tool name: 'NodeJS 7.2.0', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
  108. env.PATH = "${nodeHome}/bin:${env.PATH}"
  109. }
  110.  
  111. stage('Checkout') {
  112. checkout scm
  113. }
  114.  
  115. stage('Install Dependencies') {
  116. sh "npm install --silent"
  117. sh "npm install -g @angular/cli@latest"
  118. sh "ng set --global warnings.versionMismatch=false"
  119.  
  120. sh "npm install protractor -g"
  121.  
  122. }
  123.  
  124. stage('Run E2E tests') {
  125. sh "webdriver-manager update --versions.chrome=2.30 --gecko=false"
  126. sh "ng e2e"
  127. }
  128.  
  129. stage('Publish Reports') {
  130. publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'coverage', reportFiles: 'index.html', reportName: 'HTML Report'])
  131. step([$class: 'JUnitResultArchiver', testResults: '**/junit/junit.xml'])
  132. step([
  133. $class: 'CloverPublisher',
  134. cloverReportDir: 'coverage',
  135. cloverReportFileName: 'clover.xml',
  136. healthyTarget: [methodCoverage: 70, conditionalCoverage: 80, statementCoverage: 80],
  137. unhealthyTarget: [methodCoverage: 50, conditionalCoverage: 50, statementCoverage: 50],
  138. failingTarget: [methodCoverage: 0, conditionalCoverage: 0, statementCoverage: 0]
  139. ])
  140. }
  141.  
  142. if (env.BRANCH_NAME == 'develop') {
  143.  
  144. stage('Create env=staging build ready for S3') {
  145. sh "ng build --env=staging --output-hashing=all"
  146. }
  147.  
  148. stage('Deploy Build to S3 development.faberodt.com') {
  149. env.AWS_ACCESS_KEY_ID = 'AKIAILXMLIURVMYSBANQ'
  150. env.AWS_SECRET_ACCESS_KEY = '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'
  151.  
  152. sh "npm install s3-deploy -g"
  153. sh "s3-deploy 'dist/**' --cwd './dist' --region 'us-west-2' --bucket 'development.faberodt.com' --cache 60 --etag"
  154. }
  155.  
  156. stage('Create env=ci build ready for S3') {
  157. sh "ng build --env=ci --output-hashing=all"
  158. }
  159.  
  160. stage('Deploy Build to S3 ci.faberodt.com') {
  161. env.AWS_ACCESS_KEY_ID = 'AKIAILXMLIURVMYSBANQ'
  162. env.AWS_SECRET_ACCESS_KEY = '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'
  163.  
  164. sh "npm install s3-deploy -g"
  165. sh "s3-deploy 'dist/**' --cwd './dist' --region 'us-west-2' --bucket 'ci.faberodt.com' --cache 60 --etag"
  166. }
  167.  
  168. stage('Create env=e2e build ready for S3 e2e.faber.work') {
  169. sh "ng build --env=e2e --output-hashing=all"
  170. }
  171.  
  172. stage('Deploy Build to S3 e2e.faberodt.com') {
  173. env.AWS_ACCESS_KEY_ID = 'AKIAILXMLIURVMYSBANQ'
  174. env.AWS_SECRET_ACCESS_KEY = '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'
  175.  
  176. sh "npm install s3-deploy -g"
  177. sh "s3-deploy 'dist/**' --cwd './dist' --region 'us-west-2' --bucket 'e2e.faberodt.com' --cache 60 --etag"
  178. }
  179.  
  180. stage('Run "Web App e2e" Tests') {
  181. build job: '../Web App e2e', wait: false
  182. }
  183. }
  184.  
  185. } catch (e) {
  186. throw e
  187. }
  188.  
  189. }
  190.  
  191. /*global jasmine */
  192. var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
  193.  
  194. exports.config = {
  195. allScriptsTimeout: 11000,
  196. specs: [
  197. './e2e/**/*.e2e-spec.ts'
  198. ],
  199.  
  200. capabilities: {
  201. 'browserName': 'chrome',
  202. 'chromeOptions': {
  203. args: ['--headless', 'no-sandbox', '--disable-gpu', '--window-size=800x600']
  204. }
  205. },
  206. directConnect: true,
  207. framework: 'jasmine',
  208. jasmineNodeOpts: {
  209. showColors: true,
  210. defaultTimeoutInterval: 30000,
  211. print: function () {
  212. }
  213. },
  214. useAllAngular2AppRoots: true,
  215. beforeLaunch: function () {
  216. require('ts-node').register({
  217. project: 'e2e'
  218. });
  219. },
  220. onPrepare: function () {
  221. jasmine.getEnv().addReporter(new SpecReporter());
  222. }
  223. };
  224.  
  225. [15:03:50] I/file_manager - creating folder /var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/webdriver-manager/selenium
  226. [15:03:51] I/update - chromedriver: unzipping chromedriver_2.30.zip
  227. [15:03:51] I/update - chromedriver: setting permissions to 0755 for /var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.30
  228. [15:03:51] I/launcher - Running 1 instances of WebDriver
  229. [15:03:51] E/local - Error code: 135
  230. [15:03:51] E/local - Error message: No update-config.json found. Run 'webdriver-manager update' to download binaries.
  231. [15:03:51] E/local - Error: No update-config.json found. Run 'webdriver-manager update' to download binaries.
  232. at Local.addDefaultBinaryLocs_ (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/driverProviders/local.ts:47:15)
  233. at Local.setupDriverEnv (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/driverProviders/local.ts:98:10)
  234. at Local.setupEnv (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/driverProviders/driverProvider.ts:124:30)
  235. at q.then (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/lib/runner.ts:387:39)
  236. at _fulfilled (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:834:54)
  237. at self.promiseDispatch.done (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:863:30)
  238. at Promise.promise.promiseDispatch (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:796:13)
  239. at /var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:857:14
  240. at runSingle (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:137:13)
  241. at flush (/var/jenkins/workspace/Web_App_feature_e2e-chrome-YUH5PYKKXHHXSQT3HLIZ74DQIBAH3D5D6WZCOLDVI2LYG4RGOVBQ/node_modules/protractor/node_modules/q/q.js:125:13)
  242. at _combinedTickCallback (internal/process/next_tick.js:67:7)
  243. at process._tickCallback (internal/process/next_tick.js:98:9)
  244. [15:03:51] E/launcher - Process exited with error code 135
  245. [Pipeline] }
  246. [Pipeline] // stage
  247. [Pipeline] }
  248. [Pipeline] // node
  249. [Pipeline] End of Pipeline
  250. [Bitbucket] Notifying commit build result
  251. [Bitbucket] Build result notified
  252. ERROR: script returned exit code 135
  253. Finished: FAILURE
  254.  
  255. stage('Install NodeJS and NPM') {
  256. def nodeHome = tool name: 'NodeJS 7.2.0', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
  257. env.PATH = "${nodeHome}/bin:${env.PATH}"
  258. }
  259.  
  260. stage('Install NodeJS and NPM') {
  261. def nodeHome = tool name: 'NodeJS 7.2.0', type: 'jenkins.plugins.nodejs.tools.NodeJSInstallation'
  262. env.PATH = "${nodeHome}/bin;${env.PATH}"
  263. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement