diff --git a/src/Runner.Server/Controllers/MessageController.cs b/src/Runner.Server/Controllers/MessageController.cs index 5afd811a9a2..f1942d98397 100644 --- a/src/Runner.Server/Controllers/MessageController.cs +++ b/src/Runner.Server/Controllers/MessageController.cs @@ -3162,7 +3162,7 @@ private HookResponse AzureDevopsMain(string fileRelativePath, string content, st workflowContext.Flags = flags; List jobgroup = new List(); List dependentjobgroup = new List(); - var fileProvider = new DefaultInMemoryFileProviderFileProvider(workflows, (a, b) => { + var fileProvider = new Azure.Devops.DefaultInMemoryFileProviderFileProvider(workflows, (a, b) => { return TryGetFile(runid, a, out var content, b) ? content : null; }); var rootVariables = new Dictionary(StringComparer.OrdinalIgnoreCase); diff --git a/src/Sdk/AzurePipelines/DefaultFileProvider.cs b/src/Sdk/AzurePipelines/DefaultFileProvider.cs index d6ebf8f7df1..85fdd237bac 100644 --- a/src/Sdk/AzurePipelines/DefaultFileProvider.cs +++ b/src/Sdk/AzurePipelines/DefaultFileProvider.cs @@ -1,9 +1,12 @@ using System.Threading.Tasks; -public class DefaultFileProvider : IFileProvider -{ - public Task ReadFile(string repositoryAndRef, string path) +namespace Runner.Server.Azure.Devops { + + public class DefaultFileProvider : IFileProvider { - return Task.FromResult(System.IO.File.ReadAllText(path)); + public Task ReadFile(string repositoryAndRef, string path) + { + return Task.FromResult(System.IO.File.ReadAllText(path)); + } } } \ No newline at end of file diff --git a/src/Sdk/AzurePipelines/IFileProvider.cs b/src/Sdk/AzurePipelines/IFileProvider.cs index 5be28173e85..67ff5651534 100644 --- a/src/Sdk/AzurePipelines/IFileProvider.cs +++ b/src/Sdk/AzurePipelines/IFileProvider.cs @@ -1,5 +1,8 @@ using System.Threading.Tasks; -public interface IFileProvider { - Task ReadFile(string repositoryAndRef, string path); +namespace Runner.Server.Azure.Devops { + + public interface IFileProvider { + Task ReadFile(string repositoryAndRef, string path); + } } \ No newline at end of file diff --git a/src/Sdk/AzurePipelines/InMemoryFileProvider.cs b/src/Sdk/AzurePipelines/InMemoryFileProvider.cs index c895dd7633f..e5fc3475ffb 100644 --- a/src/Sdk/AzurePipelines/InMemoryFileProvider.cs +++ b/src/Sdk/AzurePipelines/InMemoryFileProvider.cs @@ -3,23 +3,26 @@ using System; using System.Threading.Tasks; -public class DefaultInMemoryFileProviderFileProvider : IFileProvider -{ - public DefaultInMemoryFileProviderFileProvider(KeyValuePair[] workflows, Func readFile = null) { - Workflows = workflows.ToDictionary(kv => kv.Key, kv => kv.Value); - this.readFile = readFile; - } - - private Func readFile; - public Dictionary Workflows { get; private set; } +namespace Runner.Server.Azure.Devops { - public Task ReadFile(string repositoryAndRef, string path) + public class DefaultInMemoryFileProviderFileProvider : IFileProvider { - if(repositoryAndRef == null && Workflows.TryGetValue(path, out var content)) { - return Task.FromResult(content); - } else if(readFile != null) { - return Task.FromResult(readFile(path, repositoryAndRef)); + public DefaultInMemoryFileProviderFileProvider(KeyValuePair[] workflows, Func readFile = null) { + Workflows = workflows.ToDictionary(kv => kv.Key, kv => kv.Value); + this.readFile = readFile; + } + + private Func readFile; + public Dictionary Workflows { get; private set; } + + public Task ReadFile(string repositoryAndRef, string path) + { + if(repositoryAndRef == null && Workflows.TryGetValue(path, out var content)) { + return Task.FromResult(content); + } else if(readFile != null) { + return Task.FromResult(readFile(path, repositoryAndRef)); + } + return Task.FromResult(null); } - return Task.FromResult(null); } } \ No newline at end of file