Skip to content

Plugin installation fails if already present #61

@Luke-Roy-IBM

Description

@Luke-Roy-IBM

The installation of a plugin for the ibm cloud CLI fails the action if the plugin has already been installed.

Run IBM/actions-ibmcloud-cli@v1
Installing IBM Cloud CLI
/usr/local/bin/ibmcloud --version
ibmcloud 2.40.0 (e37968a5e-2025-12-09T17:44:02+00:00)
Copyright IBM Corp. 2014, 2025
Disable version checking
Installing IBM Cloud CLI plugins
  /usr/local/bin/ibmcloud plugin install code-engine
  Looking up 'code-engine' from repository 'IBM Cloud'...
  Plug-in 'code-engine[ce] 1.58.1' found in repository 'IBM Cloud'
  Plug-in 'code-engine[ce] 1.58.1' was already installed. Do you want to re-install it or not? [y/N] > 
  Error: The operation was canceled.

This logic would be a potential solution:

function ensure_plugin_is_up_to_date() {
    echo "Checking $1 ..."
    # check whether plugin is installed
    if ! ibmcloud plugin show $1 -q >/dev/null; then
        # install it
        ibmcloud plugin install $1 -f --quiet
    else 
        # check whether there is an update available
        ibmcloud plugin update $1 -f --quiet
    fi
}

It would probably be sufficent to pass -f as part of the install command

await exec.exec('ibmcloud', ['plugin', 'install', ...plugins])

Metadata

Metadata

Assignees

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