小编jan*_*170的帖子

Azure Pipelines 多存储库如何获取 Git 提交 ID

对于具有多个存储库的 Azure Pipeline,如何从签出的资源存储库中获取 GIT 提交 ID?支持吗?

我使用 Azure 存储库来存储管道 yaml 文件,并检查代理上的构建源以在那里进行构建。我们使用的是 Delphi,所以我们必须使用代理。

resources:
  repositories:
  - repository: MyBitBucketRepo
    type: bitbucket
    endpoint: MyBitBucketServiceConnection
    name: MyBitBucketOrgOrUser/MyBitBucketRepo

trigger:
- pilot

pool:
  name: MyAgent
  demands: RADSTUDIO

variables:
  GIT_COMMIT: $(Build.SourceVersion) # <- How can I get the checked out Commit ID for the MyBitBucketRepo?
  GIT_BRANCH: $(Build.SourceBranchName) # And the branch name?

steps:
- checkout: MyBitBucketRepo

- script: dir $(Build.SourcesDirectory)
- script: echo $(GIT_COMMIT)
- script: echo $(GIT_BRANCH)
# todo set environment vars on agent with the …
Run Code Online (Sandbox Code Playgroud)

git bitbucket delphi-xe azure-pipelines

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

azure-pipelines ×1

bitbucket ×1

delphi-xe ×1

git ×1