@@ -7,6 +7,7 @@ import { pki } from "node-forge";
77
88import * as actionsUtil from "./actions-util" ;
99import * as util from "./util" ;
10+ import { getActionsLogger , Logger } from "./logging" ;
1011
1112const UPDATEJOB_PROXY = "update-job-proxy" ;
1213const UPDATEJOB_PROXY_VERSION = "v2.0.20240722180912" ;
@@ -89,13 +90,17 @@ function generateCertificateAuthority(): CertificateAuthority {
8990}
9091
9192async function runWrapper ( ) {
92- // Setup logging
93+ const logger = getActionsLogger ( ) ;
94+
95+ // Setup logging for the proxy
9396 const tempDir = actionsUtil . getTemporaryDirectory ( ) ;
94- const logFilePath = path . resolve ( tempDir , "proxy.log" ) ;
95- core . saveState ( "proxy-log-file" , logFilePath ) ;
97+ const proxyLogFilePath = path . resolve ( tempDir , "proxy.log" ) ;
98+ core . saveState ( "proxy-log-file" , proxyLogFilePath ) ;
9699
97100 // Get the configuration options
98101 const credentials = getCredentials ( ) ;
102+ logger . debug ( `Credentials loaded for the following URLs:\n ${ credentials . map ( c => c . host ) . join ( "\n" ) } ` )
103+
99104 const ca = generateCertificateAuthority ( ) ;
100105 const proxyAuth = getProxyAuth ( ) ;
101106
@@ -107,10 +112,10 @@ async function runWrapper() {
107112
108113 // Start the Proxy
109114 const proxyBin = await getProxyBinaryPath ( ) ;
110- await startProxy ( proxyBin , proxyConfig , logFilePath ) ;
115+ await startProxy ( proxyBin , proxyConfig , proxyLogFilePath , logger ) ;
111116}
112117
113- async function startProxy ( binPath : string , config : ProxyConfig , logFilePath : string ) {
118+ async function startProxy ( binPath : string , config : ProxyConfig , logFilePath : string , logger : Logger ) {
114119 const host = "127.0.0.1" ;
115120 let port = 49152 ;
116121 try {
@@ -148,7 +153,7 @@ async function startProxy(binPath: string, config: ProxyConfig, logFilePath: str
148153 if ( subprocessError ) {
149154 throw subprocessError ;
150155 }
151- core . info ( `Proxy started on ${ host } :${ port } ` ) ;
156+ logger . info ( `Proxy started on ${ host } :${ port } ` ) ;
152157 core . setOutput ( "proxy_host" , host ) ;
153158 core . setOutput ( "proxy_port" , port . toString ( ) ) ;
154159 core . setOutput ( "proxy_ca_certificate" , config . ca . cert ) ;
@@ -165,7 +170,6 @@ async function startProxy(binPath: string, config: ProxyConfig, logFilePath: str
165170function getCredentials ( ) : Credential [ ] {
166171 const encodedCredentials = actionsUtil . getOptionalInput ( "registries_credentials" ) ;
167172 if ( encodedCredentials !== undefined ) {
168- core . info ( `Using encoded credentials.` ) ;
169173 const credentialsStr = Buffer . from ( encodedCredentials , "base64" ) . toString ( ) ;
170174 return JSON . parse ( credentialsStr ) as Credential [ ] ;
171175 }
0 commit comments