Tenho um problema ao enviar a notificação do job no trabalho, aqui utilizo a VPN e firewall da empresa. O Job foi executado com sucesso e é possível verificar no log que o conector foi ativado, mas a notificação não é enviada.
Se eu enviar uma mensagem por curl manual ele funciona corretamente
script {
final String url = "webhook"
final String response = sh(script: "curl -X POST -H 'Content-type:application/json' --data '{\"text\":\"Message sent by jenkins\"}' webhook", returnStdout: true).trim()
echo response
}
Mas de forma automatizada pelo Jenkins não está funcionando
Segue a parte do pipeline do Office 365
post {
failure {
office365ConnectorSend webhookUrl: "$WEB_HOOK_URL",
factDefinitions: [[name: "message", template: "Falha: Deploy em $DEPLOY_STAGE de $REPO"],
[name: "status", template: "Falha"]],
color: "#FF0000",
status: "Failure"
sh("curl -v --location --request POST '$WEB_HOOK_URL' --header 'Content-Type: application/json' --data-raw '{\"@type\": \"MessageCard\",\"@context\": \"http://schema.org/extensions\",\"themeColor\": \"#FF0000\",\"summary\": \"Teste de Mensagens EndPoint Jenkins\",\"sections\": [{\"activityTitle\": \"Jenkins avisa!\",\"activitySubtitle\": \"Resultado do build\",\"activityImage\": \"https://ac-buckets-dev-acpublicmedia-2cxkd4j0deg1.s3.amazonaws.com/icons/RedDownArrow.png\",\"facts\": [{\"name\": \"Message\",\"value\": \"FALHA: Deploy em $DEPLOY_STAGE de $REPO\"}, {\"name\": \"Status\",\"value\": \"Failure\"},{\"name\": \"Job\",\"value\": \"${JOB_NAME}:${BUILD_NUMBER}\"}],\"markdown\": true}],\"potentialAction\": [{\"@type\": \"OpenUri\",\"name\": \"Abrir Build\",\"targets\": [{ \"os\": \"default\", \"uri\": \"${BUILD_URL}\" }]}]}'")
}
success {
office365ConnectorSend webhookUrl: "$WEB_HOOK_URL",
factDefinitions: [[name: "message", template: "Sucess: Deploy em $DEPLOY_STAGE de $REPO"],
[name: "status", template: "Sucesso"]],
color: "#00FF00",
status: "Success"
sh("curl -v --location --request POST '$WEB_HOOK_URL' --header 'Content-Type: application/json' --data-raw '{\"@type\": \"MessageCard\",\"@context\": \"http://schema.org/extensions\",\"themeColor\": \"#00FF00\",\"summary\": \"Teste de Mensagens EndPoint Jenkins\",\"sections\": [{\"activityTitle\": \"Jenkins avisa!\",\"activitySubtitle\": \"Resultado do build\",\"activityImage\": \"https://ac-buckets-dev-acpublicmedia-2cxkd4j0deg1.s3.amazonaws.com/icons/GreenThumbUP.png\",\"facts\": [{\"name\": \"Message\",\"value\": \"Sucesso: Deploy em $DEPLOY_STAGE de $REPO\"}, {\"name\": \"Status\",\"value\": \"Success\"},{\"name\": \"Job\",\"value\": \"${JOB_NAME}:${BUILD_NUMBER}\"}],\"markdown\": true}],\"potentialAction\": [{\"@type\": \"OpenUri\",\"name\": \"Abrir Build\",\"targets\": [{ \"os\": \"default\", \"uri\": \"${BUILD_URL}\" }]}]}'")
}
}
Logs:
[Office365connector] Failed to post data to webhook - webhook
javax.net.ssl.SSLException: hostname in certificate didn't match: <> != </*.clo.footprintdns.com/*.hotmail.com/*.internal.outlook.com/*.live.com/*.nrb.footprintdns.com/*.office.com/*.office365.com/*.outlook.com/*.outlook.office365.com/attachment.outlook.live.net/attachment.outlook.office.net/attachment.outlook.officeppe.net/attachments.office.net/attachments-sdf.office.net/ccs.login.microsoftonline.com/ccs-sdf.login.microsoftonline.com/hotmail.com/mail.services.live.com/office365.com/outlook.com/outlook.office.com/substrate.office.com/substrate-sdf.office.com/outlook.com>
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.verifyHostName(SSLProtocolSocketFactory.java:339)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.verifyHostName(SSLProtocolSocketFactory.java:275)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.verifyHostName(SSLProtocolSocketFactory.java:258)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:167)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:714)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:394)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:178)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:404)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:330)
at jenkins.plugins.office365connector.HttpWorker.run(HttpWorker.java:83)
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:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Como posso resolver este problema ?