Extend github context with host-workspace (#2517)

* hash files translation works with host context translated

* Change file encoding to utf8 for PipelineTemplateConstants.cs

* infer the feature flag on hash files based on the existence of the context

* encoded utf8 with bom

* rename host-workspace to host-work-directory and feature flag the new context var

* Added comment to explain ignore host work directory resolution

Co-authored-by: fhammerl <fhammerl@github.com>

* trigger pipeline

* Move to the github host-workspace context instead of the runner host-work-directory

* remove unused imports

---------

Co-authored-by: fhammerl <fhammerl@github.com>
This commit is contained in:
Nikola Jokic
2023-06-29 12:12:23 +02:00
committed by GitHub
parent a2b7856c9c
commit c05e6748c3
4 changed files with 23 additions and 2 deletions

View File

@@ -175,7 +175,14 @@ namespace GitHub.Runner.Worker
context.Debug("Update context data");
string _workDirectory = HostContext.GetDirectory(WellKnownDirectory.Work);
context.SetRunnerContext("workspace", Path.Combine(_workDirectory, trackingConfig.PipelineDirectory));
context.SetGitHubContext("workspace", Path.Combine(_workDirectory, trackingConfig.WorkspaceDirectory));
var githubWorkspace = Path.Combine(_workDirectory, trackingConfig.WorkspaceDirectory);
if (jobContext.Global.Variables.GetBoolean(Constants.Runner.Features.UseContainerPathForTemplate) ?? false)
{
// This value is used to translate paths from the container path back to the host path.
context.SetGitHubContext("host-workspace", githubWorkspace);
}
context.SetGitHubContext("workspace", githubWorkspace);
// Temporary hack for GHES alpha
var configurationStore = HostContext.GetService<IConfigurationStore>();