-
Notifications
You must be signed in to change notification settings - Fork 11
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
[steps] [ENG-14503] Don't wrap b64-encoded values on Linux #491
[steps] [ENG-14503] Don't wrap b64-encoded values on Linux #491
Conversation
When using set-env command base64-encode the value of the env var before saving to a file See: https://linear.app/expo/issue/ENG-14503/base64-encode-env-vars-in-custom-builds
When collecting envs base64-decode them See: https://linear.app/expo/issue/ENG-14503/base64-encode-env-vars-in-custom-builds
Removed the env utils which are no longer used See: https://linear.app/expo/issue/ENG-14503/base64-encode-env-vars-in-custom-builds
Added explicit encoding when decoding from b64 See: https://linear.app/expo/issue/ENG-14503/base64-encode-env-vars-in-custom-builds
…-14503_base64_encode_envs_in_custom_builds
Linux systems add line wraps to b64 encoded values after 76 characters by default. We don't want that See: https://linear.app/expo/issue/ENG-14503/base64-encode-env-vars-in-custom-builds
Linux systems add line wraps to b64 encoded values after 76 characters by default. We don't want that See: https://linear.app/expo/issue/ENG-14503/base64-encode-env-vars-in-custom-builds
if [[ "$OSTYPE" == "linux"* ]]; then | ||
echo -n "$VALUE" | base64 -w 0 > $__EXPO_STEPS_ENVS_DIR/$NAME | ||
else | ||
echo -n "$VALUE" | base64 > $__EXPO_STEPS_ENVS_DIR/$NAME | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [[ "$OSTYPE" == "linux"* ]]; then | |
echo -n "$VALUE" | base64 -w 0 > $__EXPO_STEPS_ENVS_DIR/$NAME | |
else | |
echo -n "$VALUE" | base64 > $__EXPO_STEPS_ENVS_DIR/$NAME | |
fi | |
echo -n "$VALUE" | base64 -w 0 > $__EXPO_STEPS_ENVS_DIR/$NAME |
-w [number]
works in macOS (even though --help
doesn't mention it). Can you confirm it works in Linux too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm it doesn't work on macOS, got an error trying to run it on my machine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
radoslawkrzemien@MacBook-Pro-9 ~ % echo czescstaszekawsumiedobrze | base64 -w 0
base64: invalid option -- w
Usage: base64 [-Ddh] [-b num] [-i in_file] [-o out_file]
-b, --break break encoded string into num character lines
-Dd, --decode decodes input
-h, --help display this message
-i, --input input file (default: "-" for stdin)
-o, --output output file (default: "-" for stdout)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fascinating! On my computer it doesn't do that!
> echo czescradekcotamuciebie | base64 -w 0
Y3plc2NyYWRla2NvdGFtdWNpZWJpZQo=
> echo czescradekcotamuciebie | base64 -w 6
Y3plc2
NyYWRl
a2NvdG
FtdWNp
ZWJpZQ
o=
I guess then it's ok to do it like you're doing it. Thanks for confirming!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what is the cause of that. Guess it's better to be safe than sorry at least for now
Why
Linux systems add line wraps to b64 encoded values after 76 characters by default. We don't want that
How
If
set-env
is executed on a Linux systembase64
command is called with-w 0
option. It's not present in other systems therefore in other casebase64
is called with no optionsTest Plan
Automated tests pass
Tested manually both for
ios
andandroid