Skip to content

Commit

Permalink
Runner cleanup - continuation (actions#209)
Browse files Browse the repository at this point in the history
* Agent/AgentCredential -> Runner/RunnerCredential
* Test trait rename: Agent -> Runner
* Enable remaining RunnerL0 tests
* Remove job message PII variable masking code
* Remove unused Agent.ToolsDirectory variable
* Misc test Agent -> Runner renaming
* Some more misc cleaning
  • Loading branch information
juliobbv authored Dec 9, 2019
1 parent 3ed80b7 commit 275ab75
Show file tree
Hide file tree
Showing 16 changed files with 583 additions and 859 deletions.
8 changes: 0 additions & 8 deletions src/Runner.Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,6 @@ public static class Actions
public static readonly string StepDebug = "ACTIONS_STEP_DEBUG";
}

public static class Agent
{
//
// Keep alphabetical
//
public static readonly string ToolsDirectory = "agent.ToolsDirectory";
}

public static class System
{
//
Expand Down
19 changes: 0 additions & 19 deletions src/Runner.Listener/Agent.cs → src/Runner.Listener/Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,25 +190,6 @@ public async Task<int> ExecuteCommand(CommandSettings command)
}
}

#if !OS_WINDOWS
// Fix the work folder setting on Linux
if (settings.WorkFolder.Contains("vsts", StringComparison.OrdinalIgnoreCase))
{
var workFolder = "/runner/work";
var unix = HostContext.GetService<IUnixUtil>();

// create new work folder /runner/work
await unix.ExecAsync(HostContext.GetDirectory(WellKnownDirectory.Root), "sh", $"-c \"sudo mkdir -p {workFolder}\"");

// fix permission
await unix.ExecAsync(HostContext.GetDirectory(WellKnownDirectory.Root), "sh", $"-c \"sudo chown -R $USER {workFolder}\"");

// update settings
settings.WorkFolder = workFolder;
store.SaveSettings(settings);
}
#endif

Trace.Info($"Set runner startup type - {startType}");
HostContext.StartupType = startType;

Expand Down
30 changes: 0 additions & 30 deletions src/Runner.Worker/Variables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,36 +75,6 @@ public Variables(IHostContext hostContext, IDictionary<string, VariableValue> co

public string System_PhaseDisplayName => Get(Constants.Variables.System.PhaseDisplayName);

public string System_TFCollectionUrl => Get(WellKnownDistributedTaskVariables.TFCollectionUrl);

public static readonly HashSet<string> PiiVariables = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"Build.AuthorizeAs",
"Build.QueuedBy",
"Build.RequestedFor",
"Build.RequestedForEmail",
"Build.SourceBranch",
"Build.SourceBranchName",
"Build.SourceTfvcShelveset",
"Build.SourceVersion",
"Build.SourceVersionAuthor",
"Job.AuthorizeAs",
"Release.Deployment.RequestedFor",
"Release.Deployment.RequestedForEmail",
"Release.RequestedFor",
"Release.RequestedForEmail",
};

public static readonly string PiiArtifactVariablePrefix = "Release.Artifacts";

public static readonly List<string> PiiArtifactVariableSuffixes = new List<string>()
{
"SourceBranch",
"SourceBranchName",
"SourceVersion",
"RequestedFor"
};

public string Get(string name)
{
Variable variable;
Expand Down
2 changes: 1 addition & 1 deletion src/Runner.Worker/Worker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public async Task<int> RunAsync(string pipeIn, string pipeOut)
SetCulture(jobMessage);

// Start the job.
Trace.Info($"Job message:{Environment.NewLine} {StringUtil.ConvertToJson(WorkerUtilities.ScrubPiiData(jobMessage))}");
Trace.Info($"Job message:{Environment.NewLine} {StringUtil.ConvertToJson(jobMessage)}");
Task<TaskResult> jobRunnerTask = jobRunner.RunAsync(jobMessage, jobRequestCancellationToken.Token);

// Start listening for a cancel message from the channel.
Expand Down
92 changes: 0 additions & 92 deletions src/Runner.Worker/WorkerUtilties.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Test/L0/ConstantGenerationL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public sealed class ConstantGenerationL0
{
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Agent")]
[Trait("Category", "Runner")]
public void BuildConstantGenerateSucceed()
{
List<string> validPackageNames = new List<string>()
Expand Down
4 changes: 2 additions & 2 deletions src/Test/L0/DotnetsdkDownloadScriptL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public sealed class DotnetsdkDownloadScriptL0
{
[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Agent")]
[Trait("Category", "Runner")]
public async Task EnsureDotnetsdkBashDownloadScriptUpToDate()
{
string shDownloadUrl = "https://dot.net/v1/dotnet-install.sh";
Expand All @@ -33,7 +33,7 @@ public async Task EnsureDotnetsdkBashDownloadScriptUpToDate()

[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Agent")]
[Trait("Category", "Runner")]
public async Task EnsureDotnetsdkPowershellDownloadScriptUpToDate()
{
string ps1DownloadUrl = "https://dot.net/v1/dotnet-install.ps1";
Expand Down
Loading

0 comments on commit 275ab75

Please sign in to comment.