def set_version_tag(prefix): print("Setting tag for current commit...") version = tools.get_current_version(VDIST_CONFIGURATION) version_string = "{0}{1}".format(prefix, version) tools.run_console_command("git tag '{0}'".format(version_string)) print("Tag set.") return version_string
def set_contact_data(username, email): print("Setting user and email for current commit...") tools.run_console_command( "git config --local user.name '{0}'".format(username)) tools.run_console_command( "git config --local user.email '{0}'".format(email)) print("User and email set.")
def push_tag(version, github_repo=GITHUB_REPO, github_token=GITHUB_TOKEN): print("Pushing tag...") push_uri = "https://{token}@github.com/{repo}".format(token=github_token, repo=github_repo) # Redirect to /dev/null to avoid secret leakage tools.run_console_command( "git push {uri} {version} > /dev/null 2>&1".format(uri=push_uri, version=version)) print("Pushed.")
def push_to_origin(github_repo=GITHUB_REPO, github_token=GITHUB_TOKEN, branch_to_merge_into=BRANCH_TO_MERGE_INTO): print("Pushing changes...") push_uri = "https://{token}@github.com/{repo}".format(token=github_token, repo=github_repo) # Redirect to /dev/null to avoid secret leakage # tools.run_console_command("git push {uri} {version} > /dev/null 2>&1".format(uri=push_uri, # version=version)) tools.run_console_command("git push {uri} {branch} > /dev/null 2>&1".format(uri=push_uri, branch=branch_to_merge_into)) print("Pushed.")
def merge_with_production(tempdir, branch_to_merge=BRANCH_TO_MERGE, branch_to_merge_into=BRANCH_TO_MERGE_INTO): os.chdir(tempdir) tools.run_console_command("git checkout {branch}".format(branch=branch_to_merge)) tools.run_console_command("git checkout {branch}".format(branch=branch_to_merge_into)) tools.run_console_command("git merge {branch}".format(branch=branch_to_merge))
def launch_debug_build(api_token, build_number): command = DEBUG_COMMAND.format(token=api_token, id=build_number) tools.run_console_command(command)
def build_packages(): print("About to run building command from {0}".format(os.getcwd())) print("Building system packages...") tools.run_console_command("vdist batch packaging/cifra_build.cnf") print("System packages built.")
def install_vdist(): print("Installing vdist package from Pypi...") tools.run_console_command("pip install vdist") print("vdist installed.")
def clone_repository(tempdir, url=GITHUB_URL, repo=GITHUB_REPO): tools.run_console_command("git clone {url}{repo} {dir}".format(url=url, repo=repo, dir=tempdir))