@@ -29,6 +29,13 @@ def wait_for_resource_status(
2929 capture_output = True ,
3030 text = True ,
3131 )
32+ if result .returncode != 0 :
33+ stderr = (result .stderr or "" ).strip ()
34+ if "not found" not in stderr .lower ():
35+ raise RuntimeError (
36+ f"Failed to read { kind } /{ name } in namespace { namespace } : { stderr } "
37+ )
38+
3239 current_state = parse_jsonpath_value (result .stdout or "" )
3340 if current_state == desired_state :
3441 print (
@@ -43,16 +50,17 @@ def wait_for_resource_status(
4350
4451
4552def semver_key (v_string ):
46- # Separate the numeric part from the tag (e.g., '1.2.0-rc1' -> ['1.2.0', 'rc1'])
47- parts = v_string .split ("-" , 1 )
48- main_version = tuple (map (int , parts [0 ].split ("." )))
53+ main , sep , prerelease = v_string .partition ("-" )
54+ main_version = tuple (map (int , main .split ("." )))
55+
56+ if not sep :
57+ # Release versions sort after prerelease versions with same core.
58+ return (main_version , ((2 , 0 ),))
4959
50- if len (parts ) == 1 :
51- # No suffix: Use a high-value marker so 1.2.0 > 1.2.0-rc1
52- return (main_version , (float ("inf" ),))
53- else :
54- # Has suffix: Return the numeric part and the string tag
55- return (main_version , (0 , parts [1 ]))
60+ parsed = []
61+ for token in prerelease .split ("." ):
62+ parsed .append ((0 , int (token )) if token .isdigit () else (1 , token ))
63+ return (main_version , tuple (parsed ))
5664
5765
5866def approve_install_plans (
@@ -83,8 +91,14 @@ def approve_install_plans(
8391 continue
8492 version_ok = True
8593 for csv in install_plan_spec_csv_names :
86- csv_op_name , csv_version = csv .split (".v" )
94+ csv_op_name , csv_version = csv .rsplit (".v" , 1 )
8795 desired_op_version = approved_op_version_map .get (csv_op_name )
96+ if desired_op_version is None :
97+ version_ok = False
98+ print (
99+ f"Install plan { install_plan_name } includes unmanaged CSV { csv_op_name } . Skipping."
100+ )
101+ break
88102 version_ok = semver_key (csv_version ) <= semver_key (desired_op_version )
89103 if not version_ok :
90104 print (
0 commit comments