mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-10-31 09:26:52 +00:00 
			
		
		
		
	tools: Rewrite the logic around kata-deploy changes
We can simplify the code a little bit, as at least now we group common operationr together. Hopefully this will improve the maintainability and the readability of the code. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
		| @@ -150,24 +150,26 @@ bump_repo() { | |||||||
| 		#  -------------------+----------------+----------------+ | 		#  -------------------+----------------+----------------+ | ||||||
|  |  | ||||||
| 		info "Updating kata-deploy / kata-cleanup image tags" | 		info "Updating kata-deploy / kata-cleanup image tags" | ||||||
| 		if [ "${target_branch}" == "main" ] && [[ "${new_version}" =~ "rc" ]]; then | 		local version_to_replace="${current_version}" | ||||||
| 			# case 2) | 		local replacement="${new_version}" | ||||||
| 			## change the "latest" tag to the "#{new_version}" one | 		if [ "${target_branch}" == "main" ]; then | ||||||
| 			sed -i "s#quay.io/kata-containers/kata-deploy:latest#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml | 			if [[ "${new_version}" =~ "rc" ]]; then | ||||||
| 			sed -i "s#quay.io/kata-containers/kata-deploy:latest#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml | 				## this is the case 2) where we remove te kata-deploy / kata-cleanup stable files | ||||||
|  |  | ||||||
| 			git diff |  | ||||||
|  |  | ||||||
| 			git add tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml |  | ||||||
| 			git add tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml |  | ||||||
|  |  | ||||||
| 			## and remove the kata-deploy & kata-cleanup stable yaml files |  | ||||||
| 				git rm tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml | 				git rm tools/packaging/kata-deploy/kata-deploy/base/kata-deploy-stable.yaml | ||||||
| 				git rm tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stable.yaml | 				git rm tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup-stable.yaml | ||||||
| 		elif [[ "${target_branch}" =~ "stable" ]]; then | 			else | ||||||
| 			# case 3) | 				## this is the case 1) where we just do nothing | ||||||
| 			sed -i "s#quay.io/kata-containers/kata-deploy:${current_version}#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml | 				replacement="latest" | ||||||
| 			sed -i "s#quay.io/kata-containers/kata-deploy:${current_version}#quay.io/kata-containers/kata-deploy:${new_version}#g" tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml | 			fi | ||||||
|  |  | ||||||
|  | 			version_to_replace="latest" | ||||||
|  | 		fi | ||||||
|  |  | ||||||
|  | 		if [ "${version_to_replace}" != "${replacement}" ]; then | ||||||
|  | 			## this covers case 2) and 3), as on both of them we have changes on kata-deploy / kata-cleanup  files | ||||||
|  | 			sed -i "s#quay.io/kata-containers/kata-deploy:${version_to_replace}#quay.io/kata-containers/kata-deploy:${replacement}#g" tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml | ||||||
|  | 			sed -i "s#quay.io/kata-containers/kata-deploy:${version_to_replace}#quay.io/kata-containers/kata-deploy:${replacement}#g" tools/packaging/kata-deploy/kata-cleanup/base/kata-cleanup.yaml | ||||||
|  |  | ||||||
| 			git diff | 			git diff | ||||||
|  |  | ||||||
| 			git add tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml | 			git add tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user