Package com.atlassian.bitbucket.jenkins.internal.status Description
There are primarily 3 types of job we should focus on:
- Freestyle Job
- Workflow, this is further characterized below as,
- Pipeline job
- Multi branch pipeline job
Pipeline and multibranch pipeline can have build steps mentioned in:
- Inline groovy script
- Fetched from Git repository (Jenkinsfile). This can be specified as either through Bitbucket SCM or through Git SCM.
There can be multiple SCM associated with a single job. We try our best to handle those. We skip posting build status in case we can't.
In addition, a pipeline script can also specify Git url as well. Example,
git url: 'https://github.com/joe_user/simple-maven-project-with-tests.git'
We assume that for a build status to be posted, there needs to be some association with
This can be done in following ways. We will send the build status in all of these cases:
- Freestyle job has Bitbucket SCM. For simply GitSCM, we will not post any build status since we don't have credentials and server id.
- Pipeline job has Bitbucket SCM to fetch jenkins file.
- Pipeline job has Bitbucket SCM to fetch jenkins file. Jenkins file has bb_checkout step mentioned.
- Pipeline job has Git SCM to fetch jenkins file. Jenkins file has bb_checkout step mentioned.
- Multi branch pipeline has Bitbucket SCM for branch scanning.
- Multi branch pipeline has Bitbucket SCM for branch scanning and bb_checkout step mentioned in Jenkinsfile.
- Multi branch pipeline has Git SCM and has bb_checkout step mentioned in Jenkinsfile.
Some of the things that should also be kept in mind are:
- Workflow job has an option of lightweight checkout. This is to fetch Jenkinsfile. This is not a representation of build being run.
Overall workflow of sending build status is as follows:
- We add SCM Listener
LocalSCMListener which listens for checkouts
- On a checkout completion, we check association with
- We attach a
BitbucketRevisionAction for storing the checkout context.
- We send an In progress build status
- We add a Run listener
BuildStatusPoster which listens for builds
- On Build completion, we retrieve the
BitbucketRevisionAction and send build status to Bitbucket.
Add package level annotations to indicate everything is non-null by default.