Blue Ocean doesn't add GitHub webhooks when creating a new pipeline

13 views
Skip to first unread message

Sven Grunewaldt

unread,
Mar 15, 2018, 7:37:27 AM3/15/18
to Jenkins Users
When I create a new Pipeline with Blue Ocean via GitHub I expected webhooks to appear in the repository, but they only get created when I manually click on "Re-register hooks for all jobs" in the system configuration. Some issue comments stated that the pipeline needs to run once, then the webhooks should be created - doesn't work for me though.

The GitHub plugin access token has these permissions: admin:repo_hook, repo
The user token set in Blue Ocean has these permissions: admin:repo_hook, repo, user:email (I did try adding virtually all permissions here to make sure this isn't the problem)

As far as I can see Jenkins simply doesn't create the webhooks by itself… I can't find anything specific about this in the documentation. Do I need to do something special for the Pipeline to create the webhooks directly?

This is the Jenkinsfile I'm experimenting with at the moment:
node {
  def scmVars = checkout scm
  def commitHash = scmVars.GIT_COMMIT

  def repository = "foo/bar"
  def tag = "${commitHash}"
  def repositoryAndTag = "${repository}:${tag}"

  stage("Build container") {
    image = docker.build(repositoryAndTag)
  }

  stage("Test") {
    sh """
      docker run --rm ${repositoryAndTag} \
        php -v
    """
  }

  stage('Deploy') {
    if (currentBuild.result == null || currentBuild.result == 'SUCCESS') {
      if (env.CHANGE_ID != null) {
        echo "PR build, skipping deploy"
      } else if (env.BRANCH_NAME == "master") {
        echo "Would be pushing to docker hub here"
      } else {
        echo "No deploy, unknown branch ${env.BRANCH_NAME}"
      }
    }
  }
}

Reply all
Reply to author
Forward
0 new messages