Re: Single Jenkinsfile, multiple architecture builds

2016-08-04 Thread Roberto Aguilar
Ah, perfect, works.

Thank you Daniel!

-Roberto.

On Thursday, August 4, 2016 at 10:23:11 AM UTC-4, Daniel Beck wrote:
>
> The error just tells you that you can't define stages within parallel, as 
> there's no visualization for it -- it's strictly sequential. So remove the 
> 'stage' statements from build() and it should be fine. 
>
> > On 04.08.2016, at 15:39, Roberto Aguilar  > wrote: 
> > 
> > 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-use...@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. 
>
>

-- 
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/add63177-cfd6-409a-bdd5-c5b76ec7d215%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Single Jenkinsfile, multiple architecture builds

2016-08-04 Thread Daniel Beck
The error just tells you that you can't define stages within parallel, as 
there's no visualization for it -- it's strictly sequential. So remove the 
'stage' statements from build() and it should be fine.

> On 04.08.2016, at 15:39, Roberto Aguilar  wrote:
> 
> 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.

-- 
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/028EA932-6B43-4B5E-9E8A-7750101A881F%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.


Single Jenkinsfile, multiple architecture builds

2016-08-04 Thread Roberto Aguilar
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.