Esempio n. 1
0
#!/usr/bin/env python
"""validate.py

Validates the current code tree:
-  Markdown URLs are accessible
-  Analytics URLs have the correct file name in MD files

Usage:
  validate.py

Options:
  -h --help     Show this screen.

"""
import re

from docopt import docopt

import utils

if __name__ == "__main__":
    arguments = docopt(__doc__)
    utils.validate_markdown_uris()
Esempio n. 2
0
def start_release():
    """
    Start the release process, asking user for version information.
    :return:
    """
    para("Step 1 of 5: Create and push release branch with new versions.")
    para("Your git repository should be checked out to the correct revision "
         "that you want to cut a release with.  This is usually the HEAD of "
         "the master branch.")
    utils.check_or_exit("Are you currently on the correct revision")

    # Before asking for version info, perform validation on the current code.
    utils.validate_markdown_uris()

    old_version = utils.get_calicoctl_version()
    para("Current version is: %s" % old_version)

    new_version = arguments["CALICO_DOCKER_VERSION"]
    if not new_version:
        while True:
            new_version = raw_input("New calicoctl version?: ")
            release_type = utils.check_version_increment(old_version, new_version)
            if release_type:
                para("Release type: %s" % release_type)
                break

    calico_version = arguments["CALICO_VERSION"]
    libcalico_version = arguments["LIBCALICO_VERSION"]
    libnetwork_version = arguments["LIBNETWORK_VERSION"]
    kubernetes_version = arguments["KUBERNETES_VERSION"]


    if not (calico_version and libcalico_version and libnetwork_version and kubernetes_version):
        para("To pin the calico libraries used by calico-docker, please specify "
             "the name of the requested versions as they appear in the GitHub "
             "releases.")

        calico_version = \
            utils.get_github_library_version("calico (felix)", __felix_version__,
                                             "https://github.com/projectcalico/calico")
        libcalico_version = \
            utils.get_github_library_version("libcalico", __libcalico_version__,
                                             "https://github.com/projectcalico/libcalico")
        libnetwork_version = \
            utils.get_github_library_version("libnetwork-plugin", __libnetwork_plugin_version__,
                                             "https://github.com/projectcalico/libnetwork-plugin")

        kubernetes_version = \
            utils.get_github_library_version("kubernetes-plugin", __kubernetes_plugin_version__,
                                             "https://github.com/projectcalico/calico-kubernetes")

    release_data["versions"] = {"version": new_version,
                                "version-no-v": new_version[1:],
                                "calico-version": calico_version,
                                "libcalico-version": libcalico_version,
                                "libnetwork-version": libnetwork_version,
                                "kubernetes-version": kubernetes_version,
                                }

    bullet("Creating a candidate release branch called "
           "'%s-candidate'." % new_version)
    if arguments['--force']:
        run("git branch -D %s-candidate" % new_version)
    run("git checkout -b %s-candidate" % new_version)

    # Update the code tree
    utils.update_files(CANDIDATE_VERSION_REPLACE, release_data["versions"])

    new_version = release_data["versions"]["version"]
    para("The codebase has been updated to reference the release candidate "
         "artifacts.")

    bullet("Adding, committing and pushing the updated files to "
           "origin/%s-candidate" % new_version)
    run("git add --all")
    run('git commit -m "Update version strings for release '
           'candidate %s"' % new_version)
    if arguments['--force']:
        run("git push -f origin %s-candidate" % new_version)
    else:
        run("git push origin %s-candidate" % new_version)
    actions()
    bullet("Create a DockerHub calico/node release tagged '%s'.  Use the "
           "candidate branch as the name and /calico_node as the Dockerfile "
           "location" % new_version)
    bullet("Monitor the semaphore, CircleCI and Docker builds for this branch "
           "until all have successfully completed.  Fix any issues with the "
           "build.")
    bullet("Run through a subset of the demonstrations.  When running the "
           "vagrant instructions, make sure you are using the candidate "
           "branch (e.g. git checkout %s-candidate):" % new_version)
    bullet("Ubuntu libnetwork", level=1)
    bullet("CoreOS default networking", level=1)
    para("Follow the URL below to view the correct demonstration instructions "
         "for this release candidate.")
    bullet("https://github.com/projectcalico/calico-docker/tree/%s-candidate" % new_version)
    next("Once you have completed the testing, re-run the script.")
