mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
publishing/rules: remove .gitattributes before publishing
If a staging repo has .gitattributes files containing the `export-subst` attribute ([example](b6c06a95d7/staging/src/k8s.io/client-go/pkg/version/.gitattributes
)), then git expands the specified placeholders when git archive is used. When a published repo is downloaded from GitHub, GitHub does a "git archive" under the hood. This means that the placeholders get replaced by their relevant values. This type of "git archive" application sometimes leads to undesired values. See the example below. - In client-go, [line 59 in `pkg/version/base.go`](b6c06a95d7/staging/src/k8s.io/client-go/pkg/version/base.go (L59)
) is expanded on a git archive. This line is needed as a fallback to inject k8s version info for client-go when this info is not provided via ldflags during builds. - However, when k/client-go is vendored, the line gets expanded to _the commit of the project vendoring client-go_ -- which is not helpful at all! This also means that the vendored client-go will now contain different (expanded) commit shas for different projects. - To ensure reproducibility of source, this commit helps remove the .gitattributes files before publishing the staging repos. Additionally, when client-go is used as a library, we don't care about the line being expanded to inject version info so it is also safe to remove these files.
This commit is contained in:
parent
56f45c5c81
commit
2f6762c924
@ -7,6 +7,7 @@ recursive-delete-patterns:
|
||||
- BUILD.bazel
|
||||
- "*/BUILD.bazel"
|
||||
- Gopkg.toml
|
||||
- "*/.gitattributes"
|
||||
default-go-version: 1.18
|
||||
rules:
|
||||
- destination: code-generator
|
||||
|
Loading…
Reference in New Issue
Block a user