Skip to content
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

feat: add sha256sums for kind binaries #2336

Merged
merged 1 commit into from
Jun 29, 2021

Conversation

viveksyngh
Copy link
Contributor

@viveksyngh viveksyngh commented Jun 27, 2021

  • Add sha256sum file for kind binaries build as a part of release process

Fixes: #2331

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 27, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @viveksyngh!

It looks like this is your first PR to kubernetes-sigs/kind 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kind has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @viveksyngh. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 27, 2021
@viveksyngh
Copy link
Contributor Author

/assign @BenTheElder

@viveksyngh
Copy link
Contributor Author

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jun 27, 2021
@@ -48,3 +48,6 @@ export GOOS=linux GOARCH=arm64
export GOOS=linux GOARCH=ppc64le
EOF
)

# add sha256 for binaries
for f in ${REPO_ROOT}/bin/kind-*; do shasum -a 256 $f > $f.sha256sum; done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the original output for shasum is something like hashValue fileName, I think it only needs the hash value here?

https://github.com/kubernetes/kompose/blob/0b331d9e5dede975d62ca382b2dd7dff89019f6e/script/release.sh#L243

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do you know the filaname to check it with the command?

[aojea@aojea-laptop ~]$ shasum -a 256 ifac.go > ifac.sha
[aojea@aojea-laptop ~]$ sha256sum -c ifac.sha 
ifac.go: OK
[aojea@aojea-laptop ~]$ cp ifac.sha ifac.shaonly
[aojea@aojea-laptop ~]$ vi ifac.shaonly #removed the filename
[aojea@aojea-laptop ~]$ sha256sum -c ifac.shaonly 
sha256sum: ifac.shaonly: no properly formatted SHA256 checksum lines found

Copy link
Contributor

@xinydev xinydev Jun 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it is not easy to check.

however,I found that we have a lot of current tar files are only have the hash value,I'm just curious what is the reason for this.

➜  ~ gsutil cat gs://kubernetes-release/release/v1.21.0-alpha.0/kubernetes-test-windows-amd64.tar.gz.sha256   
e3b8a57d0bba4665f54874e4478bf2b360254314a482f4ba36f15ce228c561b7%     

➜  ~ gsutil cat gs://kubernetes-release/release/v1.21.0-alpha.0/kubernetes-src.tar.gz.sha256   
7eaf8fa1aa03afead4292d1e10dbc839439b4cd45a5a749bac242f8cf0040f45%    

I find a shell script using the command to check.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not an expert here, I always used the hash filename format, that is what shasum reports directly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also used hash filename format for one of the CLI in the past. Not sure what benefit other approach has.

@aojea
Copy link
Contributor

aojea commented Jun 27, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 27, 2021
@aojea
Copy link
Contributor

aojea commented Jun 27, 2021

the verify job fails

In ./hack/release/build/cross.sh line 53:
for f in ${REPO_ROOT}/bin/kind-*; do shasum -a 256 $f > $f.sha256sum; done
         ^----------^ SC2231: Quote expansions in this for loop glob to prevent wordsplitting, e.g. "$dir"/*.txt .
                                                   ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                        ^-- SC2086: Double quote to prevent globbing and word splitting.

@viveksyngh
Copy link
Contributor Author

viveksyngh commented Jun 28, 2021

/test pull-kind-verify

@@ -48,3 +48,6 @@ export GOOS=linux GOARCH=arm64
export GOOS=linux GOARCH=ppc64le
EOF
)

# add sha256 for binaries
for f in "${REPO_ROOT}"/bin/kind-*; do shasum -a 256 "$f" > "$f".sha256sum; done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use the oneliner and keep the last line, is easier to read

Suggested change
for f in "${REPO_ROOT}"/bin/kind-*; do shasum -a 256 "$f" > "$f".sha256sum; done
for f in "${REPO_ROOT}"/bin/kind-*; do
shasum -a 256 "$f" > "$f".sha256sum
done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this adds the whole path to the generated file, I think that we have to cd first in the folder

cd "${REPO_ROOT}"/bin
for f in kind-*; do
      shasum -a 256 "$f" > "$f".sha256sum
done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup it was adding full path. I have updated that to change to the directory and then run sha command.

- Add sha256sum file for kind binaries build as a part of release process
@aojea
Copy link
Contributor

aojea commented Jun 28, 2021

/lgtm
thanks
/assign @BenTheElder

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 28, 2021
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve
/hold
thanks!

@@ -48,3 +48,9 @@ export GOOS=linux GOARCH=arm64
export GOOS=linux GOARCH=ppc64le
EOF
)

# add sha256 for binaries
cd "${REPO_ROOT}"/bin
Copy link
Member

@BenTheElder BenTheElder Jun 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: refactor to not need cd EDIT: at least in the current shell scope, we could perhaps do this bit in a subshell or see if there's some other approach to manipulating the output.
TODO: update loop to ignore files with .sha256sum extension.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 28, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, viveksyngh

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 28, 2021
@BenTheElder
Copy link
Member

/hold cancel
we can iterate later, thank you!

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 29, 2021
@k8s-ci-robot k8s-ci-robot merged commit 5dbdf31 into kubernetes-sigs:main Jun 29, 2021
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. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

sha256sums for kind binaries
5 participants