@@ -7,6 +7,7 @@ import { pki } from "node-forge";
7
7
8
8
import * as actionsUtil from "./actions-util" ;
9
9
import * as util from "./util" ;
10
+ import { getActionsLogger , Logger } from "./logging" ;
10
11
11
12
const UPDATEJOB_PROXY = "update-job-proxy" ;
12
13
const UPDATEJOB_PROXY_VERSION = "v2.0.20240722180912" ;
@@ -89,13 +90,17 @@ function generateCertificateAuthority(): CertificateAuthority {
89
90
}
90
91
91
92
async function runWrapper ( ) {
92
- // Setup logging
93
+ const logger = getActionsLogger ( ) ;
94
+
95
+ // Setup logging for the proxy
93
96
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 ) ;
96
99
97
100
// Get the configuration options
98
101
const credentials = getCredentials ( ) ;
102
+ logger . debug ( `Credentials loaded for the following URLs:\n ${ credentials . map ( c => c . host ) . join ( "\n" ) } ` )
103
+
99
104
const ca = generateCertificateAuthority ( ) ;
100
105
const proxyAuth = getProxyAuth ( ) ;
101
106
@@ -107,10 +112,10 @@ async function runWrapper() {
107
112
108
113
// Start the Proxy
109
114
const proxyBin = await getProxyBinaryPath ( ) ;
110
- await startProxy ( proxyBin , proxyConfig , logFilePath ) ;
115
+ await startProxy ( proxyBin , proxyConfig , proxyLogFilePath , logger ) ;
111
116
}
112
117
113
- async function startProxy ( binPath : string , config : ProxyConfig , logFilePath : string ) {
118
+ async function startProxy ( binPath : string , config : ProxyConfig , logFilePath : string , logger : Logger ) {
114
119
const host = "127.0.0.1" ;
115
120
let port = 49152 ;
116
121
try {
@@ -148,7 +153,7 @@ async function startProxy(binPath: string, config: ProxyConfig, logFilePath: str
148
153
if ( subprocessError ) {
149
154
throw subprocessError ;
150
155
}
151
- core . info ( `Proxy started on ${ host } :${ port } ` ) ;
156
+ logger . info ( `Proxy started on ${ host } :${ port } ` ) ;
152
157
core . setOutput ( "proxy_host" , host ) ;
153
158
core . setOutput ( "proxy_port" , port . toString ( ) ) ;
154
159
core . setOutput ( "proxy_ca_certificate" , config . ca . cert ) ;
@@ -165,7 +170,6 @@ async function startProxy(binPath: string, config: ProxyConfig, logFilePath: str
165
170
function getCredentials ( ) : Credential [ ] {
166
171
const encodedCredentials = actionsUtil . getOptionalInput ( "registries_credentials" ) ;
167
172
if ( encodedCredentials !== undefined ) {
168
- core . info ( `Using encoded credentials.` ) ;
169
173
const credentialsStr = Buffer . from ( encodedCredentials , "base64" ) . toString ( ) ;
170
174
return JSON . parse ( credentialsStr ) as Credential [ ] ;
171
175
}
0 commit comments