"Build whenever a SNAPSHOT dependency is built" with "Bitbucket Team/Project"

1,391 views
Skip to first unread message

Richard Hierlmeier

unread,
Jan 9, 2018, 2:16:06 AM1/9/18
to Jenkins Users

I tried to setup a bunch of maven jobs as "Bitbucket Team/Project". In the section "Scan Organization Folder Triggers" I selected the option "Build whenever a SNAPSHOT dependency is built".
In the Bitbucket project I have two GIT repos. One for module A and one for module B.
Module B has a Maven snapshot dependency to module A.
Bot repos have the following Jenkins file:

pipeline {
  agent {
    node {
        label 'maven'
    }
  }
  triggers {
      upstream(upstreamProjects: 'Nightly Build Trigger',
               threshold: hudson.model.Result.SUCCESS)
  }
  stages {
    stage('Build') {
       steps {
         withMaven(
            mavenLocalRepo: '.repository'
         ) {
                bat "mvn clean deploy"
            }
        }
    }
  }
}

However it seems that the "Build whenever a SNAPSHOT dependency is built" option has no effect.
If module A is built the built for module B is not triggered.
If in "View configuration" of the build job of a branch the option "Build whenever a SNAPSHOT dependency is built" is not selected.

Is this options siliently ingored by "Bitbucket Team/Project"?

Environment:

Jenkins 2.73.2
Jenkins Maven Plugin 3.0.7


Richard

Stephen Connolly

unread,
Jan 9, 2018, 2:43:04 AM1/9/18
to jenkins...@googlegroups.com
On Tue 9 Jan 2018 at 07:16, 'Richard Hierlmeier' via Jenkins Users <jenkins...@googlegroups.com> wrote:

I tried to setup a bunch of maven jobs as "Bitbucket Team/Project". In the section "Scan Organization Folder Triggers" I selected the option "Build whenever a SNAPSHOT dependency is built".
In the Bitbucket project I have two GIT repos. One for module A and one for module B.
Module B has a Maven snapshot dependency to module A.
Bot repos have the following Jenkins file:

pipeline {
  agent {
    node {
        label 'maven'
    }
  }
  triggers {
      upstream(upstreamProjects: 'Nightly Build Trigger',
               threshold: hudson.model.Result.SUCCESS)

You need to configure a trigger here to have that take effect IIUC

  }
  stages {
    stage('Build') {
       steps {
         withMaven(
            mavenLocalRepo: '.repository'
         ) {
                bat "mvn clean deploy"
            }
        }
    }
  }
}

However it seems that the "Build whenever a SNAPSHOT dependency is built" option has no effect.
If module A is built the built for module B is not triggered.
If in "View configuration" of the build job of a branch the option "Build whenever a SNAPSHOT dependency is built" is not selected.

Is this options siliently ingored by "Bitbucket Team/Project"?

Environment:

Jenkins 2.73.2
Jenkins Maven Plugin 3.0.7


Richard

--
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/9f178deb-6157-47ee-85b3-88715bb5404b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone

Richard Hierlmeier

unread,
Jan 9, 2018, 6:54:37 AM1/9/18
to Jenkins Users

Hi Stephen,

do you have an example for me how to define such a trigger?


Thank you

   Richard

Stephen Connolly

unread,
Jan 9, 2018, 8:54:00 AM1/9/18
to jenkins...@googlegroups.com
Snippet generator gives:

Inline images 1

So I'd guess you just add snapshotDependencies() to your triggers as you are using declarative syntax.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/32982e93-e480-4d8c-9e20-5c5f3b8d9eda%40googlegroups.com.

Richard Hierlmeier

unread,
Jan 9, 2018, 10:45:05 AM1/9/18
to Jenkins Users

Hi Stephen,

thank your for this hint. Here is the complete example for the Jenkins file:

#!groovy
pipeline
{
  agent any
  stages
{
    stage
('Build') {
       steps
{
         script
{
                properties
([pipelineTriggers([snapshotDependencies()])])
         
}
         withMaven
(
            mavenLocalRepo
: '.repository'
         
) {
                bat
"clean deploy"
           
}
       
}
   
}
}

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

Stephen Connolly

unread,
Jan 9, 2018, 12:29:03 PM1/9/18
to jenkins...@googlegroups.com
NOOOOOOO

you probably want more like

pipeline {
  agent {
    node {
        label 'maven'
    }
  }
  triggers {
      upstream(upstreamProjects: 'Nightly Build Trigger',
               threshold: hudson.model.Result.SUCCESS)
      snapshotDependencies()

  }
  stages {
    stage('Build') {
       steps {
         withMaven(
            mavenLocalRepo: '.repository'
         ) {
                bat "mvn clean deploy"
            }
        }
    }
  }
}

don't use a script block

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9efce421-d691-46a1-a33c-abd05b8ca6ba%40googlegroups.com.

Richard Hierlmeier

unread,
Jan 12, 2018, 3:13:38 AM1/12/18
to Jenkins Users

Hi Stephen,

it works now, thank you for your help.
Reply all
Reply to author
Forward
0 new messages