From eb15d7332bf2428a8fd388d10db8e61b49808a4c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 15 Sep 2022 14:23:44 +0200 Subject: [PATCH] Remove sudo commands from cluster-related CI scripts --- ci-scripts/cls_cluster.py | 14 +------------- ci-scripts/cls_containerize.py | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index 86edfbe568..af73051436 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -141,18 +141,6 @@ class Cluster: def _retag_image_statement(self, sshSession, oldImage, newImage, newTag, filename): sshSession.command(f'sed -i -e "s#{oldImage}:latest#{newImage}:{newTag}#" {filename}', '\$', 5) - def _pull_image(self, sshSession, image, tag): - sshSession.command(f'oc whoami -t | sudo podman login -u oaicicd --password-stdin https://{self.OCRegistry} --tls-verify=false', '\$', 5, silent=True) - if sshSession.getBefore().count('Login Succeeded!') == 0: - return None - imageName = f'{self.OCRegistry}{self.OCProjectName}/{image}:{tag}' - sshSession.command(f'sudo podman pull {imageName} --tls-verify=false', '\$', 300) - pullResult = sshSession.getBefore() - sshSession.command(f'sudo podman logout https://{self.OCRegistry}', '\$', 10, silent=True) - if pullResult.count('Storing signatures') == 0: - return None - return imageName - def _get_image_size(self, sshSession, image, tag): # get the SHA of the image we built using the image name and its tag sshSession.command(f'oc describe is {image} | grep -A4 {tag}', '\$', 5) @@ -216,7 +204,7 @@ class Cluster: # Workaround for some servers, we need to erase completely the workspace if self.forcedWorkspaceCleanup: - mySSH.command(f'sudo rm -Rf {lSourcePath}', '\$', 15) + mySSH.command(f'rm -Rf {lSourcePath}', '\$', 15) cls_containerize.CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) # we don't necessarily need a forced workspace cleanup, but in diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index bc3d43a83e..6197cc7e4f 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -67,7 +67,7 @@ def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTarge sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) - sshSession.command('sudo git clean -x -d -ff', '\$', 30) + sshSession.command('git clean -x -d -ff', '\$', 30) sshSession.command('mkdir -p cmake_targets/log', '\$', 5) # if the commit ID is provided use it to point to it if ranCommitID != '':