示例#1
0
    def test_jenkins_local(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        engines = dict(anaconda2="C:\\Anaconda2", anaconda3="C:\\Anaconda3",
                       winpython="C:\\WinPython-64bit-3.4.2.3\\python-3.4.2.amd64",
                       default="c:\\PythonXX_x64", py27="c:\\Python27", py35="c:\\Python35_x64",
                       py36="c:\\Python36_x64", Python34="py34", Python35="py35",
                       Python36="py36", Anaconda3="apy35", Anaconda2="apy27",
                       Python27="py27", WinPython35="wpy35", WinPython36="wpy36",
                       Python35pyq="DDD", Python37="py37")
        vers = "%d%d" % sys.version_info[:2]
        engines["Python" + vers] = "py" + vers

        js = JenkinsExt('http://machine:8080/', "user",
                        "password", mock=True, engines=engines, fLOG=fLOG)

        if sys.platform.startswith("win"):
            res = setup_jenkins_server(js,
                                       overwrite=True,
                                       location=r"c:\\jenkins\\pymy",
                                       prefix="_node_")
            self.assertGreater(len(res), 0)

            job = "pyrsslocal [py35] <-- pyquickhelper, pyensae"
            cmd = "\n".join(js.get_jenkins_script(job))
            if "PythonXX" in cmd:
                raise Exception(cmd)
"""
import sys
import os
sys.path.append("../pyquickhelper/src")
sys.path.append("../pyensae/src")
sys.path.append("../ensae_teaching_cs/src")
sys.path.append("../pymyinstall/src")

from pyquickhelper import fLOG
from pyquickhelper.jenkinshelper import JenkinsExt
from ensae_teaching_cs.automation.jenkins_helper import setup_jenkins_server, engines_default

fLOG(OutputPrint=True)
fLOG("start")

js = JenkinsExt('http://localhost:8080/', None, None,
                fLOG=fLOG, engines=engines_default)
# js.delete_all_jobs()

if True:
    setup_jenkins_server(js,
                         overwrite=True,
                         location=r"c:\\jenkins\\pymy")

if False:
    setup_jenkins_server(js,
                         overwrite=True,
                         location=r"c:\\jenkins\\pymy_nodep",
                         no_dep=True,
                         prefix="_nodep_")
#########################################
# import des fonctions dont on a besoin

from pyquickhelper.jenkinshelper import JenkinsExt
from ensae_teaching_cs.automation.jenkins_helper import setup_jenkins_server, engines_default

#########################################
# récupération des identifiants Jenkins

user = keyring.get_password("jenkins", "_automation,user")
pwd = keyring.get_password("jenkins", "_automation,pwd")

#########################################
# instantiation d'une classe faisant l'interface avec le service
platform = sys.platform
if platform.startswith("win"):
    location = "d:\\jenkins\\pymy"
else:
    location = "/var/lib/jenkins/workspace"

js = JenkinsExt('http://localhost:8080/', user, pwd, platform=platform,
                fLOG=fLOG, engines=engines_default(platform=platform))

#########################################
# mise à jour des jobs
setup_jenkins_server(js, overwrite=True,
                     delete_first=False,
                     location="d:\\jenkins\\pymy",
                     disable_schedule=False)
示例#4
0
platform = "linux"
if pwd is None:
    raise RuntimeError("Password is missing (None).")
fLOG('password has been recovered.')

#########################################
# instantiation d'une classe faisant l'interface avec le service
if platform.startswith("win"):
    letter = "d" if os.path.exists("d:") else "c"
    location = letter + ":\\jenkins\\pymy"
else:
    location = "/var/lib/jenkins/workspace"

engines = engines_default(platform=platform)
fLOG("------------")
for k, v in sorted(engines.items()):
    fLOG("    {0}='{1}'".format(k, v))
fLOG("------------")
fLOG("check:", [user, host])
fLOG("------------")

js = JenkinsExt('http://{0}:8080/'.format(host), user, pwd,
                fLOG=fLOG, engines=engines, platform=platform)

#########################################
# mise à jour des jobs
setup_jenkins_server(js, overwrite=True,
                     delete_first=False,
                     location=location,
                     disable_schedule=False)
import sys
import os
sys.path.append("../pyquickhelper/src")
sys.path.append("../pyensae/src")
sys.path.append("../ensae_teaching_cs/src")
sys.path.append("../pymyinstall/src")

from pyquickhelper import fLOG
from pyquickhelper.jenkinshelper import JenkinsExt
from ensae_teaching_cs.automation.jenkins_helper import setup_jenkins_server, engines_default

fLOG(OutputPrint=True)
fLOG("start")

js = JenkinsExt('http://localhost:8080/',
                None,
                None,
                fLOG=fLOG,
                engines=engines_default)
# js.delete_all_jobs()

if True:
    setup_jenkins_server(js, overwrite=True, location=r"c:\\jenkins\\pymy")

if False:
    setup_jenkins_server(js,
                         overwrite=True,
                         location=r"c:\\jenkins\\pymy_nodep",
                         no_dep=True,
                         prefix="_nodep_")