我试图理解为什么在运行我的 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.
.
我的问题是 - 是什么导致标签根据我推送到的分支而不同?