Case closed.

I'm now pre-installing the tool on the node using Ansible, which installs 
it in C:\Program Files instead of 
C:\Users\jenkins\tools\com.cloudbees.jenkins.plugins.customtools.CustomTool\
.
Then I'm setting the path to the custom tool on the node configuration.
That works.

On Friday, March 5, 2021 at 8:39:38 PM UTC+1 Amedee Van Gasse wrote:

> I have defined a Custom Tool Tesseract, which extracts a ZIP file.
>
> In my Scripted Pipeline, I have this code:
>
> withEnv([
>         "gsExec=$gsPath",
>         "compareExec=$comparePath",
>         "Path+TESSERACT=${tool name: 'Tesseract', type: 
> 'com.cloudbees.jenkins.plugins.customtools.CustomTool'}"
> ]) {
>     configFileProvider([configFile(fileId: 
> GeneralVariables.mavenGlobalSettings, variable: 'MAVEN_SETTINGS')]) {
>         withMaven(jdk: GeneralVariables.JDK_VERSION, maven: 
> GeneralVariables.Maven) {
>             sh 'echo $PATH'
>             sh "mvn --global-settings ${MAVEN_SETTINGS.replace '\\', '/'} 
> --no-transfer-progress --batch-mode install " +
>                     "--activate-profiles test -DgsExec=\"$gsPath\" 
> -DcompareExec=\"$comparePath\" -Dmaven.repo.local=.repository"
>         }
>     }
>
> In my Jenkins Console Log, I see this output:
>
> provisioning config files...
> copy managed file [MyGlobalSettings] to 
> file:/C:/Users/jenkins/workspace/run-cross-module-tests-java-QA-11580@tmp/config12082685466158235325tmp
> [withMaven] Options: []
> [withMaven] Available options: 
> [withMaven] using JDK installation jdk-8-oracle
> [withMaven] using Maven installation 'M3'
> + echo 
> /c/Users/jenkins/tools/hudson.model.JDK/jdk-8-oracle/bin:/c/Users/jenkins/workspace/run-cross-module-tests-java-QA-11580@tmp/withMavend1394d3e:/c/Users/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/Tesseract/Tesseract-OCR:/mingw64/bin:/c/program
>  
> files/powershell/7:/c/Program 
> Files/ImageMagick-7.0.11-Q16-HDRI:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program
>  
> Files/Amazon/cfn-bootstrap:/c/ProgramData/chocolatey/bin:/c/Program 
> Files/OpenSSH-Win64:/c/Program 
> Files/dotnet:/cmd:/mingw64/bin:/usr/bin:/c/Program 
> Files/OpenJDK/openjdk-11.0.10_9/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/Program
>  
> Files/PowerShell/7:/c/Program 
> Files/OpenJDK/openjdk-8u282-b08/bin:/c/Program 
> Files/nodejs:/bin:/c/Windows/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps:/c/Users/jenkins/AppData/Local/Microsoft/WindowsApps
> /c/Users/jenkins/tools/hudson.model.JDK/jdk-8-oracle/bin:/c/Users/jenkins/workspace/run-cross-module-tests-java-QA-11580@tmp/withMavend1394d3e:/c/Users/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/Tesseract/Tesseract-OCR:/mingw64/bin:/c/program
>  
> files/powershell/7:/c/Program 
> Files/ImageMagick-7.0.11-Q16-HDRI:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program
>  
> Files/Amazon/cfn-bootstrap:/c/ProgramData/chocolatey/bin:/c/Program 
> Files/OpenSSH-Win64:/c/Program 
> Files/dotnet:/cmd:/mingw64/bin:/usr/bin:/c/Program 
> Files/OpenJDK/openjdk-11.0.10_9/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/Program
>  
> Files/PowerShell/7:/c/Program 
> Files/OpenJDK/openjdk-8u282-b08/bin:/c/Program 
> Files/nodejs:/bin:/c/Windows/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps:/c/Users/jenkins/AppData/Local/Microsoft/WindowsApps
> + mvn --global-settings 
> C:/Users/jenkins/workspace/run-cross-module-tests-java-QA-11580@tmp/config12082685466158235325tmp
>  
> --no-transfer-progress --batch-mode install --activate-profiles test 
> '-DgsExec=C:/Program Files/gs/gs9.53.3/bin/gswin64c.exe' 
> '-DcompareExec=C:/Program Files/ImageMagick-7.0.11-Q16-HDRI/compare.bat' 
> -Dmaven.repo.local=.repository
>
> The PATH variable contains the Tesseract directory, 
> /c/Users/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/Tesseract/Tesseract-OCR
> .
>
> I don't see anything in the log that actually tells me that a CustomTool 
> is actually installed.
>
> Further down in the logging, I see that Tesseract isn't found:
>
> ***REDACTED***.tesseract4.TesseractHelper ERROR Command failed: Cannot run 
> program "tesseract": CreateProcess error=2, The system cannot find the file 
> specified
> ***REDACTED***.tesseract4.Tesseract4ExecutableOcrEngine ERROR Tesseract 
> failed. Please check that tesseract is installed and provided path to 
> tesseract executable directory is correct
>
> Indeed, when I verify the directories on the node itself, I see that the 
> Tesseract directory is missing:
>
> ls 
> C:\Users\jenkins\tools\com.cloudbees.jenkins.plugins.customtools.CustomTool\ 
>
>     Directory: 
> C:\Users\jenkins\tools\com.cloudbees.jenkins.plugins.customtools.CustomTool 
>
> Mode                 LastWriteTime         Length Name
> ----                 -------------         ------ ----
> d----            3/5/2021  6:39 PM                InspectHeaders
>
> So let me repeat this very clearly: the PATH value is correct, but the 
> actual directory does not exist.
>
> InspectHeaders is the only CustomTool that is installed (earlier in the 
> pipeline, with a shell script). Tesseract, which should be extracted from 
> a ZIP file, is not installed.
>
> I have several other nodes: on Linux, it is successfully installed with 
> apt-get 
> install; and on another Windows node, it is also successfully installed 
> from a ZIP file.
>
> Already tried: replace installation from ZIP with installation from shell 
> script:
>
> #!/bin/sh
> set -e
>
> TOOL=Tesseract-OCR.zip
>
> if test ! -x "${TOOL}" ; then
>   curl https://repo.itextsupport.com/files/tools/"${TOOL}"; --output 
> "${TOOL}" --silent
>   unzip "${TOOL}"
> fi
>
> Same result: CustomTool is added to the PATH, but isn't actually 
> installed.
>
> My question is: how do I tell Jenkins to install this CustomTool, no 
> matter what?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3da94d05-1c92-4183-b6e8-021349f2a5aan%40googlegroups.com.

Reply via email to