# CONST
UPDATE_HELPER = "update_helper.sh"
+REPO_HELPER = "repo_helper.sh"
SSH_PARAMS = ["-o", "UserKnownHostsFile=/dev/null",
"-o", "StrictHostKeyChecking=no"]
cfg["PREPARE_CLUSTER"] = os.getenv("PREPARE_CLUSTER")
cfg["UPDATE_FUEL"] = os.getenv("UPDATE_FUEL")
+cfg["ADD_CENT_REPO"] = os.getenv("ADD_CENT_REPO")
cfg["RELEASE"] = os.getenv("RELEASE")
cfg["HA"] = os.getenv("HA")
cfg["NETWORK_TYPE"] = os.getenv("NETWORK_TYPE")
return False
+def add_cent_repo(node, repolist):
+ if node.put_file(REPO_HELPER):
+ i = 1
+ for repo in repolist.split('\n'):
+ if not node.execute(["/tmp/"+REPO_HELPER,"add"+str(i), repo]):
+ print ("ERROR: Unable to add repo " + repo)
+ return False
+ i = i + 1
+ return True
+ else:
+ print ("ERROR: Unable to copy repo script to admin node")
+ return False
+
+
def do_update(node):
if node.put_file(UPDATE_HELPER):
return node.execute(["/tmp/"+UPDATE_HELPER])
admin_node=SSHHost(usr = cfg["FUEL_SSH_USERNAME"],
subnet=cfg["ADMIN_SUBNET"],
- psw = cfg["FUEL_SSH_PASSWORD"],)
+ pswd = cfg["FUEL_SSH_PASSWORD"],)
+
+ if cfg["ADD_CENT_REPO"]!="":
+ add_cent_repo(cfg["ADD_CENT_REPO"])
if cfg["UPDATE_FUEL"]=="true":
if do_update(admin_node):
if func:
print "\033[32mOK\033[00m - "+name
else:
- print "\033[31mOK\033[00m - "+name
+ print "\033[31mFAIL\033[00m - "+name
def main():
# NOTE: can take too many time...
test_bool("do update",
build_cluster.do_update (node))
+ repolist='''http://mirror.fuel-infra.org/mos-repos/centos/mos9.0-centos7/updates/x86_64/
+ http://mirror.fuel-infra.org/mos-repos/centos/mos9.0-centos7/security/x86_64/
+ '''
+ test_bool("add repo",
+ build_cluster.add_cent_repo(node,repolist))
+
+ test_bool("add repo helper file",
+ node.execute(["test", "-f","/tmp/repo_helper.sh"]))
+
+ test_bool("add repo check repo file 1",
+ node.execute(["test", "-f","/etc/yum.repos.d/add1.repo"]))
+
+ test_bool("add repo rm repo file 1",
+ node.execute(["rm", "-f","/etc/yum.repos.d/add1.repo"]))
+
+ test_bool("add repo check repo file 2",
+ node.execute(["test", "-f","/etc/yum.repos.d/add2.repo"]))
+
+ test_bool("add repo rm repo file 2",
+ node.execute(["rm", "-f","/etc/yum.repos.d/add2.repo"]))
if __name__ == "__main__":
main()
<description>Tag is used in name of build.</description>
<defaultValue></defaultValue>
</hudson.model.StringParameterDefinition>
- <hudson.model.StringParameterDefinition>
+ <jp.ikedam.jenkins.plugins.extensible__choice__parameter.ExtensibleChoiceParameterDefinition plugin="extensible-choice-parameter@1.3.2">
<name>ISO_URL</name>
- <description>Required! Can be direct URL or URL to torrent-file. Public ISOs are available here - <b>http://vault.infra.mirantis.net/</b></description>
- <defaultValue></defaultValue>
- </hudson.model.StringParameterDefinition>
+ <description><b><a href="http://vault.infra.mirantis.net/">http://vault.infra.mirantis.net/</a></b> - public ISOs are available here.
+Required! Can be direct URL or URL to torrent-file. </description>
+ <editable>true</editable>
+ <choiceListProvider class="jp.ikedam.jenkins.plugins.extensible_choice_parameter.TextareaChoiceListProvider">
+ <choiceList class="java.util.RandomAccessSubList">
+ <l class="java.util.Arrays$ArrayList">
+ <a class="string-array">
+ <string>http://vault.infra.mirantis.net/MirantisOpenStack-9.0.iso.torrent</string>
+ <string>http://vault.infra.mirantis.net/MirantisOpenStack-8.0.iso.torrent</string>
+ <string>http://vault.infra.mirantis.net/MirantisOpenStack-7.0.iso.torrent</string>
+ <string>http://vault.infra.mirantis.net/MirantisOpenStack-6.1.iso.torrent</string>
+ <string>http://vault.infra.mirantis.net/MirantisOpenStack-5.1.1.iso.torrent</string>
+ <string></string>
+ </a>
+ </l>
+ <offset>0</offset>
+ <size>5</size>
+ </choiceList>
+ </choiceListProvider>
+ </jp.ikedam.jenkins.plugins.extensible__choice__parameter.ExtensibleChoiceParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>NODES_COUNT</name>
<description>Quantity of cluster nodes without fuel-master node.</description>
</hudson.model.BooleanParameterDefinition>
<hudson.model.BooleanParameterDefinition>
<name>UPDATE_FUEL</name>
- <description>Update fuel version to latest MU (7.0 and 8.0 only)</description>
+ <description>Update fuel version to latest MU (7.0 and 8.0 only) or upgrade release 9.x (9.0 to 9.1)</description>
<defaultValue>false</defaultValue>
</hudson.model.BooleanParameterDefinition>
+ <hudson.model.TextParameterDefinition>
+ <name>ADD_CENT_REPO</name>
+ <description>Add repo url. One per line. It will be added as add<i>.repo</description>
+ <defaultValue></defaultValue>
+ </hudson.model.TextParameterDefinition>
<hudson.model.ChoiceParameterDefinition>
<name>NETWORK_TYPE</name>
<description>Choose a network type or leave it empty</description>
export ENV_NAME=${BUILD_USER_ID}-${BUILD_NUMBER}
export PYTHONUNBUFFERED=1
curl -o ./build_cluster.py "https://raw.githubusercontent.com/Mirantis/tools-sustaining/master/jenkins/build_cluster/build_cluster.py"
-curl -o ./update_helper.sh "https://raw.githubusercontent.com/Mirantis/tools-sustaining/master/jenkins/build_cluster/update_helper.sh"
curl -o ./scancodes.py "https://raw.githubusercontent.com/Mirantis/tools-sustaining/master/jenkins/build_cluster/scancodes.py"
+curl -o ./update_helper.sh "https://raw.githubusercontent.com/Mirantis/tools-sustaining/master/jenkins/build_cluster/update_helper.sh"
+curl -o ./update_helper.sh "https://raw.githubusercontent.com/Mirantis/tools-sustaining/master/jenkins/build_cluster/repo_helper.sh"
+
+chmod +x update_helper.sh
+chmod +x repo_helper.sh
python build_cluster.py
</org.jenkinsci.plugins.buildnamesetter.BuildNameSetter>
<org.jenkinsci.plugins.builduser.BuildUser plugin="build-user-vars-plugin@1.4"/>
</buildWrappers>
-</project>
+</project>
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+
+[ -z "$2" ] && exit
+
+cat > /etc/yum.repos.d/$1.repo <<-EOF
+[$1]
+name=$1
+baseurl=$2
+enabled=1
+gpgcheck=0
+EOF