mirror of
https://github.com/actions/runner.git
synced 2025-12-11 04:46:58 +00:00
Compare commits
3 Commits
releases/m
...
users/tihu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edfad1a198 | ||
|
|
10bce3549c | ||
|
|
68b180a229 |
20
.github/workflows/codeql.yml
vendored
20
.github/workflows/codeql.yml
vendored
@@ -9,11 +9,11 @@ jobs:
|
|||||||
CodeQL-Build:
|
CodeQL-Build:
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
|
||||||
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
|
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -22,13 +22,17 @@ jobs:
|
|||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v1
|
||||||
# Override language selection by uncommenting this and choosing your languages
|
|
||||||
# with:
|
|
||||||
# languages: go, javascript, csharp, python, cpp, java
|
|
||||||
|
|
||||||
- name: Manual build
|
- name: Manual build (Windows)
|
||||||
|
if: runner.os == 'windows'
|
||||||
run : |
|
run : |
|
||||||
./dev.sh layout Release linux-x64
|
dev.cmd layout Release
|
||||||
|
working-directory: src
|
||||||
|
|
||||||
|
- name: Manual build (Non-Windows)
|
||||||
|
if: runner.os != 'windows'
|
||||||
|
run : |
|
||||||
|
./dev.sh layout Release
|
||||||
working-directory: src
|
working-directory: src
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
## Features
|
## Features
|
||||||
- N/A
|
- Runner support for GHES Alpha (#381 #386 #390 #393 $401)
|
||||||
|
- Allow secrets context in Container.env (#388)
|
||||||
## Bugs
|
## Bugs
|
||||||
- Handle `jq` returns "null" if the field does not exist in create-latest-svc.sh (#478)
|
- Raise warning when volume mount root. (#413)
|
||||||
- Switch GITHUB_URL to GITHUB_SERVER_URL (#482)
|
- Fix typo (#394)
|
||||||
- Fix problem matcher for GHES (#488)
|
|
||||||
- Fix container action inputs validation warning (#490)
|
|
||||||
- Fix post step display name (#490)
|
|
||||||
- Fix worker crash due to exception from evaluating step.env (#490)
|
|
||||||
## Misc
|
## Misc
|
||||||
- N/A
|
- N/A
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.263.0
|
2.168.0
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ fi
|
|||||||
|
|
||||||
export RUNNER_TOKEN=$(curl -s -X POST ${base_api_url}/${orgs_or_repos}/${runner_scope}/actions/runners/registration-token -H "accept: application/vnd.github.everest-preview+json" -H "authorization: token ${RUNNER_CFG_PAT}" | jq -r '.token')
|
export RUNNER_TOKEN=$(curl -s -X POST ${base_api_url}/${orgs_or_repos}/${runner_scope}/actions/runners/registration-token -H "accept: application/vnd.github.everest-preview+json" -H "authorization: token ${RUNNER_CFG_PAT}" | jq -r '.token')
|
||||||
|
|
||||||
if [ "null" == "$RUNNER_TOKEN" -o -z "$RUNNER_TOKEN" ]; then fatal "Failed to get a token"; fi
|
if [ -z "$RUNNER_TOKEN" ]; then fatal "Failed to get a token"; fi
|
||||||
|
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
# Download latest released and extract
|
# Download latest released and extract
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SVC_NAME="{{SvcNameVar}}"
|
SVC_NAME="{{SvcNameVar}}"
|
||||||
SVC_NAME=${SVC_NAME// /_}
|
|
||||||
SVC_DESCRIPTION="{{SvcDescription}}"
|
SVC_DESCRIPTION="{{SvcDescription}}"
|
||||||
|
|
||||||
user_id=`id -u`
|
user_id=`id -u`
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SVC_NAME="{{SvcNameVar}}"
|
SVC_NAME="{{SvcNameVar}}"
|
||||||
SVC_NAME=${SVC_NAME// /_}
|
|
||||||
SVC_DESCRIPTION="{{SvcDescription}}"
|
SVC_DESCRIPTION="{{SvcDescription}}"
|
||||||
|
|
||||||
SVC_CMD=$1
|
SVC_CMD=$1
|
||||||
|
|||||||
@@ -92,11 +92,9 @@ namespace GitHub.Runner.Listener.Configuration
|
|||||||
_term.WriteSection("Authentication");
|
_term.WriteSection("Authentication");
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// When testing against a dev deployment of Actions Service, set this environment variable
|
// Get the URL
|
||||||
var useDevActionsServiceUrl = Environment.GetEnvironmentVariable("USE_DEV_ACTIONS_SERVICE_URL");
|
|
||||||
var inputUrl = command.GetUrl();
|
var inputUrl = command.GetUrl();
|
||||||
if (inputUrl.Contains("codedev.ms", StringComparison.OrdinalIgnoreCase)
|
if (inputUrl.Contains("codedev.ms", StringComparison.OrdinalIgnoreCase))
|
||||||
|| useDevActionsServiceUrl != null)
|
|
||||||
{
|
{
|
||||||
runnerSettings.ServerUrl = inputUrl;
|
runnerSettings.ServerUrl = inputUrl;
|
||||||
// Get the credentials
|
// Get the credentials
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace GitHub.Runner.Plugins.Repository.v1_0
|
|||||||
executionContext.Output($"Syncing repository: {repoFullName}");
|
executionContext.Output($"Syncing repository: {repoFullName}");
|
||||||
|
|
||||||
// Repository URL
|
// Repository URL
|
||||||
var githubUrl = executionContext.GetGitHubContext("server_url");
|
var githubUrl = executionContext.GetGitHubContext("url");
|
||||||
var githubUri = new Uri(!string.IsNullOrEmpty(githubUrl) ? githubUrl : "https://github.com");
|
var githubUri = new Uri(!string.IsNullOrEmpty(githubUrl) ? githubUrl : "https://github.com");
|
||||||
var portInfo = githubUri.IsDefaultPort ? string.Empty : $":{githubUri.Port}";
|
var portInfo = githubUri.IsDefaultPort ? string.Empty : $":{githubUri.Port}";
|
||||||
Uri repositoryUrl = new Uri($"{githubUri.Scheme}://{githubUri.Host}{portInfo}/{repoFullName}");
|
Uri repositoryUrl = new Uri($"{githubUri.Scheme}://{githubUri.Host}{portInfo}/{repoFullName}");
|
||||||
|
|||||||
@@ -94,13 +94,6 @@ namespace GitHub.Runner.Worker
|
|||||||
if (handlerData.HasPost && (Stage == ActionRunStage.Pre || Stage == ActionRunStage.Main))
|
if (handlerData.HasPost && (Stage == ActionRunStage.Pre || Stage == ActionRunStage.Main))
|
||||||
{
|
{
|
||||||
string postDisplayName = $"Post {this.DisplayName}";
|
string postDisplayName = $"Post {this.DisplayName}";
|
||||||
if (Stage == ActionRunStage.Pre &&
|
|
||||||
this.DisplayName.StartsWith("Pre ", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
// Trim the leading `Pre ` from the display name.
|
|
||||||
// Otherwise, we will get `Post Pre xxx` as DisplayName for the Post step.
|
|
||||||
postDisplayName = $"Post {this.DisplayName.Substring("Pre ".Length)}";
|
|
||||||
}
|
|
||||||
var repositoryReference = Action.Reference as RepositoryPathReference;
|
var repositoryReference = Action.Reference as RepositoryPathReference;
|
||||||
var pathString = string.IsNullOrEmpty(repositoryReference.Path) ? string.Empty : $"/{repositoryReference.Path}";
|
var pathString = string.IsNullOrEmpty(repositoryReference.Path) ? string.Empty : $"/{repositoryReference.Path}";
|
||||||
var repoString = string.IsNullOrEmpty(repositoryReference.Ref) ? $"{repositoryReference.Name}{pathString}" :
|
var repoString = string.IsNullOrEmpty(repositoryReference.Ref) ? $"{repositoryReference.Name}{pathString}" :
|
||||||
@@ -162,13 +155,6 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
|
|
||||||
var validInputs = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
var validInputs = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||||
if (handlerData.ExecutionType == ActionExecutionType.Container)
|
|
||||||
{
|
|
||||||
// container action always accept 'entryPoint' and 'args' as inputs
|
|
||||||
// https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswithargs
|
|
||||||
validInputs.Add("entryPoint");
|
|
||||||
validInputs.Add("args");
|
|
||||||
}
|
|
||||||
// Merge the default inputs from the definition
|
// Merge the default inputs from the definition
|
||||||
if (definition.Data?.Inputs != null)
|
if (definition.Data?.Inputs != null)
|
||||||
{
|
{
|
||||||
@@ -184,9 +170,6 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate inputs only for actions with action.yml
|
|
||||||
if (Action.Reference.Type == Pipelines.ActionSourceType.Repository)
|
|
||||||
{
|
|
||||||
foreach (var input in userInputs)
|
foreach (var input in userInputs)
|
||||||
{
|
{
|
||||||
if (!validInputs.Contains(input))
|
if (!validInputs.Contains(input))
|
||||||
@@ -194,7 +177,6 @@ namespace GitHub.Runner.Worker
|
|||||||
ExecutionContext.Warning($"Unexpected input '{input}', valid inputs are ['{string.Join("', '", validInputs)}']");
|
ExecutionContext.Warning($"Unexpected input '{input}', valid inputs are ['{string.Join("', '", validInputs)}']");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Load the action environment.
|
// Load the action environment.
|
||||||
ExecutionContext.Debug("Loading env");
|
ExecutionContext.Debug("Loading env");
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ namespace GitHub.Runner.Worker
|
|||||||
public sealed class ExecutionContext : RunnerService, IExecutionContext
|
public sealed class ExecutionContext : RunnerService, IExecutionContext
|
||||||
{
|
{
|
||||||
private const int _maxIssueCount = 10;
|
private const int _maxIssueCount = 10;
|
||||||
private const int _throttlingDelayReportThreshold = 10 * 1000; // Don't report throttling with less than 10 seconds delay
|
|
||||||
|
|
||||||
private readonly TimelineRecord _record = new TimelineRecord();
|
private readonly TimelineRecord _record = new TimelineRecord();
|
||||||
private readonly Dictionary<Guid, TimelineRecord> _detailRecords = new Dictionary<Guid, TimelineRecord>();
|
private readonly Dictionary<Guid, TimelineRecord> _detailRecords = new Dictionary<Guid, TimelineRecord>();
|
||||||
@@ -336,7 +335,7 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
|
|
||||||
// report total delay caused by server throttling.
|
// report total delay caused by server throttling.
|
||||||
if (_totalThrottlingDelayInMilliseconds > _throttlingDelayReportThreshold)
|
if (_totalThrottlingDelayInMilliseconds > 0)
|
||||||
{
|
{
|
||||||
this.Warning($"The job has experienced {TimeSpan.FromMilliseconds(_totalThrottlingDelayInMilliseconds).TotalSeconds} seconds total delay caused by server throttling.");
|
this.Warning($"The job has experienced {TimeSpan.FromMilliseconds(_totalThrottlingDelayInMilliseconds).TotalSeconds} seconds total delay caused by server throttling.");
|
||||||
}
|
}
|
||||||
@@ -364,11 +363,7 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Root != this)
|
|
||||||
{
|
|
||||||
// only dispose TokenSource for step level ExecutionContext
|
|
||||||
_cancellationTokenSource?.Dispose();
|
_cancellationTokenSource?.Dispose();
|
||||||
}
|
|
||||||
|
|
||||||
_logger.End();
|
_logger.End();
|
||||||
|
|
||||||
@@ -856,8 +851,7 @@ namespace GitHub.Runner.Worker
|
|||||||
{
|
{
|
||||||
Interlocked.Add(ref _totalThrottlingDelayInMilliseconds, Convert.ToInt64(data.Delay.TotalMilliseconds));
|
Interlocked.Add(ref _totalThrottlingDelayInMilliseconds, Convert.ToInt64(data.Delay.TotalMilliseconds));
|
||||||
|
|
||||||
if (!_throttlingReported &&
|
if (!_throttlingReported)
|
||||||
_totalThrottlingDelayInMilliseconds > _throttlingDelayReportThreshold)
|
|
||||||
{
|
{
|
||||||
this.Warning(string.Format("The job is currently being throttled by the server. You may experience delays in console line output, job status reporting, and action log uploads."));
|
this.Warning(string.Format("The job is currently being throttled by the server. You may experience delays in console line output, job status reporting, and action log uploads."));
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ namespace GitHub.Runner.Worker
|
|||||||
"repository_owner",
|
"repository_owner",
|
||||||
"run_id",
|
"run_id",
|
||||||
"run_number",
|
"run_number",
|
||||||
"server_url",
|
|
||||||
"sha",
|
"sha",
|
||||||
|
"url",
|
||||||
"workflow",
|
"workflow",
|
||||||
"workspace",
|
"workspace",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -352,27 +352,18 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
if (File.Exists(gitConfigPath))
|
if (File.Exists(gitConfigPath))
|
||||||
{
|
{
|
||||||
// Check if the config contains the workflow repository url
|
// Check if the config contains the workflow repository url
|
||||||
var serverUrl = _executionContext.GetGitHubContext("server_url");
|
var qualifiedRepository = _executionContext.GetGitHubContext("repository");
|
||||||
serverUrl = !string.IsNullOrEmpty(serverUrl) ? serverUrl : "https://github.com";
|
var configMatch = $"url = https://github.com/{qualifiedRepository}";
|
||||||
var host = new Uri(serverUrl, UriKind.Absolute).Host;
|
|
||||||
var nameWithOwner = _executionContext.GetGitHubContext("repository");
|
|
||||||
var patterns = new[] {
|
|
||||||
$"url = {serverUrl}/{nameWithOwner}",
|
|
||||||
$"url = git@{host}:{nameWithOwner}.git",
|
|
||||||
};
|
|
||||||
var content = File.ReadAllText(gitConfigPath);
|
var content = File.ReadAllText(gitConfigPath);
|
||||||
foreach (var line in content.Split("\n").Select(x => x.Trim()))
|
foreach (var line in content.Split("\n").Select(x => x.Trim()))
|
||||||
{
|
{
|
||||||
foreach (var pattern in patterns)
|
if (String.Equals(line, configMatch, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
|
||||||
if (String.Equals(line, pattern, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
{
|
||||||
repositoryPath = directoryPath;
|
repositoryPath = directoryPath;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Recursive call
|
// Recursive call
|
||||||
|
|||||||
@@ -131,13 +131,12 @@ namespace GitHub.Runner.Worker
|
|||||||
// Temporary hack for GHES alpha
|
// Temporary hack for GHES alpha
|
||||||
var configurationStore = HostContext.GetService<IConfigurationStore>();
|
var configurationStore = HostContext.GetService<IConfigurationStore>();
|
||||||
var runnerSettings = configurationStore.GetSettings();
|
var runnerSettings = configurationStore.GetSettings();
|
||||||
if (string.IsNullOrEmpty(context.GetGitHubContext("server_url")) && !runnerSettings.IsHostedServer && !string.IsNullOrEmpty(runnerSettings.GitHubUrl))
|
if (string.IsNullOrEmpty(context.GetGitHubContext("url")) && !runnerSettings.IsHostedServer && !string.IsNullOrEmpty(runnerSettings.GitHubUrl))
|
||||||
{
|
{
|
||||||
var url = new Uri(runnerSettings.GitHubUrl);
|
var url = new Uri(runnerSettings.GitHubUrl);
|
||||||
var portInfo = url.IsDefaultPort ? string.Empty : $":{url.Port.ToString(CultureInfo.InvariantCulture)}";
|
var portInfo = url.IsDefaultPort ? string.Empty : $":{url.Port.ToString(CultureInfo.InvariantCulture)}";
|
||||||
context.SetGitHubContext("server_url", $"{url.Scheme}://{url.Host}{portInfo}");
|
context.SetGitHubContext("url", $"{url.Scheme}://{url.Host}{portInfo}");
|
||||||
context.SetGitHubContext("api_url", $"{url.Scheme}://{url.Host}{portInfo}/api/v3");
|
context.SetGitHubContext("api_url", $"{url.Scheme}://{url.Host}{portInfo}/api/v3");
|
||||||
context.SetGitHubContext("graphql_url", $"{url.Scheme}://{url.Host}{portInfo}/api/graphql");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evaluate the job-level environment variables
|
// Evaluate the job-level environment variables
|
||||||
|
|||||||
@@ -254,12 +254,6 @@ namespace GitHub.Runner.Worker
|
|||||||
Trace.Error(ex);
|
Trace.Error(ex);
|
||||||
return TaskResult.Failed;
|
return TaskResult.Failed;
|
||||||
}
|
}
|
||||||
catch (TaskOrchestrationPlanTerminatedException ex)
|
|
||||||
{
|
|
||||||
Trace.Error($"TaskOrchestrationPlanTerminatedException received, while attempting to raise JobCompletedEvent for job {message.JobId}.");
|
|
||||||
Trace.Error(ex);
|
|
||||||
return TaskResult.Failed;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Trace.Error($"Catch exception while attempting to raise JobCompletedEvent for job {message.JobId}, job request {message.RequestId}.");
|
Trace.Error($"Catch exception while attempting to raise JobCompletedEvent for job {message.JobId}, job request {message.RequestId}.");
|
||||||
|
|||||||
@@ -98,14 +98,11 @@ namespace GitHub.Runner.Worker
|
|||||||
envContext[pair.Key] = new StringContextData(pair.Value ?? string.Empty);
|
envContext[pair.Key] = new StringContextData(pair.Value ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool evaluateStepEnvFailed = false;
|
|
||||||
if (step is IActionRunner actionStep)
|
if (step is IActionRunner actionStep)
|
||||||
{
|
{
|
||||||
// Set GITHUB_ACTION
|
// Set GITHUB_ACTION
|
||||||
step.ExecutionContext.SetGitHubContext("action", actionStep.Action.Name);
|
step.ExecutionContext.SetGitHubContext("action", actionStep.Action.Name);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Evaluate and merge action's env block to env context
|
// Evaluate and merge action's env block to env context
|
||||||
var templateEvaluator = step.ExecutionContext.ToPipelineTemplateEvaluator();
|
var templateEvaluator = step.ExecutionContext.ToPipelineTemplateEvaluator();
|
||||||
var actionEnvironment = templateEvaluator.EvaluateStepEnvironment(actionStep.Action.Environment, step.ExecutionContext.ExpressionValues, step.ExecutionContext.ExpressionFunctions, VarUtil.EnvironmentVariableKeyComparer);
|
var actionEnvironment = templateEvaluator.EvaluateStepEnvironment(actionStep.Action.Environment, step.ExecutionContext.ExpressionValues, step.ExecutionContext.ExpressionFunctions, VarUtil.EnvironmentVariableKeyComparer);
|
||||||
@@ -114,18 +111,7 @@ namespace GitHub.Runner.Worker
|
|||||||
envContext[env.Key] = new StringContextData(env.Value ?? string.Empty);
|
envContext[env.Key] = new StringContextData(env.Value ?? string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
// fail the step since there is an evaluate error.
|
|
||||||
Trace.Info("Caught exception from expression for step.env");
|
|
||||||
evaluateStepEnvFailed = true;
|
|
||||||
step.ExecutionContext.Error(ex);
|
|
||||||
CompleteStep(step, nextStep, TaskResult.Failed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!evaluateStepEnvFailed)
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Register job cancellation call back only if job cancellation token not been fire before each step run
|
// Register job cancellation call back only if job cancellation token not been fire before each step run
|
||||||
@@ -233,7 +219,6 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Update the job result.
|
// Update the job result.
|
||||||
if (step.ExecutionContext.Result == TaskResult.Failed)
|
if (step.ExecutionContext.Result == TaskResult.Failed)
|
||||||
|
|||||||
@@ -295,10 +295,9 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
{
|
{
|
||||||
Name = "action",
|
Name = "action",
|
||||||
Id = actionId,
|
Id = actionId,
|
||||||
Reference = new Pipelines.RepositoryPathReference()
|
Reference = new Pipelines.ContainerRegistryReference()
|
||||||
{
|
{
|
||||||
Name = "actions/runner",
|
Image = "ubuntu:16.04"
|
||||||
Ref = "v1"
|
|
||||||
},
|
},
|
||||||
Inputs = actionInputs
|
Inputs = actionInputs
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -686,17 +686,14 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
// <WORKSPACE>/workflow-repo/nested-other-repo
|
// <WORKSPACE>/workflow-repo/nested-other-repo
|
||||||
// <WORKSPACE>/other-repo
|
// <WORKSPACE>/other-repo
|
||||||
// <WORKSPACE>/other-repo/nested-workflow-repo
|
// <WORKSPACE>/other-repo/nested-workflow-repo
|
||||||
// <WORKSPACE>/workflow-repo-using-ssh
|
|
||||||
var workflowRepository = Path.Combine(workspaceDirectory, "workflow-repo");
|
var workflowRepository = Path.Combine(workspaceDirectory, "workflow-repo");
|
||||||
var nestedOtherRepository = Path.Combine(workspaceDirectory, "workflow-repo", "nested-other-repo");
|
var nestedOtherRepository = Path.Combine(workspaceDirectory, "workflow-repo", "nested-other-repo");
|
||||||
var otherRepository = Path.Combine(workspaceDirectory, workflowRepository, "nested-other-repo");
|
var otherRepository = Path.Combine(workspaceDirectory, workflowRepository, "nested-other-repo");
|
||||||
var nestedWorkflowRepository = Path.Combine(workspaceDirectory, "other-repo", "nested-workflow-repo");
|
var nestedWorkflowRepository = Path.Combine(workspaceDirectory, "other-repo", "nested-workflow-repo");
|
||||||
var workflowRepositoryUsingSsh = Path.Combine(workspaceDirectory, "workflow-repo-using-ssh");
|
|
||||||
await CreateRepository(hostContext, workflowRepository, "https://github.com/my-org/workflow-repo");
|
await CreateRepository(hostContext, workflowRepository, "https://github.com/my-org/workflow-repo");
|
||||||
await CreateRepository(hostContext, nestedOtherRepository, "https://github.com/my-org/other-repo");
|
await CreateRepository(hostContext, nestedOtherRepository, "https://github.com/my-org/other-repo");
|
||||||
await CreateRepository(hostContext, otherRepository, "https://github.com/my-org/other-repo");
|
await CreateRepository(hostContext, otherRepository, "https://github.com/my-org/other-repo");
|
||||||
await CreateRepository(hostContext, nestedWorkflowRepository, "https://github.com/my-org/workflow-repo");
|
await CreateRepository(hostContext, nestedWorkflowRepository, "https://github.com/my-org/workflow-repo");
|
||||||
await CreateRepository(hostContext, workflowRepositoryUsingSsh, "git@github.com:my-org/workflow-repo.git");
|
|
||||||
|
|
||||||
// Create test files
|
// Create test files
|
||||||
var file_noRepository = Path.Combine(workspaceDirectory, "no-repo.txt");
|
var file_noRepository = Path.Combine(workspaceDirectory, "no-repo.txt");
|
||||||
@@ -706,8 +703,7 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
var file_nestedOtherRepository = Path.Combine(nestedOtherRepository, "nested-other-repo");
|
var file_nestedOtherRepository = Path.Combine(nestedOtherRepository, "nested-other-repo");
|
||||||
var file_otherRepository = Path.Combine(otherRepository, "other-repo.txt");
|
var file_otherRepository = Path.Combine(otherRepository, "other-repo.txt");
|
||||||
var file_nestedWorkflowRepository = Path.Combine(nestedWorkflowRepository, "nested-workflow-repo.txt");
|
var file_nestedWorkflowRepository = Path.Combine(nestedWorkflowRepository, "nested-workflow-repo.txt");
|
||||||
var file_workflowRepositoryUsingSsh = Path.Combine(workflowRepositoryUsingSsh, "workflow-repo-using-ssh.txt");
|
foreach (var file in new[] { file_noRepository, file_workflowRepository, file_workflowRepository_nestedDirectory, file_workflowRepository_failsafe, file_nestedOtherRepository, file_otherRepository, file_nestedWorkflowRepository })
|
||||||
foreach (var file in new[] { file_noRepository, file_workflowRepository, file_workflowRepository_nestedDirectory, file_workflowRepository_failsafe, file_nestedOtherRepository, file_otherRepository, file_nestedWorkflowRepository, file_workflowRepositoryUsingSsh })
|
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(file));
|
Directory.CreateDirectory(Path.GetDirectoryName(file));
|
||||||
File.WriteAllText(file, "");
|
File.WriteAllText(file, "");
|
||||||
@@ -722,9 +718,8 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
Process($"{file_nestedOtherRepository}: some error 6");
|
Process($"{file_nestedOtherRepository}: some error 6");
|
||||||
Process($"{file_otherRepository}: some error 7");
|
Process($"{file_otherRepository}: some error 7");
|
||||||
Process($"{file_nestedWorkflowRepository}: some error 8");
|
Process($"{file_nestedWorkflowRepository}: some error 8");
|
||||||
Process($"{file_workflowRepositoryUsingSsh}: some error 9");
|
|
||||||
|
|
||||||
Assert.Equal(9, _issues.Count);
|
Assert.Equal(8, _issues.Count);
|
||||||
|
|
||||||
Assert.Equal("some error 1", _issues[0].Item1.Message);
|
Assert.Equal("some error 1", _issues[0].Item1.Message);
|
||||||
Assert.False(_issues[0].Item1.Data.ContainsKey("file"));
|
Assert.False(_issues[0].Item1.Data.ContainsKey("file"));
|
||||||
@@ -749,9 +744,6 @@ namespace GitHub.Runner.Common.Tests.Worker
|
|||||||
|
|
||||||
Assert.Equal("some error 8", _issues[7].Item1.Message);
|
Assert.Equal("some error 8", _issues[7].Item1.Message);
|
||||||
Assert.Equal(file_nestedWorkflowRepository.Substring(nestedWorkflowRepository.Length + 1).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), _issues[7].Item1.Data["file"]);
|
Assert.Equal(file_nestedWorkflowRepository.Substring(nestedWorkflowRepository.Length + 1).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), _issues[7].Item1.Data["file"]);
|
||||||
|
|
||||||
Assert.Equal("some error 9", _issues[8].Item1.Message);
|
|
||||||
Assert.Equal(file_workflowRepositoryUsingSsh.Substring(workflowRepositoryUsingSsh.Length + 1).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar), _issues[8].Item1.Data["file"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment.SetEnvironmentVariable("RUNNER_TEST_GET_REPOSITORY_PATH_FAILSAFE", "");
|
Environment.SetEnvironmentVariable("RUNNER_TEST_GET_REPOSITORY_PATH_FAILSAFE", "");
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.263.0
|
2.169.0
|
||||||
|
|||||||
Reference in New Issue
Block a user