-
Notifications
You must be signed in to change notification settings - Fork 27
/
Jenkinsfile
60 lines (55 loc) · 2.69 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
pipeline {
agent any
options {
timestamps()
ansiColor('xterm')
buildDiscarder logRotator(numToKeepStr: '100')
disableConcurrentBuilds()
timeout(activity: true, time: 1, unit: 'DAYS')
}
parameters {
string defaultValue: 'master', description: 'Git branch to build', name: 'GIT_BRANCH', trim: true
string defaultValue: '[email protected]:balena-io-library/resin-rpi-raspbian.git', description: 'Git repository', name: 'GIT_URL', trim: true
string defaultValue: 'resin-packages', description: 'AWS/S3 output bucket', name: 'BUCKET_NAME', trim: true
credentials credentialType: 'com.cloudbees.jenkins.plugins.awscredentials.AWSCredentialsImpl', defaultValue: '273bf5c6-1411-46c3-b0d5-6469e84d50ff', description: 'AWS/IAM credentials', name: 'AWS_CREDENTIALS', required: true
credentials credentialType: 'com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey', defaultValue: 'a2d8eaf4-a373-4efa-a9e3-c331a3687e72', description: 'GitHub credentials', name: 'GIT_CREDENTIALS', required: true
credentials credentialType: 'com.cloudbees.jenkins.plugins.credentialsbinding.MultiBinding', defaultValue: '3204255f-7677-4681-9f06-b4a2f804e2a2', description: 'DOCKERHUB CREDENTIALS', name: 'DOCKERHUB_CREDENTIALS', required: true
}
stages {
stage('scm') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: '*/${GIT_BRANCH}']],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[
credentialsId: GIT_CREDENTIALS,
url: GIT_URL
]
]])
}
}
stage('build') {
steps {
withCredentials([
[
$class: 'AmazonWebServicesCredentialsBinding',
accessKeyVariable: 'ACCESS_KEY',
credentialsId: AWS_CREDENTIALS,
secretKeyVariable: 'SECRET_KEY'
],
[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'DOCKERHUB_CREDENTIALS',
usernameVariable: 'DOCKERHUB_USERNAME',
passwordVariable: 'DOCKERHUB_PASSWORD']
]) {
sh 'docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD"'
sh returnStdout: true, script: 'bash -x automation/jenkins-build.sh'
}
}
}
}
}