-
Notifications
You must be signed in to change notification settings - Fork 25
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
[151] Runner executor #404
Merged
Merged
Changes from all commits
Commits
Show all changes
83 commits
Select commit
Hold shift + click to select a range
1e625a3
initial commit
giventocode b549b02
initial implementation
giventocode 0992248
test refactoring
giventocode 6ede9ab
test cleanup and initial basic implementation
giventocode 092ff37
mrege and refactoring
giventocode feef1e4
enable runner execution
giventocode a630114
script changes
giventocode 49ff02c
fixed image tag setting
giventocode d2f2e78
escaping fixes
giventocode 22fbf8e
node task converter refactoring
giventocode 4fcf692
converter refactoring
giventocode e6baefb
test refactoring
giventocode 09985da
node execution command.
giventocode 31347c1
refactoring and wget line fixes
giventocode 96e8db0
add script ending and test
giventocode d9a0a04
logging updates
giventocode be60f8f
Merge branch 'ja-nodetask-builder' of https://github.com/microsoft/ga…
giventocode 3cc4ccc
updated metrics nmae
giventocode 3892a09
run command fixes.
giventocode 3fefd2a
additional tests, formatting and refactoring
giventocode 35900c2
refactoring and additional tests
giventocode 15ce271
pr feedback
giventocode 24ccc91
test fixes
giventocode 6c3d171
Update Azure.Identity, Azure.Core, and Microsoft.Azure.Batch nuget pa…
MattMcL4475 a8971f6
Use Storage Blob Data Contributor instead of Reader
MattMcL4475 950b304
handle external storage accounts
giventocode d7c7493
arm strategy skips urls with sas tokens
giventocode 650163d
enabling setting the client id for mi
giventocode 26f8605
Merge branch 'ja-nodetask-builder' of https://github.com/microsoft/ga…
giventocode ff72ece
merge fix
giventocode fbc2602
resourceid for mi, and digest image name
giventocode 0406f64
pull retries and uses global identity as fallback
giventocode 80a1435
logging statements
giventocode 18fb6f3
join fix
giventocode 4ba6ae3
creds manager with retries
giventocode 36d03c5
uploads tes task
giventocode ab01511
test fixes
giventocode b58532e
external accounts as local paths
giventocode 1a90a36
formatting
giventocode 9148ff8
multiplexed stream reading
giventocode 6ffdbcf
code clean up
giventocode f2db9df
initial commit
giventocode 71a2b87
initial implementation
giventocode 11e00b0
test refactoring
giventocode 46ff703
test cleanup and initial basic implementation
giventocode 75c3a35
mrege and refactoring
giventocode 97fa979
enable runner execution
giventocode 6ddf722
script changes
giventocode 5c6e166
fixed image tag setting
giventocode d877176
escaping fixes
giventocode e6ce03e
node task converter refactoring
giventocode 85439a0
converter refactoring
giventocode 4be59a2
test refactoring
giventocode b512de5
node execution command.
giventocode d6d87ec
logging updates
giventocode a77791b
refactoring and wget line fixes
giventocode 1238315
add script ending and test
giventocode 6f55577
updated metrics nmae
giventocode 827fc57
run command fixes.
giventocode a3282f1
additional tests, formatting and refactoring
giventocode fb46a4b
refactoring and additional tests
giventocode 8b9c520
pr feedback
giventocode e3404e9
test fixes
giventocode 6a79134
enabling setting the client id for mi
giventocode eb92c69
Update Azure.Identity, Azure.Core, and Microsoft.Azure.Batch nuget pa…
MattMcL4475 a8244f7
Use Storage Blob Data Contributor instead of Reader
MattMcL4475 fbd86e0
handle external storage accounts
giventocode 4138391
arm strategy skips urls with sas tokens
giventocode cbc2a3c
merge fix
giventocode 42c7ffa
resourceid for mi, and digest image name
giventocode 8dd7898
pull retries and uses global identity as fallback
giventocode ea082cf
logging statements
giventocode 8222077
join fix
giventocode 29f5f3e
creds manager with retries
giventocode fe4ec37
uploads tes task
giventocode 1e4721f
test fixes
giventocode 3cd6c80
external accounts as local paths
giventocode 9ddcc39
formatting
giventocode abf1438
multiplexed stream reading
giventocode 0aca93c
code clean up
giventocode 760348a
merge fixes
giventocode 0980bf9
Merge branch 'ja-nodetask-builder' of https://github.com/microsoft/ga…
giventocode 5c92fe4
Merge commit 'e1ae065f0ea6fe998f8b3f18599abb22b76b3e2b' into ja-nodet…
giventocode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Azure.Core; | ||
using Azure.Identity; | ||
using Microsoft.Extensions.Logging; | ||
using Polly; | ||
using Polly.Retry; | ||
using Tes.Runner.Models; | ||
using Tes.Runner.Transfer; | ||
|
||
namespace Tes.Runner.Authentication | ||
{ | ||
public class CredentialsManager | ||
{ | ||
private readonly ILogger logger = PipelineLoggerFactory.Create<CredentialsManager>(); | ||
|
||
private readonly RetryPolicy retryPolicy; | ||
private const int MaxRetryCount = 5; | ||
private const int ExponentialBackOffExponent = 2; | ||
|
||
public CredentialsManager() | ||
{ | ||
retryPolicy = Policy | ||
.Handle<Exception>() | ||
.WaitAndRetry(MaxRetryCount, | ||
SleepDurationHandler); | ||
} | ||
|
||
private TimeSpan SleepDurationHandler(int attempt) | ||
{ | ||
logger.LogInformation($"Attempt {attempt} to get token credential"); | ||
var duration = TimeSpan.FromSeconds(Math.Pow(ExponentialBackOffExponent, attempt)); | ||
logger.LogInformation($"Waiting {duration} before retrying"); | ||
return duration; | ||
} | ||
|
||
public TokenCredential GetTokenCredential(RuntimeOptions runtimeOptions) | ||
{ | ||
return retryPolicy.Execute(() => GetTokenCredentialImpl(runtimeOptions)); | ||
} | ||
private TokenCredential GetTokenCredentialImpl(RuntimeOptions runtimeOptions) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need a blank line here |
||
{ | ||
try | ||
{ | ||
if (!string.IsNullOrWhiteSpace(runtimeOptions.NodeManagedIdentityResourceId)) | ||
{ | ||
logger.LogInformation($"Token credentials with Managed Identity and resource ID: {runtimeOptions.NodeManagedIdentityResourceId}"); | ||
|
||
return new ManagedIdentityCredential(new ResourceIdentifier(runtimeOptions.NodeManagedIdentityResourceId)); | ||
} | ||
|
||
logger.LogInformation("Token credentials with DefaultAzureCredential"); | ||
|
||
return new DefaultAzureCredential(); | ||
} | ||
catch (Exception e) | ||
{ | ||
logger.LogError(e, "Failed to get token credential"); | ||
throw; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace Tes.Runner.Docker; | ||
|
||
public class ConsoleStreamLogReader : MultiplexedStreamLogReader | ||
{ | ||
|
||
public ConsoleStreamLogReader() | ||
{ | ||
|
||
} | ||
|
||
public override Task AppendStandardOutputAsync(string data) | ||
{ | ||
Console.Write(data); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public override Task AppendStandardErrAsync(string data) | ||
{ | ||
Console.Write(data); | ||
return Task.CompletedTask; | ||
} | ||
|
||
public override void OnComplete(Exception? err) | ||
{ | ||
if (err != null) | ||
{ | ||
Console.Write(err.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is no longer used, please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have been line 48