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 3.0 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
  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('Sync DVC Remotes') {
  29. steps {
  30. sh 'dvc status'
  31. sh 'dvc status -r jenkins_local'
  32. sh 'dvc status -r origin'
  33. script {
  34. try {
  35. sh 'dvc pull -r jenkins_local'
  36. } catch (error) {
  37. echo error.message
  38. }
  39. }
  40. echo currentBuild.result
  41. sh 'dvc pull -r origin'
  42. sh 'dvc push -r jenkins_local'
  43. }
  44. }
  45. stage('Update DVC Pipeline') {
  46. when { changeRequest() }
  47. steps {
  48. sh 'dvc repro --dry -mP'
  49. sh 'dvc repro -mP'
  50. sh "dvc metrics diff --show-md --precision 2 ${env.CHANGE_BRANCH}"
  51. sh 'cat dvc.lock'
  52. sh 'dvc push -r jenkins_local'
  53. sh 'dvc push -r origin'
  54. sh "rm -r /extras/RPPP/repo/${env.CHANGE_BRANCH} || echo 'All clean'"
  55. sh "cp -Rf . /extras/RPPP/repo/${env.CHANGE_BRANCH}"
  56. }
  57. }
  58. }
  59. }
  60. stage('Commit back results') {
  61. when { changeRequest() }
  62. steps {
  63. dir("/extras/RPPP/repo/${env.CHANGE_BRANCH}") {
  64. sh 'git branch -a'
  65. sh 'git status'
  66. sh 'git add .'
  67. sh 'git status'
  68. sh "git commit -m '${env.GIT_COMMIT_REV}: Update dvc.lock and metrics' || echo 'Nothing to Commit'"
  69. sh "git push origin HEAD:${env.CHANGE_BRANCH}"
  70. }
  71. }
  72. }
  73. }
  74. }
Tip!

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

Comments

Loading...