def update_master(): """ Master branch is now checked out and needs updating. """ para("Step 4 of 5: Commit versions and push changes to master.") utils.check_or_exit("Is your git repository now on master") # Update the master files. utils.update_files(MASTER_VERSION_REPLACE, release_data["versions"], is_release=False) new_version = release_data["versions"]["version"] para("The master codebase has now been updated to reference the latest " "release.") para("Commit changes to master") run("git add --all") run('git commit -m "Update docs to version %s"' % new_version) actions() bullet("Self review the latest changes to master") bullet("Run: git diff origin/master", level=1) bullet("Push changes to master") bullet("Run: git push origin master", level=1) bullet("Verify builds are working") next("Once complete, re-run the script")
def start_release(): """ Start the release process, asking user for version information. :return: """ 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") old_version = utils.get_calicoctl_version() para("Current version is: %s" % old_version) while True: new_version = raw_input("New calicoctl version?: ") release_type = utils.check_version_increment(old_version, new_version) if release_type: break para("Release type: %s" % release_type) 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)", "https://github.com/projectcalico/calico") libcalico_version = \ utils.get_github_library_version("libcalico", "https://github.com/projectcalico/libcalico") libnetwork_version = \ utils.get_github_library_version("libnetwork-plugin", "https://github.com/projectcalico/libnetwork-plugin") release_data["versions"] = { "version": new_version, "version-no-v": new_version[1:], "calico-version": calico_version, "libcalico-version": libcalico_version, "libnetwork-version": libnetwork_version } actions() bullet("Create a candidate release branch called " "'%s-candidate'." % new_version) bullet("git checkout -b %s-candidate" % new_version, level=1) next("When you have created the branch, re-run the script.")
def start_release(): """ Start the release process, asking user for version information. :return: """ 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") old_version = utils.get_calicoctl_version() para("Current version is: %s" % old_version) while True: new_version = raw_input("New calicoctl version?: ") release_type = utils.check_version_increment(old_version, new_version) if release_type: break para("Release type: %s" % release_type) 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)", "https://github.com/projectcalico/calico") libcalico_version = \ utils.get_github_library_version("libcalico", "https://github.com/projectcalico/libcalico") libnetwork_version = \ utils.get_github_library_version("libnetwork-plugin", "https://github.com/projectcalico/libnetwork-plugin") release_data["versions"] = {"version": new_version, "version-no-v": new_version[1:], "calico-version": calico_version, "libcalico-version": libcalico_version, "libnetwork-version": libnetwork_version} actions() bullet("Create a candidate release branch called " "'%s-candidate'." % new_version) bullet("git checkout -b %s-candidate" % new_version, level=1) next("When you have created the branch, re-run the script.")
def change_to_master(): """ Version has been releases and tested. """ para("Step 3 of 5: Remove candidate branch.") utils.check_or_exit("Have you successfully tested the release") new_version = release_data["versions"]["version"] para("The release is now complete. We now need to update the master " "branch and do some general branch and build tidyup.") para("Checkout the master branch, and ensure it is up to date") run("git checkout master") run('git pull origin master') para("Delete the origin/%s-candidate branch" % new_version) run("git branch -D %s-candidate" % new_version) run("git push origin :%s-candidate" % new_version) actions() bullet("Delete the DockerHub build for this release") next("Once complete, re-run the script.")
def start_release(): """ Start the release process, asking user for version information. :return: """ new_version = arguments.get("--calico") if not new_version: new_version = raw_input("New Calico version? (vX.Y): ") # Check if any of the new version dirs exist already new_dirs = [ "./%s" % new_version, "./_data/%s" % new_version, "./_layouts/%s" % new_version ] for new_dir in new_dirs: if os.path.isdir(new_dir): # Quit instead of making assumptions. para( "A versioned folder for %s already exists. Remove and rerun this script?" % new_dir) # Create the versioned directories. shutil.copytree("./master", new_version) # Temporary workdown, use vX_Y instead of vX.Y # https://github.com/jekyll/jekyll/issues/5429 shutil.copytree("./_data/master", "./_data/%s" % new_version.replace(".", "_")) shutil.copytree("./_includes/master", "./_includes/%s" % new_version) run("git add --all") run('git commit -m "Copy Master for release %s"' % new_version) actions() para("Created commit of the raw, unchanged release files.") para("Moving on to Version replacement of files.") calico_containers_version = arguments["--calico-containers"] if not calico_containers_version: calico_containers_version = \ utils.get_github_library_version("calico-containers", "https://github.com/projectcalico/calico-containers") felix_version = arguments["--felix"] if not felix_version: felix_version = \ utils.get_github_library_version("felix", "https://github.com/projectcalico/felix") libnetwork_version = arguments["--libnetwork"] if not libnetwork_version: libnetwork_version = \ utils.get_github_library_version("libnetwork-plugin", "https://github.com/projectcalico/libnetwork-plugin") calico_cni_version = arguments["--calico-cni"] if not calico_cni_version: calico_cni_version = \ utils.get_github_library_version("calico-cni-version", "https://github.com/projectcalico/calico-cni") kube_policy_controller_version = arguments["--k8s-policy-controller"] if not kube_policy_controller_version: kube_policy_controller_version = \ utils.get_github_library_version("kube-policy-controller", "https://github.com/projectcalico/k8s-policy") versions = { "calico-version": new_version, "calico-containers-version": calico_containers_version, "calico-containers-version-no-v": calico_containers_version[1:], "felix-version": felix_version, "libnetwork-version": libnetwork_version, "kube-policy-controller-version": kube_policy_controller_version, "calico-cni-version": calico_cni_version } actions() para("Using:") para(str(versions)) check_or_exit("Continue?") # Update the code tree utils.update_files(VERSION_REPLACE, versions) para("The codebase has been updated to reference the release artifacts.") bullet("Adding, and committing the updated files") run("git add --all") run('git commit -m "Update version strings for release %s"' % new_version) actions() para( "You are done with release preparation. You now have two new commits on your branch which add the " "necessary files. Please: ") bullet("Run through a subset of the demonstrations. When running the " "vagrant instructions, make sure you are using the release " "folder (e.g. ./%s):" % new_version) bullet("Ubuntu libnetwork", level=1) bullet("CoreOS default networking", level=1) bullet("CoreOS libnetwork", level=1) bullet("Ubuntu default networking", level=1) bullet("Make sure to check the reported versions of all artifacts.") bullet("Create a Pull Request against master and review the changes (or " "run `git diff origin/master` from the candidate branch). " "Merge when ready.")
def cut_release(): """ The candidate branch has been tested, so cut the actual release. """ para("Step 2 of 5: Push final branch, then cut release with binary.") utils.check_or_exit("Have you successfully tested your release candidate") # Update the code tree once more to set the final GitHub URLs utils.update_files(FINAL_VERSION_REPLACE, release_data["versions"]) new_version = release_data["versions"]["version"] para("The codebase has been updated to reference the GitHub release " "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 ' '%s"' % new_version) run("git push origin %s-candidate" % new_version) actions() bullet("Monitor the semaphore, CircleCI and Docker builds for this branch " "until all have successfully completed. Fix any issues with the " "build.") bullet("Create a Pull Request against master and review the changes (or " "run `git diff origin/master` from the candidate branch). Delete " "the pull request after comparing.") bullet("Create a GitHub release called '%s'" % new_version) para("Attach the calicoctl binary to the release. It can be downloaded " "from the following URL:") bullet("http://www.projectcalico.org/builds/calicoctl?circleci-branch=%s-candidate" % new_version) para("Once the release has been created on GitHub, perform a final test " "of the release:") bullet("Run through a subset of the demonstrations. When running the " "vagrant instructions, make sure you are using the tagged release " "(e.g. git checkout tags/%s):" % new_version) bullet("CoreOS libnetwork", level=1) bullet("Ubuntu default networking", level=1) next("Once you have completed the testing, re-run the script.")
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.")
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.")
def cut_release(): """ The candidate branch has been tested, so cut the actual release. """ para("Step 2 of 5: Push final branch, then cut release with binary.") utils.check_or_exit("Have you successfully tested your release candidate") # Update the code tree once more to set the final GitHub URLs utils.update_files(FINAL_VERSION_REPLACE, release_data["versions"]) new_version = release_data["versions"]["version"] para("The codebase has been updated to reference the GitHub release " "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 ' '%s"' % new_version) run("git push origin %s-candidate" % new_version) actions() bullet("Monitor the semaphore, CircleCI and Docker builds for this branch " "until all have successfully completed. Fix any issues with the " "build.") bullet("Create a Pull Request against master and review the changes (or " "run `git diff origin/master` from the candidate branch). Delete " "the pull request after comparing.") bullet("Create a GitHub release called '%s'" % new_version) para("Attach the calicoctl binary to the release. It can be downloaded " "from the following URL:") bullet( "http://www.projectcalico.org/builds/calicoctl?circleci-branch=%s-candidate" % new_version) para("Once the release has been created on GitHub, perform a final test " "of the release:") bullet("Run through a subset of the demonstrations. When running the " "vagrant instructions, make sure you are using the tagged release " "(e.g. git checkout tags/%s):" % new_version) bullet("CoreOS libnetwork", level=1) bullet("Ubuntu default networking", level=1) next("Once you have completed the testing, re-run the script.")
def start_release(): """ Start the release process, asking user for version information. :return: """ new_version = arguments.get("--calico") if not new_version: new_version = raw_input("New Calico version? (vX.Y): ") # Check if any of the new version dirs exist already new_dirs = ["./%s" % new_version, "./_data/%s" % new_version, "./_layouts/%s" % new_version] for new_dir in new_dirs: if os.path.isdir(new_dir): # Quit instead of making assumptions. para("A versioned folder for %s already exists. Remove and rerun this script?" % new_dir) # Create the versioned directories. shutil.copytree("./master", new_version) # Temporary workdown, use vX_Y instead of vX.Y # https://github.com/jekyll/jekyll/issues/5429 shutil.copytree("./_data/master", "./_data/%s" % new_version.replace(".","_")) shutil.copytree("./_includes/master", "./_includes/%s" % new_version) run("git add --all") run('git commit -m "Copy Master for release %s"' % new_version) actions() para("Created commit of the raw, unchanged release files.") para("Moving on to Version replacement of files.") calico_containers_version = arguments["--calico-containers"] if not calico_containers_version: calico_containers_version = \ utils.get_github_library_version("calico-containers", "https://github.com/projectcalico/calico-containers") felix_version = arguments["--felix"] if not felix_version: felix_version = \ utils.get_github_library_version("felix", "https://github.com/projectcalico/felix") libnetwork_version = arguments["--libnetwork"] if not libnetwork_version: libnetwork_version = \ utils.get_github_library_version("libnetwork-plugin", "https://github.com/projectcalico/libnetwork-plugin") calico_cni_version = arguments["--calico-cni"] if not calico_cni_version: calico_cni_version = \ utils.get_github_library_version("calico-cni-version", "https://github.com/projectcalico/calico-cni") kube_policy_controller_version = arguments["--k8s-policy-controller"] if not kube_policy_controller_version: kube_policy_controller_version = \ utils.get_github_library_version("kube-policy-controller", "https://github.com/projectcalico/k8s-policy") versions = { "calico-version": new_version, "calico-containers-version": calico_containers_version, "calico-containers-version-no-v": calico_containers_version[1:], "felix-version": felix_version, "libnetwork-version": libnetwork_version, "kube-policy-controller-version": kube_policy_controller_version, "calico-cni-version": calico_cni_version } actions() para("Using:") para(str(versions)) check_or_exit("Continue?") # Update the code tree utils.update_files(VERSION_REPLACE, versions) para("The codebase has been updated to reference the release artifacts.") bullet("Adding, and committing the updated files") run("git add --all") run('git commit -m "Update version strings for release %s"' % new_version) actions() para("You are done with release preparation. You now have two new commits on your branch which add the " "necessary files. Please: ") bullet("Run through a subset of the demonstrations. When running the " "vagrant instructions, make sure you are using the release " "folder (e.g. ./%s):" % new_version) bullet("Ubuntu libnetwork", level=1) bullet("CoreOS default networking", level=1) bullet("CoreOS libnetwork", level=1) bullet("Ubuntu default networking", level=1) bullet("Make sure to check the reported versions of all artifacts.") bullet("Create a Pull Request against master and review the changes (or " "run `git diff origin/master` from the candidate branch). " "Merge when ready.")
def update_files(): """ Continue the release process by updating the version information in all the files. """ utils.check_or_exit("Is your git repository now on the candidate release " "branch") # 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.") actions() bullet("Add, commit and push the updated files to " "origin/%s-candidate" % new_version) bullet("git add --all", level=1) bullet('git commit -m "Update version strings for release ' 'candidate %s"' % new_version, level=1) bullet("git push origin %s-candidate" % new_version, level=1) bullet("Create a DockerHub release called '%s'" % 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.")