diff --git a/ci-scripts/Jenkinsfile-tmp-ran b/ci-scripts/Jenkinsfile-tmp-ran index 50e963e68b..bc8c742bb5 100644 --- a/ci-scripts/Jenkinsfile-tmp-ran +++ b/ci-scripts/Jenkinsfile-tmp-ran @@ -58,6 +58,8 @@ def eNB_CommitID def eNB_AllowMergeRequestProcess = false def eNB_TargetBranch +def flexricOption = "" + pipeline { agent { label pythonExecutor @@ -148,6 +150,13 @@ pipeline { allParametersPresent = false } + if (params.Flexric_Tag != null) { + echo "This pipeline is configured to run with a FlexRIC deployment." + echo "Appending FlexRicTag option to the list of options" + flexricOption = "--FlexRicTag=${params.Flexric_Tag}" + echo "Using new Flexric option: ${flexricOption}" + } + if (allParametersPresent) { echo "All parameters are present" if (eNB_AllowMergeRequestProcess) { @@ -158,8 +167,7 @@ pipeline { sh "git checkout -f ${eNB_CommitID}" } } else { - echo "Some parameters are missing" - sh "./ci-scripts/fail.sh" + error "Some parameters are missing" } } } @@ -190,13 +198,13 @@ pipeline { [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], ]) { - sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${mainPythonAllXmlFiles}" + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${flexricOption} ${mainPythonAllXmlFiles}" String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") for (xmlFile in myXmlTestSuite) { if (fileExists(xmlFile)) { try { timeout (time: 60, unit: 'MINUTES') { - sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --XMLTestFile=${xmlFile}" + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} ${flexricOption} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --XMLTestFile=${xmlFile}" } } catch (Exception e) { currentBuild.result = 'FAILURE' diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index 7d753d21c7..c1a13eb9bf 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -264,6 +264,9 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,CONTAINERS,HELP,SCA,PHYSIM,CLUSTER): elif re.match('^\-\-BuildId=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-BuildId=(.+)$', myArgv, re.IGNORECASE) RAN.BuildId = matchReg.group(1) + elif re.match('^\-\-FlexRicTag=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-FlexRicTag=(.+)$', myArgv, re.IGNORECASE) + CONTAINERS.flexricTag = matchReg.group(1) else: HELP.GenericHelp(CONST.Version) sys.exit('Invalid Parameter: ' + myArgv) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 29f78ad6b0..287144be86 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -176,10 +176,10 @@ def ExistEnvFilePrint(ssh, wd, prompt='env vars in existing'): logging.info(f'{prompt} {wd}/.env: {env_vars}') return True -def WriteEnvFile(ssh, services, wd, tag): +def WriteEnvFile(ssh, services, wd, tag, flexric_tag): ret = ssh.run(f'cat {wd}/.env', silent=True, reportNonZero=False) registry = "oai-ci" # pull_images() gives us this registry path - envs = {"REGISTRY":registry, "TAG": tag} + envs = {"REGISTRY":registry, "TAG": tag, "FLEXRIC_TAG": flexric_tag} if ret.returncode == 0: # it exists, we have to update # transforms env file to dictionary old_envs = {} @@ -340,6 +340,8 @@ class Containerize(): #checkers from xml self.ran_checkers={} + self.flexricTag = '' + #----------------------------------------------------------- # Container management functions #----------------------------------------------------------- @@ -859,7 +861,7 @@ class Containerize(): return False ExistEnvFilePrint(ssh, wd) - WriteEnvFile(ssh, services, wd, self.deploymentTag) + WriteEnvFile(ssh, services, wd, self.deploymentTag, self.flexricTag) logging.info(f"will start services {services}") status = ssh.run(f'docker compose -f {wd}/docker-compose.y*ml up -d -- {services}')