Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looging in with API key fails #19

Open
digorgonzola opened this issue Feb 4, 2025 · 6 comments
Open

Looging in with API key fails #19

digorgonzola opened this issue Feb 4, 2025 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@digorgonzola
Copy link

digorgonzola commented Feb 4, 2025

Using this action with an API key fails with exit code 1:

The process '/usr/local/bin/ibmcloud' failed with exit code 1

Workflow:

name: Workflow

on:
  pull_request:
    branches:
      - main

env:
  IBM_CLOUD_REGION: au-syd
  REGISTRY_HOSTNAME: au.icr.io
  REGISTRY_NAMESPACE: xxxxxxxx

jobs:
  build_push:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up ibmcloud CLI
        uses: IBM/actions-ibmcloud-cli@v1
        with:
          api_key: ${{ secrets.IBMCLOUD_API_KEY }}
          region: ${{ env.IBM_CLOUD_REGION }}
          group: default
          plugins: container-registry
@digorgonzola
Copy link
Author

digorgonzola commented Feb 4, 2025

Manually logging in by adding the below step, works:

      - name: Login to IBM Cloud
        run: |
          ibmcloud login --apikey ${{ secrets.IBMCLOUD_API_KEY }} -r ${{ env.IBM_CLOUD_REGION }}
          ibmcloud cr login

@Fryguy
Copy link
Member

Fryguy commented Feb 4, 2025

I see the name you are using to reference the API key is different in each example.

+ secrets.IBMCLOUD_API_KEY
- secrets.IBM_CLOUD_API_KEY

@Fryguy Fryguy added the bug Something isn't working label Feb 4, 2025
@Fryguy Fryguy self-assigned this Feb 4, 2025
@digorgonzola
Copy link
Author

digorgonzola commented Feb 6, 2025

I see the name you are using to reference the API key is different in each example.

  • secrets.IBMCLOUD_API_KEY
  • secrets.IBM_CLOUD_API_KEY

Sorry. That's just a typo. It still fails with the correct secret.

| [command]/usr/local/bin/ibmcloud login -r au-syd -g default
| API endpoint: https://cloud.ibm.com
| Logging in with API key from environment variable...
| Authenticating...
| FAILED
| Unable to authenticate

@Fryguy
Copy link
Member

Fryguy commented Feb 7, 2025

@digorgonzola Can you try the following as a manual login? Asking because of 2 reasons. 1. we don't use the --apikey parameter, but instead use the ENV var and 2. we pass the group parameter. This should be closer to what we do under the covers in the action.

      - name: Login to IBM Cloud
        env:
          IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} 
        run: |
          ibmcloud login -r ${{ env.IBM_CLOUD_REGION }} -g default
          ibmcloud cr login

@digorgonzola
Copy link
Author

digorgonzola commented Feb 19, 2025

Yes the following works fine:

      - name: Login to IBM Cloud
        env:
          IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }}
        run: |
          ibmcloud login -r ${{ env.IBMCLOUD_REGION }}
          ibmcloud cr login

Unsure then why it fails with the action...

@Fryguy
Copy link
Member

Fryguy commented Feb 19, 2025

For a full comparison, can you please also include the group in your command?

ibmcloud login -r ${{ env.IBMCLOUD_REGION }} -g default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants