-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmulti-container.groovy
More file actions
38 lines (37 loc) · 926 Bytes
/
multi-container.groovy
File metadata and controls
38 lines (37 loc) · 926 Bytes
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
/**
* This pipeline describes a multi container job, running Maven and Golang builds
*/
podTemplate(agentContainer: 'maven',
agentInjection: true,
yaml: '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: maven
image: maven:3.9.9-eclipse-temurin-17
- name: golang
image: golang:1.23.1-bookworm
command:
- sleep
args:
- 99d
'''
) {
node(POD_LABEL) {
stage('Build a Maven project') {
git 'https://github.com/jenkinsci/kubernetes-plugin.git'
sh 'mvn -B -ntp clean package -DskipTests'
}
stage('Build a Golang project') {
git url: 'https://github.com/hashicorp/terraform.git', branch: 'main'
container('golang') {
sh '''
mkdir -p /go/src/github.com/hashicorp
ln -s `pwd` /go/src/github.com/hashicorp/terraform
cd /go/src/github.com/hashicorp/terraform && make
'''
}
}
}
}