GoogleContainerTools / GoogleContainerTools/skaffold
skaffold build -q tag does not match tagger settings
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
### Expected behavior
Running
```
skaffold build -q
```
should output the actual built tag in the tag field.
### Actual behavior
tag contains the sha256 id of the image
### Information
- Skaffold version: v2.0.3
- Operating system: Ubuntu 22.04
- Installed via: curl
- Contents of skaffold.yaml:
```yaml
apiVersion: skaffold/v3
kind: Config
metadata:
name: test
build:
artifacts:
- image: "target"
tagPolicy:
envTemplate:
template: "{{.VERSION}}"
```
- Content of Dockerfile:
```Dockerfile
FROM alpine@sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4
```
### Steps to reproduce the behavior
1. ```VERSION=1 skaffold build```
```
Generating tags...
- target -> target:1
```
2. ```VERSION=1 skaffold build -q --dry-run```
```
{"builds":[{"imageName":"target","tag":"target:1"}]}
```
3. ```VERSION=1 skaffold build -q```
```
{"builds":[{"imageName":"target","tag":"target:49176f190c7e9cdb51ac85ab6c6d5e4512352218190cd69b08e6fd803ffbf3da"}]}
```
Seeing as the docs state:
```
# Quietly build artifacts and output the image names as json
skaffold build -q > build_result.json
```
I would have expected that -q outputs the tag that it actually created even if not dry running.
Fun fact, if you also include ```--push``` then the result is correct, though the sha256 digest is appended:
```
> VERSION=1 skaffold build --default-repo REDACTED -q --push
{"builds":[{"imageName":"target","tag":"REDACTED/target:1@sha256:c0d488a800e4127c334ad20d61d7bc21b4097540327217dfab52262adc02380c"}]}
```
Contributor guide
Assessment
This issue has not been assessed yet.