| 1250 | } |
| 1251 | |
| 1252 | private async validateCiDependencyProxyServerAuthentication (imageName: string) { |
| 1253 | const CI_DEPENDENCY_PROXY_SERVER = this._variables["CI_DEPENDENCY_PROXY_SERVER"]; |
| 1254 | if (!imageName.startsWith(CI_DEPENDENCY_PROXY_SERVER)) { |
| 1255 | return; |
| 1256 | } |
| 1257 | try { |
| 1258 | await Utils.spawn([this.argv.containerExecutable, "login", CI_DEPENDENCY_PROXY_SERVER]); |
| 1259 | } catch (e: any) { |
| 1260 | const errMsg = `Please authenticate to the Dependency Proxy (${CI_DEPENDENCY_PROXY_SERVER}) https://docs.gitlab.com/ee/user/packages/dependency_proxy/#authenticate-with-the-dependency-proxy`; |
| 1261 | if (this.argv.containerExecutable == "docker") { |
| 1262 | assert(!e.stderr.includes("Cannot perform an interactive login"), errMsg); |
| 1263 | } else if (this.argv.containerExecutable == "podman") { |
| 1264 | assert(!e.stderr.includes("Username: Error: getting username and password: reading username: EOF"), errMsg); |
| 1265 | } |
| 1266 | throw e; |
| 1267 | } |
| 1268 | } |
| 1269 | |
| 1270 | private async pullImage (writeStreams: WriteStreams, imageToPull: string, imagePlatform: string | null = null) { |
| 1271 | const pullPolicy = this.argv.pullPolicy; |