Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

fix: Call sub-scripts with bash instead of sh #714

Merged
merged 4 commits into from
Dec 8, 2022

Conversation

unforced
Copy link
Contributor

@unforced unforced commented Nov 29, 2022

This fixes many of the key issues in #713
Which it turned out had less to do with POSIX compliance as it did with us explicitly calling sub-scripts configure-delivery and configure-auth using sh. Removing this call lets the shebang at the top of the files do their work so they end up being run with the environment bash.
On some machines, sh is bash so this wasn't an issue, but on many machines sh is a POSIX compliant dash variant.

This PR changes those calls to not run with sh, and also removes a weird conditional discovered in the process.

@unforced unforced requested a review from a team as a code owner November 29, 2022 23:44
@github-actions github-actions bot added component: delivery Related to automation, testing, deployment of the application. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Nov 29, 2022
@rogerthatdev rogerthatdev self-requested a review December 8, 2022 01:32

if [[ -z "${REPO_NAME}" || -z "${REPO_NAME}" ]]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should keep the non-posix compliant double brackets, but yes this line should be changed to remove the second part of this OR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@github-actions github-actions bot added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Dec 8, 2022
@unforced unforced changed the title feat: move setup scripts closer to posix compliance fix: remove weird double conditional Dec 8, 2022
@github-actions github-actions bot added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 8, 2022
@github-actions github-actions bot added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 8, 2022
@unforced
Copy link
Contributor Author

unforced commented Dec 8, 2022

So made some edits to my top-level comment up there, but basically the issues in #713 were happening because we were calling the subscripts explicitly with sh which meant the shebang at the top telling them to run with bash didn't matter, and therefore we didn't get to use the fancy bash functionality like [[

This PR is ready to go now

@@ -295,7 +295,7 @@ if [[ -z "$SKIP_AUTH" ]]; then
read -rp "Would you like to configure $(tput bold)$(tput setaf 3)end-user authentication?$(tput sgr0) (y/n) " auth_yesno

if [[ ${auth_yesno} == "y" ]]; then
sh ./scripts/configure_auth.sh
./scripts/configure_auth.sh
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this the right way to run it or should we use bash explicitly?

Copy link
Contributor

Choose a reason for hiding this comment

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

this should work just fine 👍

@unforced unforced changed the title fix: remove weird double conditional fix: Call sub-scripts with bash instead of sh Dec 8, 2022
@github-actions github-actions bot added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 8, 2022
@@ -295,7 +295,7 @@ if [[ -z "$SKIP_AUTH" ]]; then
read -rp "Would you like to configure $(tput bold)$(tput setaf 3)end-user authentication?$(tput sgr0) (y/n) " auth_yesno

if [[ ${auth_yesno} == "y" ]]; then
sh ./scripts/configure_auth.sh
./scripts/configure_auth.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

this should work just fine 👍

@rogerthatdev rogerthatdev merged commit 0618655 into GoogleCloudPlatform:main Dec 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: delivery Related to automation, testing, deployment of the application. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants