tasks/pipeline.py
def check_deploy_pipeline(gitlab, git_ref, release_version_6, release_version_7, repo_branch):
    """
    Run checks to verify a deploy pipeline is valid:
    - it targets a valid repo branch
    - it has matching Agent 6 and Agent 7 tags (depending on release_version_* values)
    """

    # Check that the target repo branch is valid
    if not is_allowed_repo_branch(repo_branch):
        print(
            f"--repo-branch argument '{repo_branch}' is not in the list of allowed repository branches: {get_all_allowed_repo_branches()}"
        )
        raise Exit(code=1)

    #
    # If git_ref matches v7 pattern and release_version_6 is not empty, make sure Gitlab has v6 tag.
    # If git_ref matches v6 pattern and release_version_7 is not empty, make sure Gitlab has v7 tag.
    # v7 version pattern should be able to match 7.12.24-rc2 and 7.12.34
    #
    v7_pattern = r'^7\.(\d+\.\d+)(-.+|)$'
    v6_pattern = r'^6\.(\d+\.\d+)(-.+|)$'

    match = re.match(v7_pattern, git_ref)

    if release_version_6 and match:
        # release_version_6 is not empty and git_ref matches v7 pattern, construct v6 tag and check.
        tag_name = "6." + "".join(match.groups())
        gitlab_tag = gitlab.find_tag(tag_name)

        if ("name" not in gitlab_tag) or gitlab_tag["name"] != tag_name:
            print(f"Cannot find GitLab v6 tag {tag_name} while trying to build git ref {git_ref}")
            raise Exit(code=1)

        print(f"Successfully cross checked v6 tag {tag_name} and git ref {git_ref}")
    else:
        match = re.match(v6_pattern, git_ref)

        if release_version_7 and match:
            # release_version_7 is not empty and git_ref matches v6 pattern, construct v7 tag and check.
            tag_name = "7." + "".join(match.groups())
            gitlab_tag = gitlab.find_tag(tag_name)

            if ("name" not in gitlab_tag) or gitlab_tag["name"] != tag_name:
                print(f"Cannot find GitLab v7 tag {tag_name} while trying to build git ref {git_ref}")
                raise Exit(code=1)

            print(f"Successfully cross checked v7 tag {tag_name} and git ref {git_ref}")

    Run checks to verify a deploy pipeline is valid:
    - it targets a valid repo branch
    - it has matching Agent 6 and Agent 7 tags (depending on release_version_* values)
    
Run checks to verify a deploy pipeline is valid:
it targets a valid repo branch
it has matching Agent 6 and Agent 7 tags (depending on release_version_* values)
Run checks to verify a deploy pipeline is valid : it targets a valid repo branch it has matching Agent 6 and Agent 7 tags ( depending on release_version_ * values )
def check_deploy_pipeline(gitlab, git_ref, release_version_6, release_version_7, repo_branch):
    if not is_allowed_repo_branch(repo_branch):
        print(
            f"--repo-branch argument '{repo_branch}' is not in the list of allowed repository branches: {get_all_allowed_repo_branches()}"
        )
        raise Exit(code=1)
     If git_ref matches v7 pattern and release_version_6 is not empty, make sure Gitlab has v6 tag.
     If git_ref matches v6 pattern and release_version_7 is not empty, make sure Gitlab has v7 tag.
     v7 version pattern should be able to match 7.12.24-rc2 and 7.12.34
    v7_pattern = r'^7\.(\d+\.\d+)(-.+|)$'
    v6_pattern = r'^6\.(\d+\.\d+)(-.+|)$'
    match = re.match(v7_pattern, git_ref)
    if release_version_6 and match:
         release_version_6 is not empty and git_ref matches v7 pattern, construct v6 tag and check.
        tag_name = "6." + "".join(match.groups())
        gitlab_tag = gitlab.find_tag(tag_name)
        if ("name" not in gitlab_tag) or gitlab_tag["name"] != tag_name:
            print(f"Cannot find GitLab v6 tag {tag_name} while trying to build git ref {git_ref}")
            raise Exit(code=1)
        print(f"Successfully cross checked v6 tag {tag_name} and git ref {git_ref}")
    else:
        match = re.match(v6_pattern, git_ref)
        if release_version_7 and match:
             release_version_7 is not empty and git_ref matches v6 pattern, construct v7 tag and check.
            tag_name = "7." + "".join(match.groups())
            gitlab_tag = gitlab.find_tag(tag_name)
            if ("name" not in gitlab_tag) or gitlab_tag["name"] != tag_name:
                print(f"Cannot find GitLab v7 tag {tag_name} while trying to build git ref {git_ref}")
                raise Exit(code=1)
            print(f"Successfully cross checked v7 tag {tag_name} and git ref {git_ref}")
def check_deploy_pipeline ( gitlab , git_ref , release_version_6 , release_version_7 , repo_branch ) : if not is_allowed_repo_branch ( repo_branch ) : print ( f"--repo-branch argument '{repo_branch}' is not in the list of allowed repository branches: {get_all_allowed_repo_branches()}" ) raise Exit ( code = 1 ) v7_pattern = r'^7\.(\d+\.\d+)(-.+|)$' v6_pattern = r'^6\.(\d+\.\d+)(-.+|)$' match = re . match ( v7_pattern , git_ref ) if release_version_6 and match : tag_name = "6." + "" . join ( match . groups ( ) ) gitlab_tag = gitlab . find_tag ( tag_name ) if ( "name" not in gitlab_tag ) or gitlab_tag [ "name" ] != tag_name : print ( f"Cannot find GitLab v6 tag {tag_name} while trying to build git ref {git_ref}" ) raise Exit ( code = 1 ) print ( f"Successfully cross checked v6 tag {tag_name} and git ref {git_ref}" ) else : match = re . match ( v6_pattern , git_ref ) if release_version_7 and match : tag_name = "7." + "" . join ( match . groups ( ) ) gitlab_tag = gitlab . find_tag ( tag_name ) if ( "name" not in gitlab_tag ) or gitlab_tag [ "name" ] != tag_name : print ( f"Cannot find GitLab v7 tag {tag_name} while trying to build git ref {git_ref}" ) raise Exit ( code = 1 ) print ( f"Successfully cross checked v7 tag {tag_name} and git ref {git_ref}" )
Run checks to verify a deploy pipeline is valid:
 it targets a valid repo branch
 it has matching Agent 6 and Agent 7 tags (depending on release_version_* values)
Run checks to verify a deploy pipeline is valid : it targets a valid repo branch it has matching Agent 6 and Agent 7 tags ( depending on release_version_ * values )
"""
    Run checks to verify a deploy pipeline is valid:
    - it targets a valid repo branch
    - it has matching Agent 6 and Agent 7 tags (depending on release_version_* values)
    """ # Check that the target repo branch is valid # # If git_ref matches v7 pattern and release_version_6 is not empty, make sure Gitlab has v6 tag. # If git_ref matches v6 pattern and release_version_7 is not empty, make sure Gitlab has v7 tag. # v7 version pattern should be able to match 7.12.24-rc2 and 7.12.34 # # release_version_6 is not empty and git_ref matches v7 pattern, construct v6 tag and check. # release_version_7 is not empty and git_ref matches v6 pattern, construct v7 tag and check.
gitlab
git_ref
release_version_6
release_version_7
repo_branch