google-github-actions / setup-gcloud

A GitHub Action for installing and configuring the gcloud CLI.
https://cloud.google.com/sdk/docs
Apache License 2.0
1.71k stars 510 forks source link

skip_install: true throws warning when using v2 #668

Closed enricojonas closed 8 months ago

enricojonas commented 8 months ago

TL;DR

After switching to v2 a warning is thrown when using skip_install: true . We do not specify the version so that should not throw a warning. If we would specify the version the warning would be valid.

Ignoring "version" because "skip_install" was true!

Expected behavior

Do not throw a warning if version is not specified and skip_install is true.

Observed behavior

A warning is thrown:

Ignoring "version" because "skip_install" was true!

Action YAML

name: maven

on:
  workflow_call:

    inputs:
      runs-on:
        default: xxx
        required: false
        type: string
      working-directory:
        default: "."
        required: false
        type: string
      project_id:
        required: false
        type: string
      build:
        default: true
        required: false
        type: boolean

    secrets:
      workload_identity_provider:
        required: false
      service_account:
        required: false

jobs:

  build:
    if: ${{ inputs.build }}
    name: 'build'
    runs-on: ${{ inputs.runs-on }}

    permissions:
      contents: 'read'
      id-token: 'write'

    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 2

      - if: ${{ inputs.project_id }}
        name: 'Authenticate to Google Cloud'
        uses: google-github-actions/auth@v1.0.0
        with:
          workload_identity_provider: ${{ secrets.workload_identity_provider }}
          service_account: ${{ secrets.service_account }}

      - if: ${{ inputs.project_id }}
        name: 'Set up Cloud SDK'
        uses: google-github-actions/setup-gcloud@v2.0.0
        with:
          project_id: ${{ inputs.project_id }}
          skip_install: true

Log output

Run google-github-actions/setup-gcloud@v2.0.0
  with:
    project_id: xxx
    skip_install: true
    version: latest
  env:
    CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: xxx.json
    GOOGLE_APPLICATION_CREDENTIALS: xxx.json
    GOOGLE_GHA_CREDS_PATH: xxx.json
    CLOUDSDK_CORE_PROJECT: xxx
    CLOUDSDK_PROJECT: xxx
    GCLOUD_PROJECT: xxx
    GCP_PROJECT: xxx
    GOOGLE_CLOUD_PROJECT: xxx
Skipping installation ("skip_install" was true)
Warning: Ignoring "version" because "skip_install" was true!
Successfully authenticated
Successfully set default project

Additional information

No response

sethvargo commented 8 months ago

This isn't unique to v2 (v1 had the same issue). Proposed fix is in https://github.com/google-github-actions/setup-gcloud/pull/669.

enricojonas commented 8 months ago

@sethvargo v1 did not throw the warning, but good if it's fixed now:

Run google-github-actions/setup-gcloud@v1.1.0
  with:
    project_id: xxx
    skip_install: true
    version: latest
  env:
    CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE: xxx.json
    GOOGLE_APPLICATION_CREDENTIALS: xxx.json
    GOOGLE_GHA_CREDS_PATH: xxx.json
    CLOUDSDK_CORE_PROJECT: xxx
    CLOUDSDK_PROJECT: xxx
    GCLOUD_PROJECT: xxx
    GCP_PROJECT: xxx
    GOOGLE_CLOUD_PROJECT: xxx
Skipping installation ("skip_install" was true)
Successfully authenticated
Successfully set default project