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}"

   docker.withRegistry('https://registry.gitlab.com/', 
'gitlab-docker-registry') {
     def docker_image = docker.build(docker_tag, '.')
     docker_image.push()
   }
}

parallel (
  'arm': {
    node('arm') {
      build()
    }
  },

  'x86_64': {
    node('linux') {
      build()
    }
  }
)
```

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/555f7e28-f695-48d4-af4f-02a5883d1961%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to