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

test: update add_vagrant_box.sh #15831

Merged
merged 1 commit into from
Apr 26, 2021
Merged

test: update add_vagrant_box.sh #15831

merged 1 commit into from
Apr 26, 2021

Conversation

twpayne
Copy link
Contributor

@twpayne twpayne commented Apr 22, 2021

This commit fixes a few portability issues and minor bugs, mainly caught
by ShellCheck.

@twpayne twpayne added area/CI-improvement Topic or proposal to improve the Continuous Integration workflow release-note/misc This PR makes changes that have no direct user impact. labels Apr 22, 2021
@twpayne twpayne requested a review from qmonnet April 22, 2021 14:20
@twpayne twpayne requested a review from a team as a code owner April 22, 2021 14:20
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.10.0 Apr 22, 2021
if [[ ! -f $box_dir$box/metadata_url ]] ; then
printf "https://vagrantcloud.com/cilium/$box" > $box_dir$box/metadata_url
echo "https://vagrantcloud.com/cilium/$box" > "$box_dir$box/metadata_url"
Copy link
Member

Choose a reason for hiding this comment

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

Could you please elaborate on this change? Asking because I was under the impression that printf was more portable than echo. Or is it because you just want a newline character at the end of the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch with the newline. I initially switched away from printf as there were no arguments being passed, and correction functionality required $box to not contain any printf verbs (e.g. if $box was foo%s then printf would fail, of course this would not likely happen in practice).

The relevant ShellCheck is SC3037, which indeed warns that flags to echo are undefined in POSIX sh. However, this script explicitly uses /bin/bash, and -n is defined there.

Result: I've added a -n to echo.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I was just wondering why the switch. I understand the %s reason. Thanks!

I don't think the newline matters at all, and I think we'd be as well without this -n option. It's true we enforce bash so we should have it, but it's just not clear when reading the script what we need to omit the new line (I suspect printf didn't add it just because nobody cared to add it). But that's a minor details anyway, so feel free to revert the -n or to keep it :).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vagrant itself seems to omit the trailing newline, so let's keep the -n.

@qmonnet qmonnet removed their assignment Apr 22, 2021
This commit fixes a few portability issues and minor bugs, mainly caught
by ShellCheck.

Signed-off-by: Tom Payne <tom@isovalent.com>
Copy link
Member

@christarazi christarazi left a comment

Choose a reason for hiding this comment

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

LGTM pending Quentin's comment

@christarazi christarazi removed their assignment Apr 22, 2021
@twpayne twpayne added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. and removed ready-to-merge This PR has passed all tests and received consensus from code owners to merge. labels Apr 23, 2021
@twpayne
Copy link
Contributor Author

twpayne commented Apr 23, 2021

test-me-please

@qmonnet qmonnet added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Apr 23, 2021
@qmonnet
Copy link
Member

qmonnet commented Apr 23, 2021

This script is not used in CI tests.

@twpayne
Copy link
Contributor Author

twpayne commented Apr 23, 2021

Ah, thanks. I saw references to it in several Jenkinsfiles:

jenkinsfiles/ginkgo-kernel.Jenkinsfile:102:                sh '/usr/local/bin/add_vagrant_box ${WORKSPACE}/${PROJ_PATH}/vagrant_box_defaults.rb'
jenkinsfiles/ginkgo-runtime-kernel.Jenkinsfile:73:                sh '/usr/local/bin/add_vagrant_box ${WORKSPACE}/${PROJ_PATH}/vagrant_box_defaults.rb'
jenkinsfiles/kubernetes-upstream.Jenkinsfile:65:                sh '/usr/local/bin/add_vagrant_box ${WORKSPACE}/${PROJ_PATH}/vagrant_box_defaults.rb'

but see now that these are in fact provisioned as part of the Packet Terraform scripts.

@pchaigno
Copy link
Member

We should really move this script to contrib/ to clarify that and fix the codeowners in one go. I've stopped the Jenkins builds.

@qmonnet
Copy link
Member

qmonnet commented Apr 26, 2021

We should really move this script to contrib/ to clarify that and fix the codeowners in one go.

-> #15859

@aanm aanm merged commit 5a4eb76 into cilium:master Apr 26, 2021
1.10.0 automation moved this from In progress to Done Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CI-improvement Topic or proposal to improve the Continuous Integration workflow ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants