Skip to content

Commit

Permalink
Debug logging for generating tags (#12088)
Browse files Browse the repository at this point in the history
* Use config to provide a default tag for images build for pr or commit.
Added validation tag field to provide validation regex together with a tag.
Update kaniko-build-config.yaml to provide default tag for pr and commit images with validation regex.
Validating tag when parsing it's value.
Added TagOption to add PR number to the Tagger instance.
Using pull request default tag together with user provided tags instead replacing all values with default tag. This allows users to provide their own tag to the images build on pr.

* Pass logger instance.

* First set of debug lof messages

* More loggers.
Write parsed tags to file.

* More debug log statements.
Added writing generated tags to the file. This let us write logs in to stdout because the generated tags can be read from file.

* Pass logger instance.

* First set of debug lof messages

* More loggers.
Write parsed tags to file.

* More debug log statements.
Added writing generated tags to the file. This let us write logs in to stdout because the generated tags can be read from file.

* Adjusteed tests

* More debug logs

* Do not change kaniko build config. THis is done in separate pr.
Use logger from options when building locally.

* Added named method to better describe log message context
Added logging in other packages used by image-builder

* Fixed tests

* write output file to the root of container

* Fix expected flag

* Do not use named logger interface

* More context data
  • Loading branch information
dekiel authored Oct 15, 2024
1 parent d2a41b4 commit 4bf19f3
Show file tree
Hide file tree
Showing 7 changed files with 333 additions and 113 deletions.
5 changes: 1 addition & 4 deletions cmd/image-builder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ type Config struct {
DevRegistry Registry `yaml:"dev-registry" json:"dev-registry"`
// Cache options that are directly related to kaniko flags
Cache CacheConfig `yaml:"cache" json:"cache"`
// TagTemplate is used to generate default tag for push events for current image-builder version.
// This will be removed after migration.
TagTemplate tags.Tag `yaml:"tag-template" json:"tag-template"`
// Default Tag template used for images build on commit.
// The value can be a go-template string or literal tag value string.
// See tags.Tag struct for more information and available fields
Expand Down Expand Up @@ -346,4 +343,4 @@ func determineUsedCISystem(envGetter func(key string) string, envLookup func(key
}

return "", fmt.Errorf("cannot determine ci system: unknown system")
}
}
2 changes: 1 addition & 1 deletion cmd/image-builder/images/kaniko/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ FROM gcr.io/kaniko-project/executor:v1.23.2

COPY --from=builder /app/image-builder /image-builder

ENTRYPOINT ["/image-builder"]
ENTRYPOINT ["/image-builder"]
Loading

0 comments on commit 4bf19f3

Please sign in to comment.