fix(kubectl, rancher, artifactory, general)#30
Merged
Conversation
Contributor
ikogan
commented
May 14, 2026
- Fix kubectl version handling not working at all
- Fix artifactory configuration
- Ensure CTRL+C properly terminates even on gum inputs
- Further fix cases where unavailable Rancher servers break things
- Fix kubectl version handling not working at all - Fix artifactory configuration - Ensure CTRL+C properly terminates even on gum inputs - Further fix cases where unavailable Rancher servers break things
chinmaya-n
approved these changes
May 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates adp-connect.sh to improve interactive cancellation behavior, Rancher availability handling, kubectl version targeting, and Artifactory/ArgoCD setup behavior.
Changes:
- Adds interrupt handling around
gumprompts and redirects instruction output away from captured stdout. - Tracks reachable Rancher servers and uses reachable cluster versions to choose a kubectl target.
- Updates Artifactory credential prompts/repo setup and adds a devcontainer feature lock file.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
adp-connect.sh |
Main script updates for interrupt handling, Rancher validation, kubectl version logic, ArgoCD flag behavior, and Artifactory setup. |
.devcontainer/devcontainer-lock.json |
Adds a lock entry for the docker-outside-of-docker devcontainer feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+907
to
+909
| if [[ ${#REACHABLE_RANCHER_SERVERS[@]} -eq 0 ]]; then | ||
| warn "No reachable Rancher servers are available. Skipping kubeconfig and kubectl version setup." | ||
| elif [[ ${#KUBE_CLUSTER_VERSIONS[@]} -eq 0 ]]; then |
| install_kubectl "${KUBE_LATEST_VERSION}" || exit 1 | ||
| install_kubectl "${KUBE_TARGET_VERSION}" || exit 1 | ||
| else | ||
| KUBECTL_CLIENT_VERSION=$(kubectl version --client -o yaml 2>/dev/null | yq -r '.clientVersion.gitVersion' | sed -E 's/^([vV]?[0-9]+\.[0-9]+\.[0-9]+).*/\1/') |
Comment on lines
+643
to
+645
| A) FORCE_ADD_MORE_ARGOCD="true" | ||
| SETUP_INTERNAL_SERVICES="true" | ||
| ;; |
Comment on lines
+204
to
+211
| ver1_major=$(echo "${ver1}" | cut -d. -f1) | ||
| ver1_minor=$(echo "${ver1}" | cut -d. -f2) | ||
| ver1_patch=$(echo "${ver1}" | cut -d. -f3) | ||
|
|
||
| ver2_major=$(echo "${ver2}" | cut -d. -f1) | ||
| ver2_minor=$(echo "${ver2}" | cut -d. -f2) | ||
| ver2_patch=$(echo "${ver2}" | cut -d. -f3) | ||
|
|
Comment on lines
+189
to
+191
| gum input --password --width=80 --placeholder="Artifactory Token" | ||
|
|
||
| echo "${ARTIFACTORY_TOKEN}" | tr -d '[:space:]' |
Comment on lines
1311
to
1312
| if [[ -n "${ARTIFACTORY_TOKEN}" ]] && [[ -n "${USER_OHIOID}" ]]; then | ||
| info "Adding Artifactory helm repository..." | ||
| [[ -z "${USER_OHIOID}" ]] && USER_OHIOID="$(get_ohioid)" | ||
| [[ -z "${ARTIFACTORY_TOKEN}" ]] && ARTIFACTORY_TOKEN="$(get_artifactory_token)" | ||
| helm repo add artifactory https://"${DEFAULT_ARTIFACTORY_HOSTNAME}"/artifactory/helm --username="${USER_OHIOID}" --password-stdin <<< "${ARTIFACTORY_TOKEN}" || exit 1 |
Comment on lines
1326
to
1327
| if [[ -n "${ARTIFACTORY_TOKEN}" ]] && [[ -n "${USER_OHIOID}" ]]; then | ||
| info "Adding Artifactory helm repository with push access..." | ||
| [[ -z "${USER_OHIOID}" ]] && USER_OHIOID="$(get_ohioid)" | ||
| [[ -z "${ARTIFACTORY_TOKEN}" ]] && ARTIFACTORY_TOKEN="$(get_artifactory_token)" | ||
| helm repo add artifactory-push https://"${DEFAULT_ARTIFACTORY_HOSTNAME}"/artifactory/oit-helm --username="${USER_OHIOID}" --password-stdin <<< "${ARTIFACTORY_TOKEN}" || exit 1 |
Comment on lines
852
to
855
| curl -s --connect-timeout 5 --max-time 10 "https://${SERVER}/ping" > /dev/null 2>&1 | ||
| CURL_EXIT=$? | ||
| if [[ $CURL_EXIT -eq 6 ]] || [[ $CURL_EXIT -eq 7 ]] || [[ $CURL_EXIT -eq 28 ]] || [[ $CURL_EXIT -eq 35 ]]; then | ||
| warn "⚠️ Warning: Unable to reach Rancher server ${SERVER} (connection, timeout, or TLS error). Skipping." |
| rancher server switch "${NEW_RANCHER_SERVER_NAME}" 2> >(grep -v "Saving config" >&2) >/dev/null | ||
| rancher context switch "$(KUBECONFIG="$HOME/.kube/config.incomplete" kubectl get namespace "${NEW_NAMESPACE}" -o yaml | yq -r '.metadata.annotations."field.cattle.io/projectId"')" 2> >(grep -v "Saving config" >&2) >/dev/null | ||
| else | ||
| warn "Skipping Rancher context switch because ${NEW_RANCHER_SERVER_NAME} is unreachable." |
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.