Skip to content

Commit

Permalink
build: set LC_ALL on the make target
Browse files Browse the repository at this point in the history
Simply applying `LC_ALL=C` will work for the current shell only. For all
the shells and sub-shell to use it, we must set it globally.
Making it the first thing in the Make entrypoint now so the CRD and RBAC
sorting works on all the platforms.

Signed-off-by: Sébastien Han <[email protected]>
  • Loading branch information
leseb committed Jan 18, 2022
1 parent e271175 commit 8512b6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Linux doesn't guarantee file ordering, so sort the files to make sure order is deterministic.
# And in order to handle file paths with spaces, it's easiest to read the file names into an array.
# Set locale `LC_ALL=C` because different OSes have different sort behavior;
# `C` sorting order is based on the byte values,
# Reference: https://blog.zhimingwang.org/macos-lc_collate-hunt
LC_ALL=C
export LC_ALL

include build/makelib/common.mk
include build/makelib/helm.mk

Expand Down
7 changes: 0 additions & 7 deletions build/crds/build-crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ fi

generating_main_crd

# Linux doesn't guarantee file ordering, so we must sort the output to make sure it's deterministic.
# In order to handle file paths with spaces in the yq command below, it's easiest to read the
# file names into an array.
# Set locale `LC_ALL=C` because different OSes have different sort behavior;
# `C` sorting order is based on the byte values,
# Reference: https://blog.zhimingwang.org/macos-lc_collate-hunt
LC_ALL=C
CRD_FILES=()
while read -r line; do
CRD_FILES+=("$line")
Expand Down
6 changes: 0 additions & 6 deletions build/rbac/keep-rbac-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ sed '/^# Source: /d' | # helm adds '# Source: <file>' comments atop of each yaml
$YQ eval --split-exp '.kind + " " + .metadata.name + " "' - # split into files by <kind> <name> .yaml
# outputting the filenames with spaces after kind and name keeps the same sorting from before

# Linux doesn't guarantee file ordering, so sort the files to make sure order is deterministic.
# And in order to handle file paths with spaces, it's easiest to read the file names into an array.
# Set locale `LC_ALL=C` because different OSes have different sort behavior;
# `C` sorting order is based on the byte values,
# Reference: https://blog.zhimingwang.org/macos-lc_collate-hunt
LC_ALL=C
RBAC_FILES=()
while read -r line; do
RBAC_FILES+=("$line")
Expand Down

0 comments on commit 8512b6a

Please sign in to comment.