Skip to content

Cleanup is not running on self-hosted runners when using server config #339

@LP9688

Description

@LP9688

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

  1. Use a self-hosted runner
  2. Authenticate via JF_ENV_1: ${{ secrets.MY_CONFIG_TOKEN }} (no JF_URL/JF_ACCESS_TOKEN)
  3. Run the job — post-step skips cleanup silently
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions