forked from reshufflehq/reshuffle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
42 lines (40 loc) · 1.38 KB
/
Jenkinsfile
File metadata and controls
42 lines (40 loc) · 1.38 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
node {
checkout scm;
properties([
parameters([
stringParam(
defaultValue: "false",
description: 'build docker without cache',
name: 'NO_CACHE'
),
booleanParam(
defaultValue: false,
description: 'whether to avoid triggering precious at the end',
name: 'NO_PRECIOUS'
),
]),
]);
if ("${BRANCH_NAME}" =~ "^publish-.*") {
return;
}
genericWrapper([slackChannel:'#jenkins', timeoutMinutes: 60]) {
withCredentials([
string(credentialsId: 'docker-account', variable: 'DOCKER_ACCOUNT')
]) {
def imageTag = "${DOCKER_ACCOUNT}/reshuffle:${BRANCH_NAME}";
stage('Build') {
echo 'Building docker image';
sh "sudo docker build -f testing.Dockerfile ${params.NO_CACHE ? '--no-cache' : ''} --tag ${imageTag} .";
}
stage('Push') {
echo 'Pushing docker image';
sh 'sudo $(aws ecr get-login --no-include-email --region us-east-1)';
sh "sudo docker push ${imageTag}";
sh "sudo docker tag ${imageTag} binaris/reshuffle:${BRANCH_NAME}";
}
if (!params.NO_PRECIOUS) {
trigger_precious(BRANCH_NAME, JOB_NAME);
}
}
}
}