-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
56 lines (51 loc) · 1.96 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
pipeline {
agent any
stages {
stage('Checkout Deployment') {
steps {
dir("$WORKSPACE/satyrn-deployment") {
git(
branch: 'main',
credentialsId: 'dockerised',
url: 'git@github.com:nu-c3lab/satyrn-deployment.git'
)
}
}
}
stage('Checkout Templates') {
steps {
dir("$WORKSPACE/satyrn-templates") {
git(
branch: 'main',
credentialsId: 'git-cred-c3',
url: 'git@github.com:nu-c3lab/c3-satyrn-templates.git'
)
}
}
}
stage('Build') {
steps {
echo 'Starting docker build!'
sh 'ls'
sh 'docker build -t satyrn-api . --network=host'
}
}
stage('Push') {
steps{
echo 'Logging in!'
sh 'aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 304793330600.dkr.ecr.us-east-1.amazonaws.com'
sh 'docker tag satyrn-api:latest 304793330600.dkr.ecr.us-east-1.amazonaws.com/satyrn-api:latest'
sh 'docker push 304793330600.dkr.ecr.us-east-1.amazonaws.com/satyrn-api:latest'
sh 'docker tag satyrn-api:latest 304793330600.dkr.ecr.us-east-1.amazonaws.com/satyrn-api:$BUILD_NUMBER'
sh 'docker push 304793330600.dkr.ecr.us-east-1.amazonaws.com/satyrn-api:$BUILD_NUMBER'
}
}
stage('Deploy') {
dir("$WORKSPACE/satyrn-deployment")
steps {
sh 'helm upgrade --install satyrn-api charts/generic --values charts/satyrn-api/values-override.yaml --create-namespace --namespace dev-satyrn-api --set image.tag=$BUILD_NUMBER'
}
}
}
}
}