From e8603e45deca90eb81aacfd5bff2ef7a6c6acab0 Mon Sep 17 00:00:00 2001 From: vavuthu Date: Thu, 27 Jun 2024 10:47:07 +0530 Subject: [PATCH] openshift installer download using oc Signed-off-by: vavuthu --- ocs_ci/utility/utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ocs_ci/utility/utils.py b/ocs_ci/utility/utils.py index 4b4b39de5a8..830013b661b 100644 --- a/ocs_ci/utility/utils.py +++ b/ocs_ci/utility/utils.py @@ -809,11 +809,12 @@ def get_openshift_installer( # record current working directory and switch to BIN_DIR previous_dir = os.getcwd() os.chdir(bin_dir) - tarball = f"{installer_filename}.tar.gz" - url = get_openshift_mirror_url(installer_filename, version) - download_file(url, tarball) - run_cmd(f"tar xzvf {tarball} {installer_filename}") - delete_file(tarball) + pull_secret_path = os.path.join(constants.DATA_DIR, "pull-secret") + cmd = ( + f"oc adm release extract --registry-config {pull_secret_path} --command={installer_filename} " + f"--to ./ registry.ci.openshift.org/ocp/release:{version}" + ) + exec_cmd(cmd) # return to the previous working directory os.chdir(previous_dir)