@@ -289,7 +289,10 @@ private AuthConfig runCredentialProvider(String hostName, String helperOrStoreNa
289289 final String responseErrorMsg = data .getStdout ();
290290
291291 if (!StringUtils .isBlank (responseErrorMsg )) {
292- String credentialsNotFoundMsg = getGenericCredentialsNotFoundMsg (credentialProgramName );
292+ String credentialsNotFoundMsg = getGenericCredentialsNotFoundMsg (
293+ responseErrorMsg ,
294+ credentialProgramName
295+ );
293296 if (credentialsNotFoundMsg != null && credentialsNotFoundMsg .equals (responseErrorMsg )) {
294297 log .info (
295298 "Credential helper/store ({}) does not have credentials for {}" ,
@@ -346,48 +349,13 @@ private String effectiveRegistryName(DockerImageName dockerImageName) {
346349 );
347350 }
348351
349- private String getGenericCredentialsNotFoundMsg (String credentialHelperName ) {
352+ private String getGenericCredentialsNotFoundMsg (String credentialsNotFoundMsg , String credentialHelperName ) {
350353 if (!CREDENTIALS_HELPERS_NOT_FOUND_MESSAGE_CACHE .containsKey (credentialHelperName )) {
351- String credentialsNotFoundMsg = discoverCredentialsHelperNotFoundMessage (credentialHelperName );
352- if (!StringUtils .isBlank (credentialsNotFoundMsg )) {
353- CREDENTIALS_HELPERS_NOT_FOUND_MESSAGE_CACHE .put (credentialHelperName , credentialsNotFoundMsg );
354- }
354+ CREDENTIALS_HELPERS_NOT_FOUND_MESSAGE_CACHE .put (credentialHelperName , credentialsNotFoundMsg );
355355 }
356-
357356 return CREDENTIALS_HELPERS_NOT_FOUND_MESSAGE_CACHE .get (credentialHelperName );
358357 }
359358
360- private String discoverCredentialsHelperNotFoundMessage (String credentialHelperName ) {
361- // will do fake call to given credential helper to find out with which message
362- // it response when there are no credentials for given hostName
363-
364- // hostName should be valid, but most probably not existing
365- // IF its not enough, then should probably run 'list' command first to be sure...
366- final String notExistentFakeHostName = "https://not.a.real.registry/url" ;
367-
368- String credentialsNotFoundMsg = null ;
369- try {
370- CredentialOutput data = runCredentialProgram (notExistentFakeHostName , credentialHelperName );
371-
372- if (data .getStdout () != null && !data .getStdout ().isEmpty ()) {
373- credentialsNotFoundMsg = data .getStdout ();
374-
375- log .debug (
376- "Got credentials not found error message from docker credential helper - {}" ,
377- credentialsNotFoundMsg
378- );
379- }
380- } catch (Exception e ) {
381- log .warn (
382- "Failure running docker credential helper ({}) with fake call, expected 'credentials not found' response. Exception message: {}" ,
383- credentialHelperName ,
384- e .getMessage ()
385- );
386- }
387-
388- return credentialsNotFoundMsg ;
389- }
390-
391359 private CredentialOutput runCredentialProgram (String hostName , String credentialHelperName )
392360 throws InterruptedException , TimeoutException , IOException {
393361 String [] command = SystemUtils .IS_OS_WINDOWS
0 commit comments