GoogleContainerTools / GoogleContainerTools/skaffold
Support for Pre-tag hook
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
This probably a feature request - unless there is support already available
I am trying to use pre-build hooks to run a command which parses and stores my app's version as an environment variable ($APP_VERSION) from a properties file. Then I use envTemplate to reference variable for the tagPolicy.
As you can see in the output snippet the image is tagged before the pre-build hook runs. I would like to parse and export the version with hooks before the tags are generated.
Also, my command works great on the command line however not when used with hooks - any tips?
**Skaffold Snippet:**
```
apiVersion: skaffold/v2beta28
kind: Config
profiles:
- name: local
build:
tagPolicy:
envTemplate:
template: "{{.APP_VERSION}}"
artifacts:
- image: my-app
hooks:
before:
- command: [ "sh", "-c", "export APP_VERSION=$(grep \"applicationVersion\" gradle.properties | awk -F '=' '{ print $2 }')" ]
os: [ darwin, linux ]
custom:
buildCommand: ./build.sh
```
**Output Snippet:**
Command: skaffold dev -p local
```
Listing files to watch...
- my-app
Generating tags...
- my-app -> my-app:latest
Some taggers failed. Rerun with -vdebug for errors.
Starting build...
Found [docker-desktop] context, using local docker daemon.
Building [my-app]...
Target platforms: [linux/amd64]
Starting pre-build hooks...
Completed pre-build hooks
.
.
```
Any thoughts?
Many thanks in advance :)
Contributor guide
Assessment
This issue has not been assessed yet.