jenkinspipeline.yaml
def labelname = "sample"
pipeline {
agent {
kubernetes {
label labelname
yaml '''
apiVersion: v1
kind: Pod
metadata:
labels:
sample: sample
spec:
containers:
- name: sample
image: sample
command:
- cat
tty: true
resources:
limits:
memory: "768Mi"
cpu: "1000m"
requests:
memory: "512Mi"
cpu: "500m"
'''
}
}
stages {
stage('sample-stage') {
steps {
container('sample'){
script {
def sitelist = [1,2,3]
tasks = [:]
for (name in sitelist) {
def siteName = name
tasks[siteName] = {
container('sample'){
sh """
echo Hello
"""
}
}
}
parallel tasks
}
}
}
}
}
post {
always {
cleanWs()
}
}
}