1
resposta

Integração Jenkins e Android

Olá pessoal,

Estou tendo um grande problema na geração de uma build para o android usando jenkins. Na empresa em que trabalho temos um firewall com autenticação. Quando executo o meu pipeline estou recebendo o erro abaixo:

java.net.SocketTimeoutException: connect timed out
    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:589)
    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
    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:1138)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
    at hudson.FilePath.installIfNecessaryFrom(FilePath.java:777)
Caused: java.io.IOException: Failed to install https://services.gradle.org/distributions/gradle-4.2-bin.zip to /var/lib/jenkins/tools/hudson.plugins.gradle.GradleInstallation/GRADLE-4.2
    at hudson.FilePath.installIfNecessaryFrom(FilePath.java:856)
    at hudson.FilePath.installIfNecessaryFrom(FilePath.java:764)
    at hudson.tools.DownloadFromUrlInstaller.performInstallation(DownloadFromUrlInstaller.java:77)
    at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:72)
    at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
    at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
    at hudson.plugins.gradle.GradleInstallation.forNode(GradleInstallation.java:94)
    at hudson.plugins.gradle.GradleInstallation.forNode(GradleInstallation.java:31)
    at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:152)
    at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
    at hudson.security.ACL.impersonate(ACL.java:260)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
    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)
Finished: FAILURE

Aqui está o meu pipeline:

node {
  stage('setup') {
    echo "Setup Stage"  
  }
    stage('checkout') {
    git 'https://github.com/cesarsturion/calculadora.git'
  }
  stage('build') {
    //def GRADLE_HOME = tool name: 'GRADLE-4.2', type: 'hudson.plugins.gradle.GradleInstallation'
    def GRADLE_HOME = tool name: 'GRADLE-4.2'
    echo "Instalando o gradle"
    sh "${GRADLE_HOME}/bin/gradle tasks"
  }
}

No Jenkins o gradle 4.2 foi instalado por default. Em ~/.gradle/gradle.properties está:

systemProp.http.proxyHost=proxy.minhaempresa.rede
systemProp.http.proxyPort=3128
systemProp.http.proxyUser=domain/csturion
systemProp.http.proxyPassword=senha123
systemProp.https.proxyHost=proxy.minhaempresa.rede
systemProp.https.proxyPort=3128
systemProp.https.proxyUser=domain/csturion
systemProp.https.proxyPassword=senha123

Em Manage Jenkins -> Configure System tenho duas váriaveis de ambiente:

ANDROID_HOME = /opt/android-sdk-linux
GRADLE_OPTS = -Dorg.gradle.daemon=true -Dhttps.proxyHost=proxy.minhaempresa.rede -Dhttps.proxyPort=3128 -Dhttps.proxyUser=csturion -Dhttps.proxyPassword='senha123' -Dhttp.proxyHost=proxy.minhaempresa.rede -Dhttp.proxyPort=3128 -Dhttp.proxyUser=csturion -Dhttp.proxyPassword='senha123'

Alguém pode me ajudar onde estou errando? Ou se falta mais algum lugar para configurar?

1 resposta

Oi Cesar, tudo bem ?

Cara acho que ninguém na plataforma mexeu com isso, ainda.

O que posso tentar fazer é começar a estudar para tentar te ajudar com isso, mas posso demorar um pouco para chegar no mesmo nível :(