Jenkinsfile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. pipeline {
  2. agent {
  3. node {
  4. label 'jenkins-agent-web'
  5. customWorkspace '/workspace'
  6. }
  7. }
  8. options {
  9. timestamps()
  10. parallelsAlwaysFailFast()
  11. timeout(time: 15, unit: 'MINUTES')
  12. }
  13. environment {
  14. BRANCH_NAME = "${env.CHANGE_BRANCH ? env.CHANGE_BRANCH : env.BRANCH_NAME}"
  15. JENKINS_BUILD_NUMBER = "${BUILD_NUMBER}"
  16. BUILD_NUMBER = "${SHORT_SHA}_${BUILD_NUMBER}"
  17. COMMIT_SHA = "${GIT_COMMIT}"
  18. SHORT_SHA = "${GIT_COMMIT.take(7)}"
  19. }
  20. stages {
  21. stage('Stage 1') {
  22. parallel {
  23. stage('Install monorepo') {
  24. steps {
  25. sh 'make monorepo_setup'
  26. }
  27. }
  28. stage('Create reports folder') {
  29. steps {
  30. sh 'mkdir tools/migrations/reports'
  31. }
  32. }
  33. }
  34. }
  35. stage('Stage 2') {
  36. parallel {
  37. stage('Lint') {
  38. steps {
  39. sh 'bin/run -w /overleaf/tools/migrations monorepo npm run lint -- --format json --output-file reports/eslint.json'
  40. }
  41. post {
  42. always {
  43. sh """
  44. sed -i 's_"filePath":"/overleaf_"filePath":"/workspace_g' tools/migrations/reports/eslint.json
  45. """
  46. recordIssues checksAnnotationScope: 'ALL', enabledForFailure: true, failOnError: true, id: 'migrations-eslint', name: 'migrations eslint', qualityGates: [[integerThreshold: 1, threshold: 1.0, type: 'TOTAL']], sourceCodeRetention: 'LAST_BUILD', tools: [esLint(pattern: 'tools/migrations/reports/eslint.json')]
  47. }
  48. }
  49. }
  50. stage('Format') {
  51. steps {
  52. sh 'bin/run -w /overleaf/tools/migrations monorepo npm run format'
  53. }
  54. }
  55. }
  56. }
  57. }
  58. post {
  59. cleanup {
  60. sh 'rm -rf tools/migrations/reports'
  61. sh 'make clean_jenkins'
  62. }
  63. }
  64. }