-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathJenkinsfile
130 lines (126 loc) · 5.01 KB
/
Jenkinsfile
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
pipeline {
agent any
environment{
registry = "792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform"
}
stages {
stage('prepare workspace') {
steps {
// checkout git
checkout scmGit(
userRemoteConfigs: [
[ credentialsId: 'jenkins-specular', url: 'github.com:SpecularL2/specular.git']
],
branches: [[name: '*/PR-*'], [name: '*/develop']],
)
// submodules
sh "git submodule update --init --recursive"
// make our workspace dir
sh "rm -rf workspace && mkdir workspace"
// env files
sh 'cp -a config/local_docker/. workspace/'
sh 'chmod -R 777 workspace'
}
}
stage('create build image for pr') {
when {
not {
branch 'develop'
}
}
steps{
script {
docker.withRegistry('https://792926601177.dkr.ecr.us-east-2.amazonaws.com', 'ecr:us-east-2:builder') {
docker.build(
registry + ":e2e-pr-$GIT_COMMIT",
"-f docker/e2e.Dockerfile ."
)
}
}
}
}
stage('create build image for devnet') {
when {
branch 'develop'
}
steps{
script {
docker.withRegistry('https://792926601177.dkr.ecr.us-east-2.amazonaws.com', 'ecr:us-east-2:builder') {
def e2eContainer = docker.build(
registry + ":e2e-$GIT_COMMIT",
"-f docker/e2e.Dockerfile ."
)
e2eContainer.push()
e2eContainer.push("e2e-latest")
}
}
}
}
stage('e2e-test') {
when {
not {
branch 'develop'
}
}
parallel {
stage('transactions') {
steps {
sh "docker run -w /specular/workspace 792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform:e2e-pr-$GIT_COMMIT ../sbin/run_e2e_tests.sh transactions"
}
}
stage('deposit') {
steps {
sh "docker run -w /specular/workspace 792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform:e2e-pr-$GIT_COMMIT ../sbin/run_e2e_tests.sh deposit"
}
}
stage('erc20') {
steps {
sh "docker run -w /specular/workspace 792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform:e2e-pr-$GIT_COMMIT ../sbin/run_e2e_tests.sh erc20"
}
}
stage('withdraw') {
steps {
sh "docker run -w /specular/workspace 792926601177.dkr.ecr.us-east-2.amazonaws.com/specular-platform:e2e-pr-$GIT_COMMIT ../sbin/run_e2e_tests.sh withdraw"
}
}
}
}
stage('publish images') {
when {
branch "develop"
}
steps {
script {
docker.withRegistry('https://792926601177.dkr.ecr.us-east-2.amazonaws.com', 'ecr:us-east-2:builder') {
def spcContainer = docker.build(registry + ":$GIT_COMMIT", "-f docker/specular.Dockerfile .")
spcContainer.push()
spcContainer.push("specular-latest")
}
}
}
}
stage('upgrade helm') {
when {
branch "develop"
}
steps {
dir('charts/specular') {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "builder",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
script {
sh '''
aws eks update-kubeconfig --region us-east-2 --name specular-staging-eks
kubectl config use-context arn:aws:eks:us-east-2:792926601177:cluster/specular-staging-eks
helm upgrade specular . -n specular --set image.tag=$GIT_COMMIT'''
}
discordSend description: "Jenkins Pipeline Build", footer: "Current release is $GIT_COMMIT", link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: "https://discord.com/api/webhooks/1219404082184196147/C70F8jtuyODjExk-Xk7hWOaxY-IBQefDumqbTJYlKdOMt2uzmA4ehS3uaO28SwuGgzwi"
}
}
}
}
}
}