GoogleContainerTools / GoogleContainerTools/skaffold

Log spam from the `ko` builder when `gcloud` is installed but not initialized

Open
#7,386 1 comment 0 reactions 1 assignee Claimed by @halvards View on GitHub
build/ko kind/enhancement ko
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior

Scenario:

- Using the Skaffold `ko` builder
- `gcloud` is installed but _not_ initialized
- Not requiring authenticated access to GCR or AR for fetching the base image or for publishing the built image.

In this situation, there should not be error output from the `google.Keychain` in `google/go-containerregistry`.

One environment where this happens is on GitHub Actions runners. These have `gcloud` installed but _not_ initialized.

From Slack: https://kubernetes.slack.com/archives/CABQMSZA6/p1651894509279599

### Actual behavior

Images are built correctly, and the `skaffold` command returns a successful status code.

But the output of `skaffold build` includes these lines:

```
ERRO[0000] ERROR: (gcloud.config.config-helper) You do not currently have an active account selected.
ERRO[0000] Please run:
ERRO[0000]
ERRO[0000] $ gcloud auth login
ERRO[0000]
ERRO[0000] to obtain new credentials.
ERRO[0000]
ERRO[0000] If you have already logged in with a different account:
ERRO[0000]
ERRO[0000] $ gcloud config set account ACCOUNT
ERRO[0000]
ERRO[0000] to select an already authenticated account to use.
```

### Information

- Skaffold version: v1.38.0
- Operating system: macOS and Linux
- Installed via: Downloaded from GitHub Releases
- Contents of skaffold.yaml:

```yaml
apiVersion: skaffold/v2beta28
kind: Config
build:
artifacts:
- image: skaffold-ko
ko: {}
```

### Steps to reproduce the behavior

1. Run in an environment where `gcloud` is installed but not initialized. For instance, use a container image such as `gcr.io/google.com/cloudsdktool/google-cloud-cli:debian_component_based`
2. Download the Skaffold binary in the container
3. Clone the Skaffold repo.
4. Go to the `ko` example in the `examples` directory.
5. `skaffold build`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.