New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
publishing/rules: remove .gitattributes before publishing #108970
publishing/rules: remove .gitattributes before publishing #108970
Conversation
If a staging repo has .gitattributes files containing the `export-subst` attribute ([example](https://github.com/kubernetes/kubernetes/blob/b6c06a95d7ff262a876b95a1035eaf478a7cb961/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`](https://github.com/kubernetes/kubernetes/blob/b6c06a95d7ff262a876b95a1035eaf478a7cb961/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.
@nikhita: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, nikhita The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel
…On Thu, 24 Mar 2022 at 15:41, Kubernetes Prow Robot < ***@***.***> wrote:
[APPROVALNOTIFIER] This PR is *APPROVED*
This pull-request has been approved by: *dims
<#108970 (comment)>*,
*nikhita <#108970#>*
The full list of commands accepted by this bot can be found here
<https://go.k8s.io/bot-commands?repo=kubernetes%2Fkubernetes>.
The pull request process is described here
<https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process>
Needs approval from an approver in each of these files:
- staging/publishing/OWNERS
<https://github.com/kubernetes/kubernetes/blob/master/staging/publishing/OWNERS>
[dims,nikhita]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
—
Reply to this email directly, view it on GitHub
<#108970 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD24BUCQ4WOXCZFTTO6PPBDVBQ5VNANCNFSM5RQP65VA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
If a staging repo has .gitattributes files containing the
export-subst
attribute (example), 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
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.
Which issue(s) this PR fixes:
Ref:
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
/assign @dims
/hold
for review