Skip to content

fix(kubectl, rancher, artifactory, general)#30

Merged
ikogan merged 1 commit into
mainfrom
cs/adp-connect-resiliency
May 14, 2026
Merged

fix(kubectl, rancher, artifactory, general)#30
ikogan merged 1 commit into
mainfrom
cs/adp-connect-resiliency

Conversation

@ikogan
Copy link
Copy Markdown
Contributor

@ikogan 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
Copilot AI review requested due to automatic review settings May 14, 2026 19:35
@ikogan ikogan merged commit a59a088 into main May 14, 2026
5 of 6 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 gum prompts 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 thread adp-connect.sh
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
Comment thread adp-connect.sh
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 thread adp-connect.sh
Comment on lines +643 to +645
A) FORCE_ADD_MORE_ARGOCD="true"
SETUP_INTERNAL_SERVICES="true"
;;
Comment thread adp-connect.sh
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 thread adp-connect.sh
Comment on lines +189 to +191
gum input --password --width=80 --placeholder="Artifactory Token"

echo "${ARTIFACTORY_TOKEN}" | tr -d '[:space:]'
Comment thread adp-connect.sh
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 thread adp-connect.sh
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 thread adp-connect.sh
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."
Comment thread adp-connect.sh
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."
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.

6 participants