Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-49640

Don't mark builds as failed in Bitbucket when they were not built in Jenkins

XMLWordPrintable

    • 2.2.14

      Use case

      We use declarative pipelines and have some custom steps we call in the very first stage that check for changes in specific files which should skip the build and mark it as NOT_BUILT.

      We do this because some changes do not really require new builds like changes in changelogs, gitignore, etc.

      Another skip function we have, skips builds in case they contain a specific commit message. These usually come from release plugins which generate version bump commits once a PR is merged to master. Without having the skip functionality we would end up with continuously triggered builds.

      Both functions mark the build as NOT_BUILT.

       

      Problem

      Unfortunately such skipped builds are reported to Bitbucket as failed builds. When you configure your project to allow merges only if you have at least one green build than this will basically block you.

      And once your PR ends up in master your merge will first be green but the following commits created by for example the Gradle release plugin will be marked as red.

       

      Solution

      To avoid this we can mark builds of state NOT_BUILT as successful in Bitbucket. Unfortunately there is no other state (SUCCESS, FAILURE, INPROGRESS) available in Bitbucket that we could use instead.

       

       

            martinm82 Martin M
            martinm82 Martin M
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: