This page shows how to setup Jenkins Multibranch Pipeline jobs and Organization folders.
http://gitbucket.example.com.Configure Jenkins:
http://gitbucket.example.com/api/v3.Add a job on Jenkins:
GitBucket (http://gitbucket.example.com/api/v3).Configure a webhook on GitBucket:
http://jenkins.example.com/github-webhook/Create a Jenkinsfile on your repository:
pipeline {
agent any
stages {
stage('build') {
steps {
sh 'echo Building ${BRANCH_NAME}...'
}
}
}
}
A new build should be started immediately on Jenkins.
Add a job on Jenkins:
GitBucket (http://gitbucket.example.com/api/v3).Configure a webhook on GitBucket:
http://jenkins.example.com/github-webhook/Then, your group and repositories should be shown in Jenkins.
Configure GitBucket:
jenkins user and add it to your group.Configure Jenkins:
jenkinsjenkinsGitBucket access credentialThen, fix jobs to use credentials.
If your build fails with the following message:
hudson.plugins.git.GitException: Command "git fetch --no-tags --progress http://servername/Owner/Repo.git +refs/heads/master:refs/remotes/origin/master" returned status code 128: stdout: stderr: error: RPC failed; result=22, HTTP code = 404 fatal: The remote end hung up unexpectedly
Then, this is caused by Jenkins trying to fetch from the Git repository under the URL http://servername/Owner/Repo.git instead of http://servername/git/Owner/Repo.git. GitBucket provides a redirect from the former to the latter URL, but this is not supported by older versions of Git.
A solution can be to install a newer Git client on the machine doing the checkout.