mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Merge pull request #44109 from cblecker/swagger-hack-fix
Automatic merge from submit-queue (batch tested with PRs 44104, 43903, 44109) Update gen_api_ref_docs to use same diff method as verify **What this PR does / why we need it**: Fixes an issue where there is a discrepancy between the update and verify diff methods for the api-reference-docs. This can create a situation where verify will see changes, but update won't fix them. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #31129 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
		@@ -130,17 +130,10 @@ kube::swagger::gen_api_ref_docs() {
 | 
				
			|||||||
  while read file; do
 | 
					  while read file; do
 | 
				
			||||||
    if [[ -e "${output_dir}/${file}" && -e "${output_tmp}/${file}" ]]; then
 | 
					    if [[ -e "${output_dir}/${file}" && -e "${output_tmp}/${file}" ]]; then
 | 
				
			||||||
      echo "comparing ${output_dir}/${file} with ${output_tmp}/${file}"
 | 
					      echo "comparing ${output_dir}/${file} with ${output_tmp}/${file}"
 | 
				
			||||||
      # Filter all munges from original content.
 | 
					 | 
				
			||||||
      original=$(cat "${output_dir}/${file}")
 | 
					 | 
				
			||||||
      generated=$(cat "${output_tmp}/${file}")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      # Filter out meaningless lines with timestamps
 | 
					 | 
				
			||||||
      original=$(echo "${original}" | grep -v "Last updated" || :)
 | 
					 | 
				
			||||||
      generated=$(echo "${generated}" | grep -v "Last updated" || :)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # By now, the contents should be normalized and stripped of any
 | 
					      # By now, the contents should be normalized and stripped of any
 | 
				
			||||||
      # auto-managed content.
 | 
					      # auto-managed content.
 | 
				
			||||||
      if diff -B >/dev/null <(echo "${original}") <(echo "${generated}"); then
 | 
					      if diff -NauprB -I 'Last update' "${output_dir}/${file}" "${output_tmp}/${file}" >/dev/null; then
 | 
				
			||||||
        # actual contents same, overwrite generated with original.
 | 
					        # actual contents same, overwrite generated with original.
 | 
				
			||||||
        cp "${output_dir}/${file}" "${output_tmp}/${file}"
 | 
					        cp "${output_dir}/${file}" "${output_tmp}/${file}"
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user