Skip to content

Include .git in image builds #92

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

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

qbarrand
Copy link
Contributor

@qbarrand qbarrand commented Sep 28, 2022

Explicitly include .git in Google Cloud Builds

To include VCS data in the controller binary, our image build process
requires .git to be present in the working directory.
Google Cloud Build, the system used by the Kubernetes project to build
container images, ignores .git by default.
Explicitly include .git in the GCB environment through a .gcloudignore
file.

Reference: GoogleCloudPlatform/cloud-builders#236 (comment)

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qbarrand

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 28, 2022
@ybettan
Copy link
Contributor

ybettan commented Sep 28, 2022

Can we use create a .gcloudignore that explicitly includes .git (echo '!.git' > .gcloudignore) instead? Seems more comprehensive to me.

Also, can you describe in the commit message (and PR description) why this change is required (we are using .git for getting the commit sha in our logs bla bla, prow need to clone .git as part of its process in order for the code to compile etc)?
(Unless we need it for some other reason?)

It would be nice to get it directly instead of going to the link and trying to figure out what the author needed.

@k8s-triage-robot
Copy link

Unknown CLA label state. Rechecking for CLA labels.

Send feedback to sig-contributor-experience at kubernetes/community.

/check-cla
/easycla

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 28, 2022
To include VCS data in the controller binary, our image build process
requires .git to be present in the working directory.
Google Cloud Build, the system used by the Kubernetes project to build
container images, ignores .git by default.
Explicitly include .git in the GCB environment through a .gcloudignore
file.

Reference: GoogleCloudPlatform/cloud-builders#236 (comment)
@qbarrand
Copy link
Contributor Author

@ybettan PTAL

@codecov-commenter
Copy link

Codecov Report

Base: 72.90% // Head: 73.46% // Increases project coverage by +0.55% 🎉

Coverage data is based on head (6e58c00) compared to base (56b8bb3).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #92      +/-   ##
==========================================
+ Coverage   72.90%   73.46%   +0.55%     
==========================================
  Files          16       17       +1     
  Lines        1705     1771      +66     
==========================================
+ Hits         1243     1301      +58     
- Misses        398      404       +6     
- Partials       64       66       +2     
Impacted Files Coverage Δ
controllers/module_reconciler.go 66.10% <0.00%> (-1.60%) ⬇️
main.go 4.38% <0.00%> (-0.04%) ⬇️
internal/rbac/rbac.go 100.00% <0.00%> (ø)
internal/daemonset/daemonset.go 97.94% <0.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@qbarrand qbarrand changed the title Add an empty .gcloudignore Include .git in image builds Sep 28, 2022
@ybettan
Copy link
Contributor

ybettan commented Sep 29, 2022

Thank you!
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 29, 2022
@k8s-ci-robot k8s-ci-robot merged commit 6004e51 into kubernetes-sigs:main Sep 29, 2022
@qbarrand qbarrand deleted the gcloudignore branch September 29, 2022 07:50
@qbarrand qbarrand mentioned this pull request Sep 29, 2022
2 tasks
qbarrand pushed a commit to qbarrand/kernel-module-management that referenced this pull request Jun 2, 2023
Use Background context instead of TODO
Following the good practices of Golang,
we should use context.Background() function in test files
instead of context.TODO()
qbarrand pushed a commit to qbarrand/kernel-module-management that referenced this pull request Jun 2, 2023
…gs#92)

this add four fields to the crd in their own subsection:

FileList - a list of kmod files within the container to sign

KeySecret and CertSecret - these are the names of secrets containing the private and public keys respectivly that
will be used to sign the kmods. The public key should be the one added into the uefi moklist for secureboot,
 and KeySecret is its private component. (See the kernel docs e.g.
https://www.kernel.org/doc/html/v4.15/admin-guide/module-signing.html#manually-signing-modules
for details of this process)

unsignedImage - the optional name of a dtk image containing the unsigned knods, used only if their is no build stage.

The expected workflow will be (not implemented in this commit):
if there is only a kernelmapping.build section it will produce the image kernelmapping.containerImage
(for the non-secureboot case)

if there is both km.build and km.sign then build will produce an intermediate image and sign will
consume that to produce km.containerImage

if there is only km.sign signing will consumse km.sign.unsignedImage and produce km.containerImage
(this is for the case where a vendor supplies prebuilt images that need signing)

the generation of the intermediate image name will be handled automatically within the controller
(again in a different commit) but will probably be something like km.containerImage + "-unsigned"

Co-authored-by: Chris Procter <[email protected]>
yevgeny-shnaidman pushed a commit to yevgeny-shnaidman/kernel-module-management-upstream that referenced this pull request Jul 31, 2023
Use Background context instead of TODO
Following the good practices of Golang,
we should use context.Background() function in test files
instead of context.TODO()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants