Exemple #1
0
def setup_jenkins_server(js, github="sdpython", modules=None,
                         overwrite=False, location=None, prefix="",
                         delete_first=False, disable_schedule=False,
                         fLOG=noLOG):
    """
    Sets up many jobs on :epkg:`Jenkins`.

    @param      js                      (JenkinsExt) jenkins server (specially if you need credentials)
    @param      github                  github account if it does not start with *http://*,
                                        the link to git repository of the project otherwise
    @param      modules                 modules for which to generate the :epkg:`Jenkins` job
                                        (see @see fn default_jenkins_jobs which provides the default value
                                        if *modules* is None)
    @param      overwrite               do not create the job if it already exists
    @param      location                None for default or a local folder
    @param      prefix                  add a prefix to the name
    @param      delete_first            remove all jobs first
    @param      disable_schedule        disable schedule for all jobs
    @param      fLOG                    logging function
    @return                             list of created jobs

    *modules* is a list defined as follows:

    * each element can be a string or a tuple (string, schedule time) or a list
    * if it is a list, it contains a list of elements defined as previously
    * the job at position i is not scheduled, it will start after the last
      job at position i-1 whether or not it fails
    """
    platform = js.platform
    if modules is None:
        modules = default_jenkins_jobs(platform=platform)
    r = setup_jenkins_server_yml(js, github=github, modules=modules, get_jenkins_script=None,
                                 overwrite=overwrite, location=location, prefix=prefix,
                                 delete_first=delete_first, disable_schedule=disable_schedule)
    return r
Exemple #2
0
def setup_jenkins_server(js, github="sdpython", modules=default_jenkins_jobs(),
                         overwrite=False, location=None, prefix="",
                         delete_first=False, disable_schedule=False, fLOG=noLOG):
    """
    Set up many jobs on Jenkins

    @param      js                      (JenkinsExt) jenkins server (specially if you need credentials)
    @param      github                  github account if it does not start with *http://*,
                                        the link to git repository of the project otherwise
    @param      modules                 modules for which to generate the Jenkins job (see @see fn default_jenkins_jobs)
    @param      get_jenkins_script      see `get_jenkins_script <http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/pyquickhelper/jenkinshelper/jenkins_server.html?highlight=get_jenkins_script#pyquickhelper.jenkinshelper.jenkins_server.JenkinsExt.get_jenkins_script>`_
                                        (default value if this parameter is None)
    @param      overwrite               do not create the job if it already exists
    @param      location                None for default or a local folder
    @param      prefix                  add a prefix to the name
    @param      delete_first            remove all jobs first
    @param      disable_schedule        disable schedule for all jobs
    @param      fLOG                    logging function
    @return                             list of created jobs

    *modules* is a list defined as follows:

    * each element can be a string or a tuple (string, schedule time) or a list
    * if it is a list, it contains a list of elements defined as previously
    * the job at position i is not scheduled, it will start after the last
      job at position i-1 whether or not it fails
    """
    r = setup_jenkins_server_yml(js, github=github, modules=modules, get_jenkins_script=None,
                                 overwrite=overwrite, location=location, prefix=prefix,
                                 delete_first=delete_first, disable_schedule=disable_schedule)
    return r
def setup_jenkins_server(js, github="sdpython", modules=None,
                         overwrite=False, location=None, prefix="",
                         delete_first=False, disable_schedule=False,
                         fLOG=noLOG):
    """
    Sets up many jobs on :epkg:`Jenkins`.

    @param      js                      (JenkinsExt) jenkins server (specially if you need credentials)
    @param      github                  github account if it does not start with *http://*,
                                        the link to git repository of the project otherwise
    @param      modules                 modules for which to generate the :epkg:`Jenkins` job
                                        (see @see fn default_jenkins_jobs which provides the default value
                                        if *modules* is None)
    @param      overwrite               do not create the job if it already exists
    @param      location                None for default or a local folder
    @param      prefix                  add a prefix to the name
    @param      delete_first            remove all jobs first
    @param      disable_schedule        disable schedule for all jobs
    @param      fLOG                    logging function
    @return                             list of created jobs

    *modules* is a list defined as follows:

    * each element can be a string or a tuple (string, schedule time) or a list
    * if it is a list, it contains a list of elements defined as previously
    * the job at position i is not scheduled, it will start after the last
      job at position i-1 whether or not it fails
    """
    platform = js.platform
    if modules is None:
        modules = default_jenkins_jobs(platform=platform)
    r = setup_jenkins_server_yml(js, github=github, modules=modules, get_jenkins_script=None,
                                 overwrite=overwrite, location=location, prefix=prefix,
                                 delete_first=delete_first, disable_schedule=disable_schedule)
    return r
def setup_jenkins_server(js,
                         github="sdpython",
                         modules=default_jenkins_jobs(),
                         overwrite=False,
                         location=None,
                         prefix="",
                         delete_first=False,
                         disable_schedule=False,
                         fLOG=noLOG):
    """
    Set up many jobs on Jenkins

    @param      js                      (JenkinsExt) jenkins server (specially if you need credentials)
    @param      github                  github account if it does not start with *http://*,
                                        the link to git repository of the project otherwise
    @param      modules                 modules for which to generate the Jenkins job (see @see fn default_jenkins_jobs)
    @param      get_jenkins_script      see `get_jenkins_script <http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/pyquickhelper/jenkinshelper/jenkins_server.html?highlight=get_jenkins_script#pyquickhelper.jenkinshelper.jenkins_server.JenkinsExt.get_jenkins_script>`_
                                        (default value if this parameter is None)
    @param      overwrite               do not create the job if it already exists
    @param      location                None for default or a local folder
    @param      prefix                  add a prefix to the name
    @param      delete_first            remove all jobs first
    @param      disable_schedule        disable schedule for all jobs
    @param      fLOG                    logging function
    @return                             list of created jobs

    *modules* is a list defined as follows:

    * each element can be a string or a tuple (string, schedule time) or a list
    * if it is a list, it contains a list of elements defined as previously
    * the job at position i is not scheduled, it will start after the last
      job at position i-1 whether or not it fails
    """
    r = setup_jenkins_server_yml(js,
                                 github=github,
                                 modules=modules,
                                 get_jenkins_script=None,
                                 overwrite=overwrite,
                                 location=location,
                                 prefix=prefix,
                                 delete_first=delete_first,
                                 disable_schedule=disable_schedule)
    return r
Exemple #5
0
#################################
# Starts the Jenkins server.
js = JenkinsExt('http://localhost:8080/', user,
                pwd, fLOG=fLOG, engines=engines)

#################################
# Defines the Jenkins job.
ymls = []
for mod in ["polylearn", "dynd-python"]:
    new_content = content.replace("__MODULE__", mod)
    yml = os.path.join(
        "build", ".local.jenkins.{1}.{0}.yml".format(mod, "lin"))
    with open(yml, "w", encoding="utf-8") as f:
        f.write(new_content)
    batch = os.path.join(folder, "windows", "build_{0}.bat".format(mod))
    with open(batch, "r", encoding="utf-8") as f:
        cbat = f.read()
    with open(yml, "w", encoding="utf-8") as f:
        f.write(new_content)
    toadd = [dict(name="build_{0}.bat".format(mod),
                  content=cbat)]
    ymls.append(("yml", yml, dict(scripts=toadd)))

#################################
# Update the Jenkins jobs for the given set of modules
fLOG("Update jenkins")
setup_jenkins_server_yml(js, github=None, modules=ymls,
                         overwrite=True, location=location, prefix="",
                         delete_first=False, disable_schedule=False, fLOG=fLOG)
fLOG("Done")
Exemple #6
0
#################################
# Starts the Jenkins server.
js = JenkinsExt('http://localhost:8080/', user,
                pwd, fLOG=fLOG, engines=engines)

#################################
# Defiens the Jenkins job.
ymls = []
for mod in ["polylearn", "dynd-python"]:
    new_content = content.replace("__MODULE__", mod)
    yml = os.path.join("build", ".local.jenkins.win.{0}.yml".format(mod))
    with open(yml, "w", encoding="utf-8") as f:
        f.write(new_content)
    batch = os.path.join(folder, "windows", "build_{0}.bat".format(mod))
    with open(batch, "r", encoding="utf-8") as f:
        cbat = f.read()
    with open(yml, "w", encoding="utf-8") as f:
        f.write(new_content)
    toadd = [dict(name="build_{0}.bat".format(mod),
                  content=cbat)]
    ymls.append(("yml", yml, dict(scripts=toadd)))

#################################
# Update the Jenkins jobs for the given set of modules
fLOG("Update jenkins")
setup_jenkins_server_yml(js, github=None, modules=ymls,
                         overwrite=True, location=location, prefix="",
                         delete_first=False, disable_schedule=False, fLOG=fLOG)
fLOG("Done")