-
Bug
-
Resolution: Done
-
Undefined
-
None
-
IOP-POC-0.1
-
False
-
-
False
-
-
Description of the problem:
When attempting to run install-helm-chart.sh , it fails trying to retrieve the helm release from github because there are multiple releases and it is not filtering for the latest.
How reproducible:
100%
Steps to reproduce:
1. Run install-helm-chart.sh on an ocp cluster
Actual results:
$ ./install-helm-chart.sh (⎈|admin:N/A)[INFO] ROS-OCP Helm Chart Installation [INFO] =============================== [INFO] Checking prerequisites for Helm chart installation... [INFO] Checking kubectl context... [INFO] Current kubectl context: admin [SUCCESS] All prerequisites are met [INFO] Detecting platform... f[SUCCESS] Detected OpenShift platform [INFO] Using OpenShift-specific values file [INFO] Configuration: [INFO] Platform: openshift [INFO] Helm Release: ros-ocp [INFO] Namespace: ros-ocp [INFO] Values File: /home/ccrum/git/insights-on-prem/ros-ocp-backend/deployment/kubernetes/scripts/../../../openshift-values.yaml[INFO] Creating namespace: ros-ocp [WARNING] Namespace 'ros-ocp' already exists [INFO] Checking for potential Kafka cluster ID conflicts... [SUCCESS] No Kafka cluster ID conflicts detected [INFO] Deploying ROS-OCP Helm chart... [INFO] Using GitHub release (USE_LOCAL_CHART=false) [INFO] Downloading latest Helm chart from GitHub... [INFO] Fetching latest release information from GitHub... [INFO] Latest release: v0.1.1 [INFO] Downloading: ros-ocp-0.1.1.tgz ros-ocp-latest.tgz [INFO] From: https://github.com/insights-onprem/ros-helm-chart/releases/download/v0.1.1/ros-ocp-0.1.1.tgz https://github.com/insights-onprem/ros-helm-chart/releases/download/v0.1.1/ros-ocp-latest.tgz curl: (3) URL rejected: Malformed input to a URL function [ERROR] Failed to download chart from GitHub [ERROR] Failed to download latest chart from GitHub [INFO] Fallback: Set USE_LOCAL_CHART=true to use local chart
Expected results:
Successful install
Analysis{}
# Extract the tag name and download URL for the .tgz file
local tag_name=$(echo "$latest_release" | jq -r '.tag_name')
local download_url=$(echo "$latest_release" | jq -r '.assets[] | select(.name | endswith(".tgz")) | .browser_download_url')
local filename=$(echo "$latest_release" | jq -r '.assets[] | select(.name | endswith(".tgz")) | .name')
The problem was that select(.name | endswith(".tgz")) matched both .tgz files in the release:
- ros-ocp-0.1.1.tgz
- ros-ocp-latest.tgz
So $download_url contained two URLs separated by a newline:
https://github.com/insights-onprem/ros-helm-chart/releases/download/v0.1.1/ros-ocp-0.1.1.tgz
https://github.com/insights-onprem/ros-helm-chart/releases/download/v0.1.1/ros-ocp-latest.tgz
When curl tried to download using this multi-line URL, it failed with "URL rejected: Malformed input to a URL function".
- links to