对于具有多个存储库的 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)