Team : We have Jenkins X running on top of AWS EKS (K8s), and we have jenkins agents(slaves) running as k8s pod. This pod has two containers - jnlp and docker. We use "jnlp" container to build/compile and we use container "docker" to run "docker" related command.
Question mark:in one of the jenkins agent which is a pod, using "jnlp" container, we want to run "mvn" command to generate jar file in the target folder, once successful, archive and move/copy the files from "jnlp" container to "docker" container in same pod. Like below jenkinsfile we attempted, is there something we can implement in order to archive folder in jnlp container, and move to a path in the docker container ?
pipeline {
agent { label k8s-pod-jnlp-docker }
stages {
stage ('clean up docker'){
steps {
container ('docker'){
sh 'docker system prune --force'
}
}
}
stage ('build jar file'){
steps {
container ('jnlp'){
sh '''
cd acme
mvn clean install -DskipTests
'''
}
}
}
stage ('build docker image'){
steps {
container ('docker'){
...
(build docker image, copy target folder from stage('build jar file')
}
}
}
}
}