Esempio n. 3
0
def start_release():
    """
    Start the release process, asking user for version information.
    :return:
    """
    para("Step 1 of 5: Create and push release branch with new versions.")
    para("Your git repository should be checked out to the correct revision "
         "that you want to cut a release with.  This is usually the HEAD of "
         "the master branch.")
    utils.check_or_exit("Are you currently on the correct revision")

    # Before asking for version info, perform validation on the current code.
    utils.validate_markdown_uris()

    old_version = utils.get_calicoctl_version()
    para("Current version is: %s" % old_version)

    new_version = arguments["CALICO_DOCKER_VERSION"]
    if not new_version:
        while True:
            new_version = raw_input("New calicoctl version?: ")
            release_type = utils.check_version_increment(
                old_version, new_version)
            if release_type:
                para("Release type: %s" % release_type)
                break

    calico_version = arguments["CALICO_VERSION"]
    libcalico_version = arguments["LIBCALICO_VERSION"]
    libnetwork_version = arguments["LIBNETWORK_VERSION"]
    kubernetes_version = arguments["KUBERNETES_VERSION"]

    if not (calico_version and libcalico_version and libnetwork_version
            and kubernetes_version):
        para(
            "To pin the calico libraries used by calico-docker, please specify "
            "the name of the requested versions as they appear in the GitHub "
            "releases.")

        calico_version = \
            utils.get_github_library_version("calico (felix)", __felix_version__,
                                             "https://github.com/projectcalico/calico")
        libcalico_version = \
            utils.get_github_library_version("libcalico", __libcalico_version__,
                                             "https://github.com/projectcalico/libcalico")
        libnetwork_version = \
            utils.get_github_library_version("libnetwork-plugin", __libnetwork_plugin_version__,
                                             "https://github.com/projectcalico/libnetwork-plugin")

        kubernetes_version = \
            utils.get_github_library_version("kubernetes-plugin", __kubernetes_plugin_version__,
                                             "https://github.com/projectcalico/calico-kubernetes")

    release_data["versions"] = {
        "version": new_version,
        "version-no-v": new_version[1:],
        "calico-version": calico_version,
        "libcalico-version": libcalico_version,
        "libnetwork-version": libnetwork_version,
        "kubernetes-version": kubernetes_version,
    }

    bullet("Creating a candidate release branch called "
           "'%s-candidate'." % new_version)
    if arguments['--force']:
        run("git branch -D %s-candidate" % new_version)
    run("git checkout -b %s-candidate" % new_version)

    # Update the code tree
    utils.update_files(CANDIDATE_VERSION_REPLACE, release_data["versions"])

    new_version = release_data["versions"]["version"]
    para("The codebase has been updated to reference the release candidate "
         "artifacts.")

    bullet("Adding, committing and pushing the updated files to "
           "origin/%s-candidate" % new_version)
    run("git add --all")
    run('git commit -m "Update version strings for release '
        'candidate %s"' % new_version)
    if arguments['--force']:
        run("git push -f origin %s-candidate" % new_version)
    else:
        run("git push origin %s-candidate" % new_version)
    actions()
    bullet("Create a DockerHub calico/node release tagged '%s'.  Use the "
           "candidate branch as the name and /calico_node as the Dockerfile "
           "location" % new_version)
    bullet("Monitor the semaphore, CircleCI and Docker builds for this branch "
           "until all have successfully completed.  Fix any issues with the "
           "build.")
    bullet("Run through a subset of the demonstrations.  When running the "
           "vagrant instructions, make sure you are using the candidate "
           "branch (e.g. git checkout %s-candidate):" % new_version)
    bullet("Ubuntu libnetwork", level=1)
    bullet("CoreOS default networking", level=1)
    para("Follow the URL below to view the correct demonstration instructions "
         "for this release candidate.")
    bullet("https://github.com/projectcalico/calico-docker/tree/%s-candidate" %
           new_version)
    next("Once you have completed the testing, re-run the script.")