(ci_name, pull_request_var, branch_var, commit_var)
return None
Checks if the CI environmental variables to check for a pull request,
    commit id and band commit branch are present.
    :return: String with the CI build information, or None if the CI
             environmental variables could not be found.
Checks if the CI environmental variables to check for a pull request,
    commit id and band commit branch are present.
    :return: String with the CI build information, or None if the CI
             environmental variables could not be found.
Checks if the CI environmental variables to check for a pull request commit id and band commit branch are present . : return : String with the CI build information or None if the CI environmental variables could not be found .
def tag_from_ci_env_vars(ci_name, pull_request_var, branch_var, commit_var):
    """
    Checks if the CI environmental variables to check for a pull request,
    commit id and band commit branch are present.
    :return: String with the CI build information, or None if the CI
             environmental variables could not be found.
    """
    pull_request = os.environ.get(pull_request_var)
    branch = os.environ.get(branch_var)
    commit = os.environ.get(commit_var)

    if pull_request and pull_request != "false":
        try:
            int(pull_request)
            print(script_tab + "Pull request valid '%s' variable found: %s" %
                  (ci_name, pull_request))
            return "pull_%s" % pull_request
        except ValueError:
            print(script_tab + "The pull request environmental variable " +
                  "'%s' value '%s' from %s is not a valid number." %
                  (pull_request_var, pull_request, ci_name))

    if branch and commit:
        print(script_tab + "Branch and commit valid '%s' variables found: %s %s"
              % (ci_name, branch, commit))
        # We only return first 10 digits from the commit ID (normal length 40)
        commit = "%s" % commit
        return "%s_%s" % (branch, commit[:10])

    print(script_tab + "The environmental variables for %s " % ci_name +
          "were deemed invalid:\n" +
          script_tab + "\t%s: %s\n" % (pull_request_var, pull_request) +
          script_tab + "\t%s: %s\n" % (branch_var, branch) +
          script_tab + "\t%s: %s" % (commit_var, commit))
    return None
def tag_from_ci_env_vars ( ci_name , pull_request_var , branch_var , commit_var ) : pull_request = os . environ . get ( pull_request_var ) branch = os . environ . get ( branch_var ) commit = os . environ . get ( commit_var ) if pull_request and pull_request != "false" : try : int ( pull_request ) print ( script_tab + "Pull request valid '%s' variable found: %s" % ( ci_name , pull_request ) ) return "pull_%s" % pull_request except ValueError : print ( script_tab + "The pull request environmental variable " + "'%s' value '%s' from %s is not a valid number." % ( pull_request_var , pull_request , ci_name ) ) if branch and commit : print ( script_tab + "Branch and commit valid '%s' variables found: %s %s" % ( ci_name , branch , commit ) ) # We only return first 10 digits from the commit ID (normal length 40) commit = "%s" % commit return "%s_%s" % ( branch , commit [ : 10 ] ) print ( script_tab + "The environmental variables for %s " % ci_name + "were deemed invalid:\n" + script_tab + "\t%s: %s\n" % ( pull_request_var , pull_request ) + script_tab + "\t%s: %s\n" % ( branch_var , branch ) + script_tab + "\t%s: %s" % ( commit_var , commit ) ) return None