• Kubernetes Submit Queue's avatar
    Merge pull request #60923 from ipuustin/shell-bugfix5 · 9b8323f1
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 60759, 60531, 60923, 60851, 58717). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
    
    Fix build scripts to work in case there are spaces in directory names.
    
    **What this PR does / why we need it**:
    
    Fix kubernetes build scripts to work in case the source directory is in a directory path which contains a space.
    
    You can prepare such a directory like this:
    ```
    $ mkdir '/tmp/test dir/'
    $ cd '/tmp/test dir/'
    $ git clone https://github.com/kubernetes/kubernetes.git
    $ cd kubernetes
    ```
    Then, without the fix:
    ```
    $ KUBE_FASTBUILD=true KUBE_RELEASE_RUN_TESTS=n build/release.sh
    cat: /tmp/test: No such file or directory
    cat: dir/kubernetes/build/build-image/cross/VERSION: No such file or directory
    cat: /tmp/test: No such file or directory
    cat: dír/kubernetes/build/build-image/VERSION: No such file or directory
    +++ [0307 18:10:33] Verifying Prerequisites....
    cp: target '/tmp/test dir/kubernetes/_output/images/kube-build:build-7c7cd10a18--/Dockerfile' is not a directory
    !!! [0307 18:10:33] Call tree:
    !!! [0307 18:10:33]  1: build/release.sh:35
    kube::build::build_image(...)
    !!! Error in build/../build/common.sh:454
      Error in build/../build/common.sh:454. '((i<3-1))' exited with status 1
    Call stack:
      1: build/../build/common.sh:454 kube::build::build_image(...)
      2: build/release.sh:35 main(...)
    Exiting with status 1
    ```
    With the fix the compilation succeeds. The fix is done adding double quotes to required places (and also just in case to other places where shellcheck recommended adding them).
    
    Note that this fix doesn't as such help with the official make-based build: it's tricky to make makefiles work with targets with spaces in their names.
    
    **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
    
    **Special notes for your reviewer**:
    
    This PR needs pretty thorough review since this touches the core build scripts. 
    
    **Release note**:
    
    ```release-note
    NONE
    ```
    9b8323f1
Name
Last commit
Last update
..
build-image Loading commit data...
debian-base Loading commit data...
debian-hyperkube-base Loading commit data...
debian-iptables Loading commit data...
debs Loading commit data...
lib Loading commit data...
pause Loading commit data...
release-tars Loading commit data...
root Loading commit data...
rpms Loading commit data...
visible_to Loading commit data...
BUILD Loading commit data...
OWNERS Loading commit data...
README.md Loading commit data...
common.sh Loading commit data...
copy-output.sh Loading commit data...
make-build-image.sh Loading commit data...
make-clean.sh Loading commit data...
openapi.bzl Loading commit data...
package-tarballs.sh Loading commit data...
release-in-a-container.sh Loading commit data...
release.sh Loading commit data...
run.sh Loading commit data...
shell.sh Loading commit data...
util.sh Loading commit data...