jenkinsci / jenkinsci/jfrog-plugin
buildInfo isn't properly collected for jobs run within a docker container
- Dominant language
- Java
- Stars
- 16
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
I'm trying to run an npm build, publish build info, and execute xray scan while running inside a `withDockerContainer` block. However, after I try publishing the build info, a command to kick off an xray scan fails.
### Current behavior
The `jf 'npm i'` works, then `jf 'rt bp'` runs without error, then `jf 'bs'` blows up saying it can't find the build info. When I check our artifactory, there was a build pushed but the build info doesn't have any of the metadata/dependencies from the npm install. I have a feeling from inspecting the job logs that the jfrog plugin/CLI might use ~~environment variables~~ tmp dirs to store build info, but they don't carry across the different commands
### Reproduction steps
Run a pipeline job with steps similar to this scripted pipeline syntax:
```
node {
withDockerContainer(
image: 'node:18.17.1',
args: "-v ::rw,z" // this was necessary so that the container could use the globally configured jfrog-cli tool
) {
withEnv(["JFROG_BINARY_PATH=${tool 'jfrog-cli'}"]) {
stage('Build and scan') {
// checkout some npm project here
jf 'npm-config --repo-resolve --repo-deploy '
jf 'npm i'
jf 'rt bp'
jf 'bs' // 404 returned here
}
}
}
}
```
### Expected behavior
The build info should be populated and pushed correctly, allowing an xray scan to run against that build's dependencies.
### JFrog plugin version
1.4.0
### JFrog CLI version
2.45.0
### Operating system type and version
Amazon Linux / UBI
### JFrog Artifactory version
7.49.6
### JFrog Xray version
3.66.6
Contributor guide
Research direction
Start with the scripted Jenkins pipeline using withDockerContainer, withEnv, and the jf commands shown in the reproduction, then compare how npm i, rt bp, and bs handle build-info state across container commands. Done means the build info retains npm metadata and dependencies so the subsequent Xray scan succeeds without a 404.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java, node.js
- Domain
- build-system, ci-cd, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100