Skip to content
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

added the fix for script for not being able to use in script source path #218

Merged

Conversation

aayushrangwala
Copy link
Contributor

@aayushrangwala aayushrangwala commented Nov 10, 2020

What type of PR is this?
/kind bug

What this PR does / why we need it:
The csi driver deployment script was using the base path as the curr dir where the script is triggerred, csi-snapshot class was not getting installed because of incorrect path resolution. Fixed to use the base path always using pwd and cd

Which issue(s) this PR fixes:

Fixes ##199

Special notes for your reviewer:

Does this PR introduce a user-facing change?:
NONE

Added the Fix for path resolution in deploy script. Now the user can run script from anywhere, not necessarily from the base path as `./deploy/kubernetes-1.1x/depploy-script.sh`

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 10, 2020
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 10, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @aayushrangwala. Thanks for your PR.

I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 10, 2020
@@ -11,7 +11,7 @@
set -e
set -o pipefail

BASE_DIR=$(dirname "$0")
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need BASH_SOURCE here? Why not just $0?

Also, why the output redirection?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well both BASH_SOURCE and $0 would serve the same purpose here just using the BASH_SOURCE in bash script is better even if it is sourced

And for output redirection, sometimes cd prints something to stdout, in the case where a CDPATH is set and even an error can be printed. So to be safe, there is the stdout redirection to dev null and stderr to stdout

To cover CDPATH weird cases, we can even follow to unset CDPATH at the begining and not use this redirection but still it will be changing user's config

Copy link
Contributor

Choose a reason for hiding this comment

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

Well both BASH_SOURCE and $0 would serve the same purpose here just using the BASH_SOURCE in bash script is better even if it is sourced

I think it is better to not depend on bash features unnecessarily, because then a conversion to a non-Bash script becomes easier. Currently pipefail is the only bashism that I am aware of, and even that may not be necessary.

And for output redirection, sometimes cd prints something to stdout

During normal operation? That's very unexpected.

in the case where a CDPATH is set and even an error can be printed.

If an error is printed, presumably the return code is non-zero, BASE_DIR is unset and everything fails. We want to see the error message of cd in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ohkay, right. we can depend on pipefail I can ignore the output redirection

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

Copy link
Contributor

@pohly pohly left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 11, 2020
@pohly
Copy link
Contributor

pohly commented Jan 26, 2021

/approve

@pohly
Copy link
Contributor

pohly commented Jan 26, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 26, 2021
@pohly
Copy link
Contributor

pohly commented Jan 26, 2021

/assign @xing-yang

For approval.

@xing-yang
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aayushrangwala, pohly, xing-yang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 6, 2021
@pohly
Copy link
Contributor

pohly commented Apr 7, 2021

/retest

@k8s-ci-robot k8s-ci-robot merged commit 9734686 into kubernetes-csi:master Apr 7, 2021
sunnylovestiramisu added a commit to sunnylovestiramisu/csi-driver-host-path that referenced this pull request Apr 12, 2023
6613c39 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update
0e7ae99 Update k8s image repo url
77e47cc Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version
155854b Fix dep version mismatch
8f83905 Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update
1d3f94d Update go version to 1.20 to match k/k v1.27
e322ce5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error
b74a512 test: fix golint error
aa61bfd Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver
7563d19 Update CSI_PROW_DRIVER_VERSION to v1.11.0
a2171be Merge pull request kubernetes-csi#216 from msau42/process
cb98782 Merge pull request kubernetes-csi#217 from msau42/owners
a11216e add new reviewers and remove inactive reviewers
dd98675 Add step for checking builds

git-subtree-dir: release-tools
git-subtree-split: 6613c39
sunnylovestiramisu added a commit to sunnylovestiramisu/csi-driver-host-path that referenced this pull request Apr 13, 2023
6613c39 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update
0e7ae99 Update k8s image repo url
77e47cc Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version
155854b Fix dep version mismatch
8f83905 Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update
1d3f94d Update go version to 1.20 to match k/k v1.27
e322ce5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error
b74a512 test: fix golint error
aa61bfd Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver
7563d19 Update CSI_PROW_DRIVER_VERSION to v1.11.0
a2171be Merge pull request kubernetes-csi#216 from msau42/process
cb98782 Merge pull request kubernetes-csi#217 from msau42/owners
a11216e add new reviewers and remove inactive reviewers
dd98675 Add step for checking builds

git-subtree-dir: release-tools
git-subtree-split: 6613c39
sunnylovestiramisu added a commit to sunnylovestiramisu/csi-driver-host-path that referenced this pull request Apr 13, 2023
6613c39 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update
0e7ae99 Update k8s image repo url
77e47cc Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version
155854b Fix dep version mismatch
8f83905 Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update
1d3f94d Update go version to 1.20 to match k/k v1.27
e322ce5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error
b74a512 test: fix golint error
aa61bfd Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver
7563d19 Update CSI_PROW_DRIVER_VERSION to v1.11.0
a2171be Merge pull request kubernetes-csi#216 from msau42/process
cb98782 Merge pull request kubernetes-csi#217 from msau42/owners
a11216e add new reviewers and remove inactive reviewers
dd98675 Add step for checking builds

git-subtree-dir: release-tools
git-subtree-split: 6613c39
TerryHowe pushed a commit to TerryHowe/csi-driver-host-path that referenced this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants