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

chore(scripts): Fix OpenShift detection in setup-vcluster-env.sh #189

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

jopit
Copy link
Contributor

@jopit jopit commented Sep 26, 2024

The test to detect OpenShift in the setup-vcluster-env.sh script

	if kubectl api-resources | grep -q "openshift.io"; then
		OPENSHIFT=true
	fi

is not working. grep -q will return success as soon as it detects the first match. This will close the pipe between the kubectl command and the grep command. The kubectl command will then try to write its next result to the closed pipe, causing it to error out. Since the script has set set -o pipefail, the entire pipeline will then error out, resulting in the OPENSHIFT variable not being set.

This PR fixes this by forcing the kubectl step to always exit successfully.

Copy link
Collaborator

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

Good catch! I wasn't aware of kubectl's behaviour in this regard.

LGTM.

@jannfis jannfis merged commit 907be33 into argoproj-labs:main Sep 26, 2024
11 checks passed
@jopit jopit deleted the fix-setup-script branch September 27, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants