@@ -46,7 +46,7 @@ private static string runnerOfficialUrl(string runner_URL, string runner12_VERSI
46
46
return $ "{ runner_URL } /v{ runner12_VERSION } /runner-v{ runner12_VERSION } -{ os } -{ arch } .{ suffix } ";
47
47
}
48
48
49
- private static async Task DownloadTool ( string link , string destDirectory , CancellationToken token , string tarextraopts = "" , bool unwrap = false ) {
49
+ private static async Task DownloadTool ( Program . Parameters parameters , string link , string destDirectory , CancellationToken token , string tarextraopts = "" , bool unwrap = false ) {
50
50
Console . WriteLine ( $ "Downloading from { link } to { destDirectory } ") ;
51
51
string tempDirectory = Path . Combine ( GitHub . Runner . Sdk . GharunUtil . GetLocalStorage ( ) , "temp" + System . Guid . NewGuid ( ) . ToString ( ) ) ;
52
52
var stagingDirectory = Path . Combine ( tempDirectory , "_staging" ) ;
@@ -117,7 +117,7 @@ private static async Task DownloadTool(string link, string destDirectory, Cancel
117
117
string tar = WhichUtil . Which ( "tar" , require : true ) ;
118
118
119
119
// tar -xzf
120
- using ( var processInvoker = new ProcessInvoker ( new Program . TraceWriter ( ) ) )
120
+ using ( var processInvoker = new ProcessInvoker ( new Program . TraceWriter ( parameters ) ) )
121
121
{
122
122
processInvoker . OutputDataReceived += new EventHandler < ProcessDataReceivedEventArgs > ( ( sender , args ) =>
123
123
{
@@ -164,7 +164,7 @@ private static async Task DownloadTool(string link, string destDirectory, Cancel
164
164
IOUtil . DeleteDirectory ( tempDirectory , CancellationToken . None ) ;
165
165
}
166
166
}
167
- public static async Task < string > GetAgent ( string name , string version , CancellationToken token ) {
167
+ internal static async Task < string > GetAgent ( Program . Parameters parameters , string name , string version , CancellationToken token ) {
168
168
// Allow versions like v3.0.0 and not only 3.0.0
169
169
version = version . Substring ( version . IndexOf ( "v" ) + 1 ) ;
170
170
var azagent = name == "azagent" ;
@@ -180,14 +180,14 @@ public static async Task<string> GetAgent(string name, string version, Cancellat
180
180
// Note use the vsts package, because container operations have node6 hardcoded as trampoline
181
181
Func < string , string , string > AURL = azagent ? ( arch , ext ) => $ "https://vstsagentpackage.azureedge.net/agent/{ version } /vsts-agent-{ arch } -{ version } .{ ext } " : ( arch , ext ) => $ "https://github.com/actions/runner/releases/download/v{ version } /actions-runner-{ arch } -{ version } .{ ext } ";
182
182
var _tools = new Dictionary < string , Func < string , Task > > {
183
- { "windows/386" , dest => DownloadTool ( AURL ( "win-x86" , "zip" ) , dest , token , unwrap : false ) } ,
184
- { "windows/amd64" , dest => DownloadTool ( AURL ( "win-x64" , "zip" ) , dest , token , unwrap : false ) } ,
185
- { "windows/arm64" , dest => DownloadTool ( AURL ( "win-arm64" , "zip" ) , dest , token , unwrap : false ) } ,
186
- { "linux/amd64" , dest => DownloadTool ( AURL ( "linux-x64" , "tar.gz" ) , dest , token , unwrap : false ) } ,
187
- { "linux/arm" , dest => DownloadTool ( AURL ( "linux-arm" , "tar.gz" ) , dest , token , unwrap : false ) } ,
188
- { "linux/arm64" , dest => DownloadTool ( AURL ( "linux-arm64" , "tar.gz" ) , dest , token , unwrap : false ) } ,
189
- { "osx/amd64" , dest => DownloadTool ( AURL ( "osx-x64" , "tar.gz" ) , dest , token , unwrap : false ) } ,
190
- { "osx/arm64" , dest => DownloadTool ( AURL ( "osx-arm64" , "tar.gz" ) , dest , token , unwrap : false ) } ,
183
+ { "windows/386" , dest => DownloadTool ( parameters , AURL ( "win-x86" , "zip" ) , dest , token , unwrap : false ) } ,
184
+ { "windows/amd64" , dest => DownloadTool ( parameters , AURL ( "win-x64" , "zip" ) , dest , token , unwrap : false ) } ,
185
+ { "windows/arm64" , dest => DownloadTool ( parameters , AURL ( "win-arm64" , "zip" ) , dest , token , unwrap : false ) } ,
186
+ { "linux/amd64" , dest => DownloadTool ( parameters , AURL ( "linux-x64" , "tar.gz" ) , dest , token , unwrap : false ) } ,
187
+ { "linux/arm" , dest => DownloadTool ( parameters , AURL ( "linux-arm" , "tar.gz" ) , dest , token , unwrap : false ) } ,
188
+ { "linux/arm64" , dest => DownloadTool ( parameters , AURL ( "linux-arm64" , "tar.gz" ) , dest , token , unwrap : false ) } ,
189
+ { "osx/amd64" , dest => DownloadTool ( parameters , AURL ( "osx-x64" , "tar.gz" ) , dest , token , unwrap : false ) } ,
190
+ { "osx/arm64" , dest => DownloadTool ( parameters , AURL ( "osx-arm64" , "tar.gz" ) , dest , token , unwrap : false ) } ,
191
191
} ;
192
192
if ( _tools . TryGetValue ( platform , out Func < string , Task > download ) ) {
193
193
await download ( Path . Combine ( externalsPath , name , version ) ) ;
0 commit comments