-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
61 lines (47 loc) · 1.67 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
pipeline {
// run the pipeline on any available agent/slave
agent any
options {
// timeout the job after 1 hour
timeout(time: 1, unit: 'HOURS')
// keep logs from last 10 jobs (default: no limit)
buildDiscarder(logRotator(numToKeepStr: '10'))
}
environment {
PROJECT_NAME = "kubeflow-120"
APP = "learn-kubeflow-modeling"
ENV="dev"
AWS_ACCOUNT = "863518836478"
AWS_CREDENTIALS = "jenkins-aws-credentials"
AWS_DEFAULT_REGION = "eu-central-1"
DOCKER_REG_URL = "${env.AWS_ACCOUNT}.dkr.ecr.${env.AWS_DEFAULT_REGION}.amazonaws.com"
DOCKER_REG_URL_HTTPS = "https://${DOCKER_REG_URL}"
DOCKER_REGISTRY_CREDENTIALS = "ecr:${env.AWS_DEFAULT_REGION}:${AWS_CREDENTIALS}"
DOCKER_REPO = "${env.ENV}/${env.PROJECT_NAME}/${env.APP}"
}
stages {
stage("init") {
steps {
sh('''
echo "BUILD_NUMBER: ${BUILD_NUMBER}"
echo "APP_NAME: ${APP_NAME}"
''')
sh('echo "Loading groovy scripts"')
script {
utils = load "utils.groovy"
}
}
}
stage("build and push image") {
//when { changeset "dockerfiles/rstudio/**"}
steps {
script {
utils.build("${env.DOCKER_REPO}:latest", ".")
}
script {
utils.deployImage("${env.DOCKER_REPO}:latest", "latest", "https://${env.DOCKER_REG_URL}/${env.DOCKER_REPO}", env.DOCKER_REGISTRY_CREDENTIALS)
}
}
}
}
}