Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle SelfUpdate Flow when Package is provided in Message #2926

Merged
merged 34 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5914c1f
wip
luketomlinson Oct 12, 2023
50037b7
wip fork selfupdater
luketomlinson Oct 12, 2023
10a2768
wip
luketomlinson Oct 12, 2023
69e0707
working
luketomlinson Oct 13, 2023
5b58e67
wip l0
luketomlinson Oct 13, 2023
bca63dc
Add back another test
luketomlinson Oct 13, 2023
3fa3934
Add back another test
luketomlinson Oct 13, 2023
0d8ee42
revert runnerversion changes
luketomlinson Oct 13, 2023
5114f75
format
luketomlinson Oct 16, 2023
9774819
more formatting
luketomlinson Oct 16, 2023
19dae98
whitespace
luketomlinson Oct 16, 2023
1836e5c
pr feedback
luketomlinson Oct 17, 2023
1ab0621
fix test
luketomlinson Oct 17, 2023
54e80cc
Simplify and use RunnerRefreshMessage
luketomlinson Nov 1, 2023
95875b1
.
luketomlinson Nov 1, 2023
76c5c6e
format
luketomlinson Nov 1, 2023
73a9274
fix tests
luketomlinson Nov 1, 2023
9e7d45b
fix
luketomlinson Nov 3, 2023
0e5052e
feedback
luketomlinson Nov 3, 2023
607a26a
format
luketomlinson Nov 3, 2023
b61c5ea
.
luketomlinson Nov 3, 2023
d5c084c
.
luketomlinson Nov 3, 2023
87f8cb3
feedback
luketomlinson Nov 3, 2023
09a228a
format
luketomlinson Nov 3, 2023
7249c05
.
luketomlinson Nov 3, 2023
73d9aa7
cleanup
luketomlinson Nov 3, 2023
2dd14e9
cleanup
luketomlinson Nov 7, 2023
efbbfda
fix field names
luketomlinson Nov 13, 2023
0cfe109
pr feedback
luketomlinson Nov 13, 2023
457cc22
feedback
luketomlinson Nov 13, 2023
673f9d9
delete dead code
luketomlinson Nov 13, 2023
ff87f73
.
luketomlinson Nov 13, 2023
8b0d538
fix debug condition
luketomlinson Nov 13, 2023
2be4992
Merge branch 'main' into new-update-flow
luketomlinson Nov 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix field names
  • Loading branch information
luketomlinson committed Nov 13, 2023
commit efbbfda27a41496d2b4bb835736e3e80dbc3e554
4 changes: 2 additions & 2 deletions src/Runner.Listener/SelfUpdaterV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ public async Task<bool> SelfUpdate(RunnerRefreshMessage updateMessage, IJobDispa
var totalUpdateTime = Stopwatch.StartNew();

Trace.Info($"An update is available.");
_updateTrace.Enqueue($"RunnerPlatform: {updateMessage.Platform}");
_updateTrace.Enqueue($"RunnerPlatform: {updateMessage.OS}");

// Print console line that warn user not shutdown runner.
_terminal.WriteLine("Runner update in progress, do not shutdown runner.");
_terminal.WriteLine($"Downloading {updateMessage.TargetVersion} runner");

await DownloadLatestRunner(token, updateMessage.TargetVersion, updateMessage.DownloadUrl, updateMessage.HashValue, updateMessage.Platform);
await DownloadLatestRunner(token, updateMessage.TargetVersion, updateMessage.DownloadUrl, updateMessage.SHA256Checksum, updateMessage.OS);
Trace.Info($"Download latest runner and unzip into runner root.");

// wait till all running job finish
Expand Down
4 changes: 2 additions & 2 deletions src/Sdk/DTWebApi/WebApi/RunnerRefreshMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public string DownloadUrl
}

[DataMember(Name = "sha256_checksum")]
public string HashValue
public string SHA256Checksum
{
get;
set;
}

[DataMember(Name = "os")]
public string Platform
public string OS
{
get;
set;
Expand Down
8 changes: 4 additions & 4 deletions src/Test/L0/Listener/SelfUpdaterV2L0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public async void TestSelfUpdateAsync()
var message = new RunnerRefreshMessage()
{
TargetVersion = "2.999.0",
Platform = BuildConstants.RunnerPackage.PackageName,
OS = BuildConstants.RunnerPackage.PackageName,
DownloadUrl = _packageUrl

};
Expand Down Expand Up @@ -171,7 +171,7 @@ public async void TestSelfUpdateAsync_DownloadRetry()
var message = new RunnerRefreshMessage()
{
TargetVersion = "2.999.0",
Platform = BuildConstants.RunnerPackage.PackageName,
OS = BuildConstants.RunnerPackage.PackageName,
DownloadUrl = "https://github.com/actions/runner/notexists"
};

Expand Down Expand Up @@ -222,9 +222,9 @@ public async void TestSelfUpdateAsync_ValidateHash()
var message = new RunnerRefreshMessage()
{
TargetVersion = "2.999.0",
Platform = BuildConstants.RunnerPackage.PackageName,
OS = BuildConstants.RunnerPackage.PackageName,
DownloadUrl = _packageUrl,
HashValue = "badhash"
SHA256Checksum = "badhash"
};

var ex = await Assert.ThrowsAsync<Exception>(() => updater.SelfUpdate(message, _jobDispatcher.Object, true, hc.RunnerShutdownToken));
Expand Down
Loading