@@ -134,6 +134,54 @@ def bump( # noqa: C901
134134 print (success ("Done!" ))
135135
136136
137+ @task
138+ def redeploy (
139+ ctx : Any ,
140+ filter : str ,
141+ exclude : str = "" ,
142+ autoexclude_inactive : bool = True ,
143+ interactive : bool = True ,
144+ push : bool = False ,
145+ skip_migrations : bool = False ,
146+ ) -> None :
147+ """Force redeploy selected app(s) without changing their image tag.
148+ Updates a UUID bump field to trigger a new deployment.
149+ Provide `push` to automatically push the commit (and retry on conflict.)
150+ Provide `skip_migrations` to disable running migrations via helm hooks.
151+ """
152+ try :
153+ apps = get_apps (
154+ filter = filter ,
155+ exclude = exclude ,
156+ autoexclude_inactive = autoexclude_inactive ,
157+ message = f"{ colourise ('The following apps will be redeployed:' , Fore .LIGHTBLUE_EX )} " ,
158+ load_secrets = False ,
159+ mode = "PROMPT" if interactive else "SILENT" ,
160+ )
161+ except AppOperationAborted :
162+ print (success_negative ("Aborted." ))
163+ return
164+
165+ if push :
166+ run (f"cd { get_apps_directory ()} ; git pull" )
167+
168+ for app in apps :
169+ print (f"Redeploying { colourise (app .name , Fore .LIGHTGREEN_EX )} " )
170+ update_app (app .name , ** {"bump" : str (uuid .uuid4 ())})
171+
172+ commit_message = f"Redeploying { filter } "
173+ if exclude :
174+ commit_message += f" (except { exclude } )"
175+ if skip_migrations :
176+ commit_message += " --skip-migrations"
177+ run (f'cd { get_apps_directory ()} ; git commit -am "{ commit_message } ."' )
178+
179+ if push :
180+ git_push (get_apps_directory ())
181+
182+ print (success ("Done!" ))
183+
184+
137185@task
138186def command (
139187 ctx : Any ,
0 commit comments