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.9 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  1. pipeline {
  2. options {
  3. timestamps()
  4. skipDefaultCheckout()
  5. disableConcurrentBuilds()
  6. }
  7. agent {
  8. node { label 'translator && aws && build' }
  9. }
  10. parameters {
  11. string(name: 'BUILD_VERSION', defaultValue: '', description: 'The build version to deploy (optional)')
  12. string(name: 'AWS_REGION', defaultValue: 'us-east-1', description: 'AWS Region to deploy')
  13. string(name: 'KUBERNETES_CLUSTER_NAME', defaultValue: 'translator-eks-ci-blue-cluster', description: 'AWS EKS that will host this application')
  14. }
  15. environment {
  16. DOCKER_REPO_NAME = "translator-cdskp-openpredict"
  17. KUBERNETES_BLUE_CLUSTER_NAME = "translator-eks-ci-blue-cluster"
  18. NAMESPACE = "cdskp"
  19. }
  20. triggers {
  21. pollSCM('H/2 * * * *')
  22. }
  23. stages {
  24. stage('Clean') {
  25. steps {
  26. cleanWs()
  27. checkout scm
  28. }
  29. }
  30. stage('Build Version') {
  31. when {
  32. allOf {
  33. expression {
  34. return !params.BUILD_VERSION
  35. }
  36. anyOf {
  37. changeset "**"
  38. triggeredBy 'UserIdCause'
  39. }
  40. }
  41. }
  42. steps{
  43. script {
  44. BUILD_VERSION_GENERATED = VersionNumber(
  45. versionNumberString: 'v${BUILD_YEAR, XX}.${BUILD_MONTH, XX}${BUILD_DAY, XX}.${BUILDS_TODAY}',
  46. skipFailedBuilds: true)
  47. currentBuild.displayName = BUILD_VERSION_GENERATED
  48. env.BUILD_VERSION = BUILD_VERSION_GENERATED
  49. }
  50. }
  51. }
  52. stage('build') {
  53. when {
  54. allOf {
  55. expression {
  56. return !params.BUILD_VERSION
  57. }
  58. anyOf {
  59. changeset "**"
  60. triggeredBy 'UserIdCause'
  61. }
  62. }
  63. }
  64. steps {
  65. withEnv([
  66. "IMAGE_NAME=853771734544.dkr.ecr.us-east-1.amazonaws.com/translator-cdskp-openpredict",
  67. "BUILD_VERSION=" + (params.BUILD_VERSION ?: env.BUILD_VERSION)
  68. ]) {
  69. script {
  70. docker.build("${env.IMAGE_NAME}", "--build-arg SOURCE_FOLDER=./${BUILD_VERSION} --no-cache .")
  71. sh '''
  72. docker login -u AWS -p $(aws ecr get-login-password --region us-east-1) 853771734544.dkr.ecr.us-east-1.amazonaws.com
  73. '''
  74. docker.image("${env.IMAGE_NAME}").push("${BUILD_VERSION}")
  75. }
  76. }
  77. }
  78. }
  79. stage('Deploy') {
  80. when {
  81. anyOf {
  82. changeset "**"
  83. triggeredBy 'UserIdCause'
  84. }
  85. }
  86. agent {
  87. label 'translator && ci && deploy'
  88. }
  89. steps {
  90. configFileProvider([
  91. configFile(fileId: 'values-ncats.yaml', targetLocation: 'values-ncats.yaml'),
  92. configFile(fileId: 'prepare.sh', targetLocation: 'prepare.sh')
  93. ]){
  94. script {
  95. sh '''
  96. aws --region ${AWS_REGION} eks update-kubeconfig --name ${KUBERNETES_CLUSTER_NAME}
  97. /bin/bash prepare.sh
  98. cd translator-ops/ops/cdskp/openpredict/
  99. /bin/bash deploy.sh
  100. '''
  101. }
  102. }
  103. }
  104. post {
  105. always {
  106. echo " Clean up the workspace in deploy node!"
  107. cleanWs()
  108. }
  109. }
  110. }
  111. }
  112. }
Tip!

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

Comments

Loading...