Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

Jenkinsfile 4.1 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  1. /* groovylint-disable CompileStatic, DuplicateMapLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth */
  2. pipeline {
  3. agent any
  4. environment {
  5. GIT_COMMIT_REV = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
  6. // GIT_COMMIT_MASTER = sh(returnStdout: true, script: 'git rev-parse --short master').trim()
  7. }
  8. stages {
  9. stage('Run inside Docker Image') {
  10. agent {
  11. dockerfile {
  12. args "-v ${env.WORKSPACE}:/project -w /project -v /extras:/extras -e PYTHONPATH=/project"
  13. }
  14. }
  15. stages {
  16. stage('Run Unit Test') {
  17. steps {
  18. sh 'pytest -vvrxXs'
  19. }
  20. }
  21. stage('Run Linting') {
  22. steps {
  23. sh 'flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics'
  24. sh 'flake8 . --count --max-complexity=10 --max-line-length=127 --statistics'
  25. sh 'black . --check --diff'
  26. }
  27. }
  28. stage('Setup DVC Creds') {
  29. steps {
  30. withCredentials(
  31. [
  32. usernamePassword(
  33. credentialsId: 'PASSWORD',
  34. passwordVariable: 'PASSWORD',
  35. usernameVariable: 'PASSWORD_NAME'),
  36. ]
  37. ) {
  38. sh '''
  39. dvc remote modify origin --local auth basic
  40. dvc remote modify origin --local user puneethp
  41. dvc remote modify origin --local password $PASSWORD
  42. dvc pull -r origin
  43. '''
  44. // sh "echo ${env.PASSWORD}"
  45. // sh 'dvc remote modify origin --local auth basic'
  46. // sh 'dvc remote modify origin --local user puneethp'
  47. // sh "dvc remote modify origin --local password ${env.PASSWORD}"
  48. }
  49. }
  50. }
  51. stage('Sync DVC Remotes') {
  52. steps {
  53. sh 'dvc status'
  54. sh 'dvc status -r jenkins_local'
  55. sh 'dvc status -r origin'
  56. script {
  57. try {
  58. sh 'dvc pull -r jenkins_local'
  59. } catch (error) {
  60. echo error.message
  61. }
  62. }
  63. echo currentBuild.result
  64. sh 'dvc pull -r origin'
  65. sh 'dvc push -r jenkins_local'
  66. }
  67. }
  68. stage('Update DVC Pipeline') {
  69. when { changeRequest() }
  70. steps {
  71. sh 'dvc repro --dry -mP'
  72. sh 'dvc repro -mP'
  73. sh "dvc metrics diff --show-md --precision 2 ${env.CHANGE_BRANCH}"
  74. sh 'cat dvc.lock'
  75. sh 'dvc push -r jenkins_local'
  76. sh 'dvc push -r origin'
  77. sh "rm -r /extras/RPPP/repo/${env.CHANGE_BRANCH} || echo 'All clean'"
  78. sh "cp -Rf . /extras/RPPP/repo/${env.CHANGE_BRANCH}"
  79. }
  80. }
  81. }
  82. }
  83. stage('Commit back results') {
  84. when { changeRequest() }
  85. steps {
  86. dir("/extras/RPPP/repo/${env.CHANGE_BRANCH}") {
  87. sh 'git branch -a'
  88. sh 'git status'
  89. sh 'git add .'
  90. sh 'git status'
  91. sh "git commit -m '${env.GIT_COMMIT_REV}: Update dvc.lock and metrics' || echo 'Nothing to Commit'"
  92. sh "git push origin HEAD:${env.CHANGE_BRANCH}"
  93. }
  94. }
  95. }
  96. }
  97. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...