fcli tool
: Recognize cached tool installations
#675
Labels
effort:low
Easy to implement/fix
enhancement
New feature or request
fcli-tool
Issue related to 'fcli tool' commands
prio:medium
Medium priority
Enhancement Request
Some CI systems allow for caching tool installations, however such cached installations may not be recognized by fcli as being a previously installed tool.
For example, suppose a CI pipeline invokes
fcli tool <tool> install -v x.y --install-dir <directory cached by CI>
. The first pipeline run will install the tool and it will be cached by the CI system. On the next pipeline run, the fcli state data from the first run is likely lost, so fcli isn't aware of this tool installation. So, if the tool install command is run by the second pipeline run, fcli will detect that the installation directory already exists (as it was cached by the CI system), and thus the tool install command will fail (if no-y
option is specified), or delete the cached installation directory and re-install the tool (if-y
option is specified).We can easily work around this issue by copying the tool installation descriptor JSON file into the tool installation directory. In the scenario above, if the tool install command detects that the installation directory already exists, it can check whether it contains the tool installation descriptor, and if so:
fcli tool
commands to detect this installationFor this to work, we need to know the tool name and version that's installed in the installation directory, both to detect that the installation directory contains the same tool & version as what the user is trying to install (otherwise we should still fail/overwrite), and because we need tool name and version when copying the descriptor into the fcli state directory. However, the descriptor itself currently doesn't include the tool name and version, so we can either:
fcli-tool-descriptor-<tool-name>-<tool-version>
fcli-tool-descriptor/<tool-name>/<tool-version>
or maybefcli-state/<tool-name>/<tool-version>
I think the latter option is best, sticking to the same directory structure as in the fcli state directory for consistency. If the
fcli tool <tool> install -v <version> --install-dir <target>
command detects that<target>
already exists, we can simply check whetherfcli-tool-descriptor/<tool>/<version>
exists. If so,<target>
matches the tool name and version that the user is trying to install, thus we don't need to re-install. If it doesn't exist, either the target directory doesn't contain an fcli tool installation, or the user is trying to install a different tool or version in an existing fcli tool installation directory. In both cases, we would either fail or delete & install into the target directory, depending on presence of-y
option.The text was updated successfully, but these errors were encountered: