Repository navigation
Run the file storage sample's scripts on macOS's bash 3.2 - #51
Merged
Merged
Conversation
macOS ships bash 3.2 as /bin/bash. The ${value,,} and ${value^^} expansions need bash 4: under bash 3.2
they fail with "bad substitution" and the scripts carry on with empty values, for example an empty ACR
name. The .NET and Python scripts now convert case with two small helpers in 00-variables.sh, lowercase
and uppercase, which use tr and run on every bash.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the Bash 3.2 compatibility changes in the file-storage sample scripts.
No open issues 🎉
What changed in this PR
This PR removes Bash 4-only case conversions from the .NET and Python file-storage sample scripts, making those conversions compatible with macOS’s Bash 3.2.
Changes:
- Add
tr-basedlowercaseanduppercasehelpers and use them to construct ACR names. - Replace case conversions in provisioning options, protocol messages, and Docker image tagging and pushing.
- Keep existing shebangs and limit changes to the file-storage sample.
| File | Description |
|---|---|
samples/web-app-file-storage/python/scripts/05-deploy-app.sh |
Use the uppercase helper in the deployment message. |
samples/web-app-file-storage/python/scripts/04-push-docker-image.sh |
Use the lowercase helper for Docker image references. |
samples/web-app-file-storage/python/scripts/01-deploy-resources.sh |
Use helpers to normalize options and display the protocol. |
samples/web-app-file-storage/python/scripts/00-variables.sh |
Define compatible case helpers and update ACR naming. |
samples/web-app-file-storage/dotnet/scripts/05-deploy-app.sh |
Use the uppercase helper in the deployment message. |
samples/web-app-file-storage/dotnet/scripts/04-push-docker-image.sh |
Use the lowercase helper for Docker image references. |
samples/web-app-file-storage/dotnet/scripts/01-deploy-resources.sh |
Use helpers to normalize options and display the protocol. |
samples/web-app-file-storage/dotnet/scripts/00-variables.sh |
Define compatible case helpers and update ACR naming. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
macOS ships bash 3.2 as
/bin/bash. The scripts of theweb-app-file-storagesample, in both its .NET and its Python version, used the${value,,}and${value^^}case conversions, which need bash 4. Run on a Mac the way the README says (./01-deploy-resources.sh), they failed with "bad substitution" and carried on with empty values:00-variables.shleft the ACR name empty, so every later step addressed a registry with no name.The repository README says the scripts run unchanged on Linux, macOS and WSL; with this change, the scripts of this sample do.
Part of SMF-1050
Changes
00-variables.sh(both versions) defines two helpers,lowercaseanduppercase, which convert case withtrand run on every bash, and buildsACR_NAMEwithlowercase.01-deploy-resources.sh,04-push-docker-image.shand05-deploy-app.sh(both versions) call them where they used${value,,}and${value^^}: to normalize the provisioning mode and the protocol, to print the protocol, and to tag and push the image.#!/bin/bash, and nothing else changes. The other samples still use the bash 4 forms; this pull request covers only this sample.Tests
00-variables.shfrom main fails with${PREFIX,,}acr${SUFFIX,,}: bad substitutionand leavesACR_NAMEempty; the one from this branch setslocalacrtest, as bash 5 does. Every script of the sample, both cluster scripts andtests/test-vacation-planner.shparse under bash 3.2.localstack/localstack-azure:latest), static provisioning over SMB, with every script run by bash 3.2:scripts/01-system-assigned-managed-identity.sh, the sample's01,02,04and05scripts, andtests/test-vacation-planner.sh. Python: cluster in 342 s, deploy in 148 s, test passed. .NET: cluster in 343 s, deploy in 110 s, test passed. No "bad substitution" in any log; the scripts printed[localacrtest]andprovisioning over [SMB].🤖 Generated with Claude Code