From c7c8dffb7cecf9af30e2cb075d3249841b080657 Mon Sep 17 00:00:00 2001 From: Vipul Bansal Date: Sat, 22 Jun 2024 15:33:52 +0000 Subject: [PATCH] [BACKPORT 2024.1][PLAT-14368]: Fix release GC in yml task. Summary: Fixes release GC code and tail -n +x prints line from (x+1) as we always want to retain last old release. Earlier, it was tail -n +3 but this also removes the old release so modified to 4. Original diff/commit: fe19c06/D36074 Test Plan: Tested manually Reviewers: sanketh, svarshney Reviewed By: svarshney Subscribers: yugaware Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D36133 --- managed/devops/roles/install_package/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/managed/devops/roles/install_package/tasks/main.yml b/managed/devops/roles/install_package/tasks/main.yml index 9fa9425f50c7..e73ac9beaefa 100644 --- a/managed/devops/roles/install_package/tasks/main.yml +++ b/managed/devops/roles/install_package/tasks/main.yml @@ -112,7 +112,7 @@ # doing num_releases_to_keep + 2 because we need to protect 'TEMPORARY' directory under yb-software - name: Remove older yb software folders shell: "ls --ignore='ybc*' \"{{ yb_software_dir }}\" -t | \ - tail -n +{{ num_releases_to_keep + 2 }} | \ + tail -n +{{ num_releases_to_keep + 3 }} | \ xargs -I{} --no-run-if-empty rm -rv \"{{ yb_software_dir }}/{}\" --" register: rm_yb_softwares_result tags: