args = parser.parse_args()

    if args.bump_to:
        # validate if the provided version is valid.
        # e.g. 1.10.0 or 1.0.0-rc1
        pattern = '\d.\d{1,2}.(\d$|\d-rc\d+$)'
        regex = re.compile(r'\d.\d{1,2}.(\d$|\d-rc\d+$)')
        valid = regex.match(args.bump_to)
        tests_branch = ""
        if valid:
            tests_branch = args.bump_to
            if args.apps_branch is not None:
                tests_branch = args.apps_branch
            if 'rc' in args.bump_to:
                tests_branch = 'master'

            print("Version will be updated to {0}".format(args.bump_to))
            print("Version on behave tests examples will be updated to version {0} and branch {1}".format(args.bump_to,
                                                                                                          tests_branch))
            input("Is the information correct? If so press any key to continue...")

            common.update_image_version(args.bump_to)
            common.update_image_stream(args.bump_to)
            common.update_kogito_modules(args.bump_to)
            update_behave_tests(tests_branch)
            update_test_apps_clone_repo(tests_branch)
        else:
            print("Provided version {0} does not match the expected regex - {1}".format(args.bump_to, pattern))
    else:
        print(parser.print_usage())
Exemplo n.º 2
0
    if '-rc' in version:
        CURRENT_IMAGE_VERSION = version
    else:
        CURRENT_IMAGE_VERSION = version + '-rc1'
    return CURRENT_IMAGE_VERSION


def get_next_rc_version(current_rc_version):
    '''
    After finding the current rc tag of the image, adds one to it
    e.g: 0.10.0-rc1 will returned as 0.10.0-rc2
    :param current_rc_version: takes the current rc version of the image as input
    :return: returns the next rc version of the image
    '''
    return (current_rc_version.split("rc")[0] + "rc" +
            str(int(current_rc_version.split("rc")[1]) + 1))


if __name__ == "__main__":
    if 'QUAY_TOKEN' not in os.environ:
        print("Env QUAY_TOKEN not found, aborting...")
        os._exit(1)
    version = get_next_rc_version(find_current_rc_version())
    common.update_image_version(version)
    common.update_image_stream(version)
    common.update_modules_version(version)
    common.update_kogito_version_env_in_modules(version)

    find_next_tag()
    tag_and_push_images()