forked from jenkinsci/kubernetes-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmulti-container.groovy
41 lines (37 loc) · 950 Bytes
/
multi-container.groovy
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
/**
* This pipeline describes a multi container job, running Maven and Golang builds
*/
podTemplate(yaml: """
apiVersion: v1
kind: Pod
spec:
containers:
- name: maven
image: maven:3.3.9-jdk-8-alpine
command: ['cat']
tty: true
- name: golang
image: golang:1.8.0
command: ['cat']
tty: true
"""
) {
node(POD_LABEL) {
stage('Build a Maven project') {
git 'https://github.com/jenkinsci/kubernetes-plugin.git'
container('maven') {
sh 'mvn -B clean package'
}
}
stage('Build a Golang project') {
git url: 'https://github.com/terraform-providers/terraform-provider-aws.git'
container('golang') {
sh """
mkdir -p /go/src/github.com/terraform-providers
ln -s `pwd` /go/src/github.com/terraform-providers/terraform-provider-aws
cd /go/src/github.com/terraform-providers/terraform-provider-aws && make build
"""
}
}
}
}