diff --git a/src/Agent.Worker/Build/BuildJobExtension.cs b/src/Agent.Worker/Build/BuildJobExtension.cs index cbc1fcecd1..8718b4a9bf 100644 --- a/src/Agent.Worker/Build/BuildJobExtension.cs +++ b/src/Agent.Worker/Build/BuildJobExtension.cs @@ -151,6 +151,9 @@ public override void InitializeJobExtension(IExecutionContext executionContext, executionContext.SetVariable(Constants.Variables.Build.RepoId, repoInfo.TriggeringRepository.Id); } + // Repo containing the pipeline. + executionContext.SetVariable(Constants.Variables.Build.PipelineRepoName, executionContext.GetVariableValueOrDefault(Constants.Variables.Build.RepoName)); + executionContext.SetVariable(Constants.Variables.Build.RepoName, repoInfo.TriggeringRepository.Properties.Get(Pipelines.RepositoryPropertyNames.Name)); executionContext.SetVariable(Constants.Variables.Build.RepoProvider, ConvertToLegacyRepositoryType(repoInfo.TriggeringRepository.Type)); executionContext.SetVariable(Constants.Variables.Build.RepoUri, repoInfo.TriggeringRepository.Url?.AbsoluteUri); diff --git a/src/Microsoft.VisualStudio.Services.Agent/Constants.cs b/src/Microsoft.VisualStudio.Services.Agent/Constants.cs index bf204ee509..fcc5e2b777 100644 --- a/src/Microsoft.VisualStudio.Services.Agent/Constants.cs +++ b/src/Microsoft.VisualStudio.Services.Agent/Constants.cs @@ -373,6 +373,7 @@ public static class Build public static readonly string RepoGitSubmoduleCheckout = "build.repository.git.submodulecheckout"; public static readonly string RepoId = "build.repository.id"; public static readonly string RepoLocalPath = "build.repository.localpath"; + public static readonly string PipelineRepoName = "pipeline.repository.name"; public static readonly string RepoName = "build.Repository.name"; public static readonly string RepoProvider = "build.repository.provider"; public static readonly string RepoTfvcWorkspace = "build.repository.tfvc.workspace"; @@ -562,6 +563,7 @@ public static class Task Build.GatedRunCI, Build.GatedShelvesetName, Build.Number, + Build.PipelineRepoName, Build.RepoClean, Build.RepoGitSubmoduleCheckout, Build.RepoId,