Hello,
I have a Jenkins master (x86_64 linux) and a slave (armv7l linux). I have labeled them "x86_64" and "arm" respectively. I have a Pipeline build triggering on Git push, and I would like the Jenkinsfile in the repo to build on both machines. I'm having trouble setting up my Jenkinsfile to do this. My attempt errors out with the message:
```
ERROR: The ?stage? step must not be used inside a ?parallel? block.
```
The goal here is to:
- build two docker images; one for arm and x86_64
- keep from duplicating the build stages in two `node {}` definitions, hence attempting to call the build() in each node
- run the builds in parallel rather than having to wait for one to complete before starting the other
Any pointers on getting this to work.
Thank you.
My Jenkinsfile:
```
def build() {
stage 'repository'
checkout scm
stage 'vars'
def git_tag = sh(returnStdout: true, script: '''git describe --tags || exit 0''')
def arch = sh(returnStdout: true, script: '''uname -m''')
stage 'Docker'
def docker_base="${env.gitlabSourceNamespace}/${env.gitlabSourceRepoName}"
def git_branch = env.gitlabTargetBranch.split('/').last()
def docker_tag = "${docker_base}:${git_branch}-${arch}"
def docker_image = docker.build(docker_tag, '.')
docker_image.push()
}
}
parallel (
'arm': {
node('arm') {
build()
}
},
'x86_64': {
node('linux') {
build()
}
}
)
```