forked from dorondollev/PolyBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
46 lines (45 loc) · 1.46 KB
/
Jenkinsfile
File metadata and controls
46 lines (45 loc) · 1.46 KB
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
pipeline {
agent {
docker {
label 'danishain'
image '352708296901.dkr.ecr.eu-north-1.amazonaws.com/danishain-jenkins-agent:1'
args '--user root -v /var/run/docker.sock:/var/run/docker.sock'
}
}
options {
buildDiscarder(logRotator(daysToKeepStr: '30'))
disableConcurrentBuilds()
timestamps()
}
environment {
REGISTRY_URL = "352708296901.dkr.ecr.eu-north-1.amazonaws.com"
IMAGE_TAG = "0.0.$BUILD_NUMBER"
IMAGE_NAME = "danishain-bot"
}
stages {
stage('Build') {
steps {
sh '''
aws ecr get-login-password --region eu-north-1 | docker login --username AWS --password-stdin $REGISTRY_URL
docker build -t $IMAGE_NAME:$IMAGE_TAG .
docker tag $IMAGE_NAME:$IMAGE_TAG $REGISTRY_URL/$IMAGE_NAME:$IMAGE_TAG
docker push $REGISTRY_URL/$IMAGE_NAME:$IMAGE_TAG
'''
}
post {
always {
sh '''
docker image prune -f --filter "label=app=bot"
'''
}
}
}
stage('Trigger Deploy') {
steps {
build job: 'BotDeploy', wait: false, parameters: [
string(name: 'BOT_IMAGE_NAME', value: "${REGISTRY_URL}/${IMAGE_NAME}:${IMAGE_TAG}")
]
}
}
}
}