This repository was archived by the owner on Mar 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathJenkinsfile
56 lines (44 loc) · 1.63 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
#!/usr/bin/groovy
node{
checkout scm
kubernetes.pod('buildpod').withImage('fabric8/go-builder')
.withEnvVar('GOPATH','/home/jenkins/workspace/workspace/go')
.withPrivileged(true).inside {
stage 'Build binary'
sh "mkdir -p ../go/src/github.com/fabric8io/gitcontroller; cp -R ../${env.JOB_NAME}/. ../go/src/github.com/fabric8io/gitcontroller/; cd ../go/src/github.com/fabric8io/gitcontroller; make"
sh "cp -R ../go/src/github.com/fabric8io/gitcontroller/build ."
}
stage 'Build image'
def imageName = 'gitcontroller'
kubernetes.image().withName(imageName).build().fromPath(".")
stage 'Stage'
def stagedProject = stage()
def tag = stagedProject[1]
kubernetes.image().withName(imageName).tag().inRepository("${env.FABRIC8_DOCKER_REGISTRY_SERVICE_HOST}:${env.FABRIC8_DOCKER_REGISTRY_SERVICE_PORT}/fabric8/"+imageName).force().withTag(tag)
kubernetes.image().withName("${env.FABRIC8_DOCKER_REGISTRY_SERVICE_HOST}:${env.FABRIC8_DOCKER_REGISTRY_SERVICE_PORT}/fabric8/"+imageName).push().withTag(tag).toRegistry()
stage 'Promote'
release(stagedProject)
}
def externalImages(){
return ['gitcontroller']
}
def stage(){
return stageProject{
project = 'fabric8io/gitcontroller'
useGitTagForNextVersion = true
}
}
def release(project){
releaseProject{
stagedProject = project
useGitTagForNextVersion = true
helmPush = false
groupId = 'io.fabric8'
githubOrganisation = 'fabric8io'
artifactIdToWatchInCentral = 'gitcontroller'
artifactExtensionToWatchInCentral = 'pom'
promoteToDockerRegistry = 'docker.io'
dockerOrganisation = 'fabric8'
extraImagesToTag = externalImages()
}
}