jenkinsci / jenkinsci/jfrog-plugin
On jenkins restart, Jfrog Plugin/artifactory integration throws "Server id 'null' doesn't exists"
- Dominant language
- Java
- Stars
- 16
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
I'm using the Jfrog plugin to automatically install the cli from artifactory. I am testing the jrog tools cli install in a freestyle pipeline.
On a Jenkins restart, the pipeline does not recognize the artifactory server, and I will need to manually go to
Manage Jenkins -> Tools -> JFrog CLI installations and hit Apply.
### Current behavior
This is my test pipeline:
```
pipeline
{
agent any
tools
{
jfrog 'public-jfrog-cli'
}
stages
{
stage ('Testing')
{
steps
{
jf "-v"
}
}
}
}
```
This is the error thrown if I restart Jenkins and build that pipeline straightaway:
```
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 97b07401-d789-4554-9de6-d8f0e0a8cd04
java.io.IOException: Server id 'null' doesn't exists.
at io.jenkins.plugins.jfrog.ArtifactoryInstaller.performInstallation(ArtifactoryInstaller.java:56)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:70)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:221)
at io.jenkins.plugins.jfrog.JfrogInstallation.forNode(JfrogInstallation.java:50)
at io.jenkins.plugins.jfrog.JfrogInstallation.forNode(JfrogInstallation.java:32)
at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:157)
at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:138)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
/data/jenkins/workspace/jfrogtest@tmp/jfrog/1/.jfrog deleted
Finished: FAILURE
```


### Reproduction steps
- Configure Manage Jenkins -> System -> JFrog Plugin Configuration
- for Credentials, I use a Vault Secret Text Credential via Access Token
- Configure Manage Jenkins -> Tools -> JFrog CLI installations
- Create a Freestyle Pipeline
- Restart Jenkins
- Run Freestyle Pipeline
### Expected behavior
On a Jenkins restart, artifactory server should be set automatically.
### JFrog plugin version
1.5.1
### JFrog CLI version
v2-jf/2.8.0/jfrog-cli-windows-amd64/jf.exe
### Operating system type and version
Linux - 5.4.0-150-generic
### JFrog Artifactory version
_No response_
### JFrog Xray version
_No response_
Contributor guide
Research direction
Reproduce the restart-and-immediate-build sequence from the issue, then start at io.jenkins.plugins.jfrog.ArtifactoryInstaller.java:56 and follow the JfrogInstallation.java path shown in the stack trace. Compare the configured JFrog Plugin Configuration and JFrog CLI installation before and after restart; done means the pipeline finds the Artifactory server without manually applying the Tools configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100