【发布时间】:2017-11-02 23:00:05
【问题描述】:
我试图理解为什么在运行我的 bitbucket-pipelines.yml 文件时会得到两个与 git 标签相关的不同结果。目前我的项目有从1.0.0 - 1.0.25 运行的标签。 .yml 文件长这样……
pipelines:
branches:
diff-test:
- step:
script:
- export PREVIOUS_GIT_HASH=`git rev-list --tags --skip=2 --max-count=1`
- export PREVIOUS_GIT_TAG=`git describe ${PREVIOUS_GIT_HASH} --abbrev=0`
- export GIT_TAG=`git describe --tags --abbrev=0`
- echo ${PREVIOUS_GIT_TAG} ${GIT_TAG}
# A develop step/script happens here but it's irrelevant...
master:
- step:
script:
# set the most recent tag as an environment variable.
- export GIT_TAG=`git describe --tags --abbrev=0`
- zip -FSr ${BITBUCKET_REPO_SLUG}-${GIT_TAG}.zip ./ -x@exclude.lst
- curl -u ${BB_AUTH_STRING} -X POST "https://api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"${BITBUCKET_REPO_SLUG}-${GIT_TAG}.zip"
当我推送到 master 时,附加到下载工件的标签是正确的 (1.0.25)。但是,当我推送到diff-test 时,回显的标签是1.0.14 和1.0.15。
在 git 文档中,它是 describe,上面写着 --tags: Instead of using only the annotated tags, use any tag found in refs/tags namespace. This option enables matching a lightweight (non-annotated) tag.。
我的问题是 - 是什么导致标签根据我推送到的分支而不同?
【问题讨论】:
标签: git bitbucket git-tag bitbucket-pipelines git-describe