简体   繁体   English

如何使用 ajoberstar/reckon 和 Bitbucket Pipelines 配置自动语义版本控制?

[英]How to configure automatic semantic versioning using ajoberstar/reckon and Bitbucket Pipelines?

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.我想设置一个自动语义版本控制,以便每个 CI 构建都会产生一个递增的补丁部分,例如……在 Bitbucket Pipelines 上进行设置。

My understanding is that the ajoberstar/reckon works using git tags which have to be pushed to the origin.我的理解是 ajoberstar/reckon 使用必须推送到原点的 git 标签工作。 This fails when using the following bitbucket-pipelines.yml configuration.使用以下 bitbucket-pipelines.yml 配置时失败。

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根据: 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.配置备用 Git 客户端如果您不使用 Pipelines 提供的 git CLI,我们建议使用 ${BITBUCKET_GIT_HTTP_ORIGIN} 变量配置 origin。 If using the http origin, you will also need to configure your git client to use a proxy.如果使用 http 源,您还需要配置 git 客户端以使用代理。 The proxy url is: http://localhost:29418 .代理 url 是: http://localhost:29418

I need to either use the git CLI provided by Pipelines or set a proxy for git client used by reckon.我需要使用 Pipelines 提供的 git CLI 或为 reckon 使用的 git 客户端设置代理。 I'm failing to get either to work so any help is appreciated.我无法让任何一个工作,所以任何帮助表示赞赏。

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.这样, reckon 仅用于创建标签,然后使用 git 命令推送它。 The git command is automatically configured by bitbucket pipelines to push back to the same repo. git 命令由 bitbucket 管道自动配置以推回到同一个 repo。 https://confluence.atlassian.com/bitbucket/push-back-to-your-repository-962352710.html https://confluence.atlassian.com/bitbucket/push-back-to-your-repository-962352710.html

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您需要通过设置此处列出的两个环境变量或系统属性来提供正确的凭据: 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM