Open yahiaghosheh opened 1 year ago
Describe el error
Actualmente, el uso del complemento Jfrog en Jenkins junto con Jfrog CLI implica ejecutar un solo comando dos veces cada vez que se ejecuta dentro de un contenedor.
Cuando se utilizan comandos maravillosos de Jenkins dentro de un contenedor, el comando se ejecuta dos veces; sin embargo, cuando el comando jf se utiliza dentro de un script de shell, se ejecuta sólo una vez como se esperaba.
Comportamiento actual
Ejecutando comando: "jf" "mvn" "clean" "install" "-Dmaven.test.skip=true" "-f" "pom.xml
Salida: 09:19:37 06:19:37 [Información] Ejecutando Mvn... 09:19:37 06:19:37 [Información] Ejecutando Mvn...
15:01:44 12:01:44 [Información] El archivo jar build-info-extractor no se almacena en caché localmente. Descárgalo ahora... 15:01:44 Puedes configurar el repositorio desde el que se descarga este jar. 15:01:44 Lea más al respecto en https://jfrog.com/help/r/jfrog-cli/downloading-the-maven-and-gradle-extractor-jars 15:01:44 12:01:44 [ Información] Descargando la dependencia de JFrog desde https://releases.jfrog.io/artifactory/oss-release-local/org/jfrog/buildinfo/build-info-extractor-maven3/2.40.0/build-info-extractor-maven3- 2.40.0-uber.jar 15:01:44 12:01:44 [Información] El archivo jar build-info-extractor no se almacena en caché localmente. Descárgalo ahora... 15:01:44 Puedes configurar el repositorio desde el que se descarga este jar. 15:01:44 Lea más sobre esto enhttps://jfrog.com/help/r/jfrog-cli/downloading-the-maven-and-gradle-extractor-jars 15:01:44 12:01:44 [Info] Descargando la dependencia de JFrog desde https:// releases.jfrog.io/artifactory/oss-release-local/org/jfrog/buildinfo/build-info-extractor-maven3/2.40.0/build-info-extractor-maven3-2.40.0-uber.jar
Pasos de reproducción
Instalación de Jfrog CLI en Jenkins
Ejecutando script de prueba:
canalización { agente cualquier herramienta { jfrog 'jfrog-cli' } etapas { etapa('Clon') { pasos { git rama: 'maestro', url: " https://github.com/jfrog/project-examples.git " } }
stage('Exec Maven commands') { steps { dir('maven-examples/maven-example') { // Configure Maven project's repositories jf 'mvn-config --repo-resolve-releases libs-release --repo-resolve-snapshots libs-snapshots --repo-deploy-releases libs-release-local --repo-deploy-snapshots libs-snapshot-local' // Install and publish project jf 'mvn clean install' } } } stage('Publish build info') { steps { jf 'rt build-publish' } } }
}
Comportamiento esperado
La ejecución del comando se realizará solo una vez.
Versión del complemento JFrog
1.4.0
Versión CLI de JFrog
2.43.1
Tipo y versión del sistema operativo
Jenkins 2.401.2, Linux
Versión artesanal de JFrog
Nube JFrog
Versión JFrog Xray
Ninguna respuesta
I have also noticed this issue when using the kubernetes plugin. Commands are not executed twice, but the logs are streamed twice. This is introduced by https://github.com/jfrog/jenkins-jfrog-plugin/pull/63/files
That PR changed the PrintWriter of the launcher on the created ProcStarter instance. However, the underlying launcher (in this case, the kubernetes specific launcher) still has a reference to the original logger. If the logger of the launcher != logger of the procstarter, the kubernetes plugins tees them both. That explains why the logs show up twice (see doLaunch code in https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/ContainerExecDecorator.java for details.)
I was able to get the jfrog plugin working correctly on kubernetes by removing the teeing from the jfrog plugin, since the kubernetes plugin already does the teeing. However, not sure if those code changes work for other agents..
Describe the bug
Currently, using Jfrog plugin in Jenkins along with Jfrog CLI is executing a single command twice whenever it is run inside a container.
When using Jenkins groovy commands inside a container, the command is executed twice; however, when the jf command is used inside a shell script, it is executed only once as expected.
Current behavior
Executing command: "jf" "mvn" "clean" "install" "-Dmaven.test.skip=true" "-f" "pom.xml
Ouput: 09:19:37 06:19:37 [Info] Running Mvn... 09:19:37 06:19:37 [Info] Running Mvn...
15:01:44 12:01:44 [Info] The build-info-extractor jar is not cached locally. Downloading it now... 15:01:44 You can set the repository from which this jar is downloaded. 15:01:44 Read more about it at https://jfrog.com/help/r/jfrog-cli/downloading-the-maven-and-gradle-extractor-jars 15:01:44 12:01:44 [Info] Downloading JFrog's Dependency from https://releases.jfrog.io/artifactory/oss-release-local/org/jfrog/buildinfo/build-info-extractor-maven3/2.40.0/build-info-extractor-maven3-2.40.0-uber.jar 15:01:44 12:01:44 [Info] The build-info-extractor jar is not cached locally. Downloading it now... 15:01:44 You can set the repository from which this jar is downloaded. 15:01:44 Read more about it at https://jfrog.com/help/r/jfrog-cli/downloading-the-maven-and-gradle-extractor-jars 15:01:44 12:01:44 [Info] Downloading JFrog's Dependency from https://releases.jfrog.io/artifactory/oss-release-local/org/jfrog/buildinfo/build-info-extractor-maven3/2.40.0/build-info-extractor-maven3-2.40.0-uber.jar
Reproduction steps
Installing Jfrog cli on Jenkins
Running test script:
pipeline { agent any tools { jfrog 'jfrog-cli' } stages { stage('Clone') { steps { git branch: 'master', url: "https://github.com/jfrog/project-examples.git" } }
}
Expected behavior
Command execution to be done only once.
JFrog plugin version
1.4.0
JFrog CLI version
2.43.1
Operating system type and version
Jenkins 2.401.2, Linux
JFrog Artifactory version
JFrog Cloud
JFrog Xray version
No response