1

I want to set up an automatic semantic versioning so that each CI build results in an incremented patch part like in ... I use an ajoberstar/reckon gradle plugin which works flawlessly on a local machine but I'm facing some problems when trying to set this up on Bitbucket Pipelines.

My understanding is that the ajoberstar/reckon works using git tags which have to be pushed to the origin. This fails when using the following bitbucket-pipelines.yml configuration.

options:
  docker: true

pipelines:
  branches:
    master:
      - step:
          name: Build
          image: openjdk:8-jdk
          services:
            - docker
          caches:
            - docker
            - gradle
            - gradlewrapper
          size: 2x
          script:
            - ci/dependencies.sh
            - ci/credentials.sh
            - git remote set-url origin ${BITBUCKET_GIT_HTTP_ORIGIN}
            - ./gradlew build reckonTagPush publish -Preckon.scope=patch -Preckon.stage=final

The error message says:

Execution failed for task ':reckonTagPush'.
> org.eclipse.jgit.api.errors.TransportException: http://bitbucket.org/billtech/sync-manager: Authentication is required but no CredentialsProvider has been registered

As per: https://community.atlassian.com/t5/Bitbucket-Pipelines-articles/Pushing-back-to-your-repository/ba-p/958407

Configuring an alternate Git client If you are not using the git CLI provided by Pipelines, we recommend configuring origin using the ${BITBUCKET_GIT_HTTP_ORIGIN} variable. If using the http origin, you will also need to configure your git client to use a proxy. The proxy url is: http://localhost:29418.

I need to either use the git CLI provided by Pipelines or set a proxy for git client used by reckon. I'm failing to get either to work so any help is appreciated.

2 Answers2

2

I ended up splitting the following:

- ./gradlew build reckonTagPush publish -Preckon.scope=patch -Preckon.stage=final

into:

- ./gradlew build reckonTagCreate publish -Preckon.scope=patch -Preckon.stage=snapshot
- git push --tags

This way, reckon is used just to create a tag and then the git command to push it. The git command is automatically configured by bitbucket pipelines to push back to the same repo. https://confluence.atlassian.com/bitbucket/push-back-to-your-repository-962352710.html

1

You need to provide the proper credentials by setting the two environment variables or system properties listed here: http://ajoberstar.org/grgit/grgit-authentication-2.html

Example of using system properties:

./gradlew build reckonTagPush publish -Preckon.scope=patch -Preckon.stage=final -Dorg.ajoberstar.grgit.auth.username=someone -Dorg.ajoberstar.grgit.auth.password=mysecretpassword
Chad Hagen
  • 11
  • 2