Skip to content

Commit

Permalink
Calculate docker instance label based on the hash of the config (#2683)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-jokic authored Sep 18, 2023
1 parent 2908d82 commit 16834ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Runner.Worker/Container/DockerCommandManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
Expand Down Expand Up @@ -46,7 +47,9 @@ public override void Initialize(IHostContext hostContext)
{
base.Initialize(hostContext);
DockerPath = WhichUtil.Which("docker", true, Trace);
DockerInstanceLabel = IOUtil.GetSha256Hash(hostContext.GetDirectory(WellKnownDirectory.Root)).Substring(0, 6);
string path = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Root), ".runner");
string json = File.ReadAllText(path, Encoding.UTF8);
DockerInstanceLabel = IOUtil.GetSha256Hash(json).Substring(0, 6);
}

public async Task<DockerVersion> DockerVersion(IExecutionContext context)
Expand Down

0 comments on commit 16834ed

Please sign in to comment.