Can't upload APK to Play - EphemeralCredentialsException > GeneralSecurityException > ConnectException

XMLWordPrintable

      I use 2 jenkins.
      In old Jenkins plugin works as expected.
      In new Jenkins with "the same" setup (currently I am not aware of any possibly relevant difference) I always get the below exception:

      Upload failed: org.jenkinsci.plugins.googleplayandroidpublisher.EphemeralCredentialsException: Failed to validate Google Service Account credential against the Google API servers. Check internet connectivity on the Jenkins server and try again.
        	at org.jenkinsci.plugins.googleplayandroidpublisher.CredentialsHandler.getServiceAccountCredentials(CredentialsHandler.java:61)
        	at org.jenkinsci.plugins.googleplayandroidpublisher.ApkPublisher.publishApk(ApkPublisher.java:463)
        	at org.jenkinsci.plugins.googleplayandroidpublisher.ApkPublisher.perform(ApkPublisher.java:267)
        	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
        	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
        	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
        	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        	at java.lang.Thread.run(Thread.java:748)
        Caused by: java.security.GeneralSecurityException: Unable to retrieve an access token with the provided credentials
        	at com.google.jenkins.plugins.credentials.oauth.RemotableGoogleCredentials.<init>(RemotableGoogleCredentials.java:65)
        	at com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials.forRemote(GoogleRobotCredentials.java:172)
        	at org.jenkinsci.plugins.googleplayandroidpublisher.CredentialsHandler.getServiceAccountCredentials(CredentialsHandler.java:40)
        	... 10 more
        Caused by: java.net.ConnectException: Connection refused (Connection refused)
        	at java.net.PlainSocketImpl.socketConnect(Native Method)
        	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        	at java.net.Socket.connect(Socket.java:607)
        	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:681)
        	at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
        	at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
        	at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
        	at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        	at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
        	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
        	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1340)
        	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1315)
        	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:264)
        	at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:77)
        	at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:972)
        	at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:283)
        	at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307)
        	at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:394)
        	at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:493)
        	at com.google.jenkins.plugins.credentials.oauth.RemotableGoogleCredentials.<init>(RemotableGoogleCredentials.java:60)
        	... 12 more
      

      Any idea where should I look into for the fix?

      I am using the same pipeline step in both places and the same credentials:

      androidApkUpload apkFilesPattern: 'some.apk', googleCredentialsId: 'some_creds', trackName: 'internal'
      

      Step is executed on the same nodes in both Jenkins but always fail only in new Jenkins. All nodes have connectivity.
      Using Google Play Android Publisher v3.0 plugin.

            Assignee:
            Christopher Orr
            Reporter:
            Dragan Marjanovic
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: