mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 18:28:13 +00:00 
			
		
		
		
	hack/update-codegen.sh: fix finding items in an array.
The current code
  if ! [[ " ${INTERNAL_DIRS[@]:-} " =~ " ${int_group} " ]]; then
is broken because the array is concatenated in [[ .. ]] structure. This
means that the match will be done to any substring in the resulting
string which just happens to include ${int_group}. Fix this to use a
loop instead, and do exact matching. Also make tabs consistent in the
for loop.
			
			
This commit is contained in:
		| @@ -50,20 +50,28 @@ for gv in "${GROUP_VERSIONS[@]}"; do | ||||
|  | ||||
|  | ||||
| 	# skip groups that aren't being served, clients for these don't matter | ||||
|     if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${gv} "* ]]; then | ||||
|       continue | ||||
|     fi | ||||
| 	if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${gv} "* ]]; then | ||||
| 		continue | ||||
| 	fi | ||||
|  | ||||
| 	GV_DIRS+=("${pkg_dir}") | ||||
|  | ||||
| 	# collect internal groups | ||||
| 	int_group="${pkg_dir%/*}/" | ||||
| 	if [[ "${pkg_dir}" = core/* ]]; then | ||||
| 	  int_group="api/" | ||||
| 		int_group="api/" | ||||
| 	fi | ||||
|  | ||||
| 	found=0 | ||||
| 	for dir in "${INTERNAL_DIRS[@]}"; do | ||||
| 		if [[ "$dir" = "$int_group" ]]; then | ||||
| 			found=1 | ||||
| 			break | ||||
| 		fi | ||||
| 	done | ||||
| 	if [[ $found = 0 ]]; then | ||||
| 		INTERNAL_DIRS+=("$int_group") | ||||
| 	fi | ||||
|     if ! [[ " ${INTERNAL_DIRS[@]:-} " =~ " ${int_group} " ]]; then | ||||
|       INTERNAL_DIRS+=("${int_group}") | ||||
|     fi | ||||
| done | ||||
| # delimit by commas for the command | ||||
| GV_DIRS_CSV=$(IFS=',';echo "${GV_DIRS[*]// /,}";IFS=$) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Ismo Puustinen
					Ismo Puustinen