Cleanup is not running on self-hosted runners when using server config
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 266
- Forks
- 110
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 3
Description
Describe the bug
On self-hosted runners, JFrog CLI server configs in ~/.jfrog/ are never cleaned up after a job when using JF_ENV_* config tokens for authentication. configJFrogServers() has two code paths — when using JF_ENV_*, it calls jf config import directly and never reaches getServerIdForConfig(), which is the only place SETUP_JFROG_CLI_SERVER_IDS is written via core.exportVariable. Since that env var is empty, shouldSkipCleanup() exits silently at debug level and ~/.jfrog/ is never cleaned. Stale server configs accumulate with every run.
For now it's possible to workaround this by manually setting JFROG_CLI_HOME_DIR env var
Current behavior
Here are the snippet for run logs for setup-jfrog-cli:
Found JFrog CLI in cache. No need to download
/***/_work/_tool/jf/2.91.0/x64/jf config import ***
02:33:23 [Debug] JFrog CLI version: 2.91.0
02:33:23 [Debug] OS/Arch: linux/amd64
02:33:23 [Info] Importing server ID 'artifactory_jenkins'
And the post action:
##[debug]Evaluating condition for step: 'Post Setup JFrog CLI'
##[debug]Evaluating: always()
##[debug]Evaluating always:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Post Setup JFrog CLI
##[debug]Loading inputs
##[debug]Loading env
Post job cleanup.
##[debug]isExplicit: 2.91.0
##[debug]explicit? true
##[debug]checking cache: /***/_work/_tool/jf/2.91.0/x64
##[debug]Found tool in cache jf 2.91.0 x64
##[debug]isExplicit: 2.91.0
##[debug]explicit? true
##[debug]checking cache: /***/_work/_tool/jfrog/2.91.0/x64
##[debug]Found tool in cache jfrog 2.91.0 x64
##[debug]No servers are configured. Skipping cleanup.
##[debug]Node Action run completed with exit code 0
##[debug]Finishing: Post Setup JFrog CLI
Reproduction steps
- Use a self-hosted runner
- Authenticate via
JF_ENV_1: ${{ secrets.MY_CONFIG_TOKEN }}(noJF_URL/JF_ACCESS_TOKEN) - Run the job — post-step skips cleanup silently
- Check
~/.jfrog/on the runner — stale server configs accumulate with every run
Expected behavior
Server configs imported via JF_ENV_* should be cleaned up by the post-step, the same way as configs added via JF_URL/JF_ACCESS_TOKEN.
Setup JFrog CLI version
v5.0.0
JFrog CLI version
2.91.0
Workflow operating system type and version
Ubuntu 24.04
JFrog Artifactory version (if relevant)
No response
JFrog Xray version (if relevant)
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating configJFrogServers(), getServerIdForConfig(), and shouldSkipCleanup() in the action source, then trace the JF_ENV_* path and the SETUP_JFROG_CLI_SERVER_IDS export. Reproduce on a self-hosted Ubuntu runner and verify that server configs imported through JF_ENV_* are removed from ~/.jfrog/ during the post-step.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- ci-cd, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 67/100