Skip to content

Commit

Permalink
Allow az pipeline run to specify git tag as branch param (#989)
Browse files Browse the repository at this point in the history
* Allow az pipeline run to specify git tag as branch param

* fix pylint error
  • Loading branch information
abergie committed Apr 8, 2020
1 parent 8068db5 commit f7399f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion azure-devops/azext_devops/dev/common/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ def resolve_git_ref_heads(ref):
:type ref: str
:rtype: str
"""
if ref is not None and not ref.startswith(REF_HEADS_PREFIX) and not ref.startswith(REF_PULL_PREFIX):
if (ref is not None and not ref.startswith(REF_HEADS_PREFIX) and
not ref.startswith(REF_PULL_PREFIX) and not ref.startswith(REF_TAGS_PREFIX)):
ref = REF_HEADS_PREFIX + ref
return ref

Expand Down Expand Up @@ -200,5 +201,6 @@ def _get_alias_value(command):
REFS_PREFIX = 'refs/'
REF_HEADS_PREFIX = 'refs/heads/'
REF_PULL_PREFIX = 'refs/pull/'
REF_TAGS_PREFIX = 'refs/tags/'
GIT_CREDENTIALS_USERNAME_KEY = 'username'
GIT_CREDENTIALS_PASSWORD_KEY = 'password'
2 changes: 1 addition & 1 deletion azure-devops/azext_devops/dev/pipelines/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def build_queue(definition_id=None, definition_name=None, branch=None, variables
:param definition_name: Name of the definition to queue. Ignored if --id is supplied.
:type definition_name: str
:param branch: Branch to build. Required if there is not a default branch set up on the definition. Example:
refs/heads/master or master or refs/pull/1/merge
refs/heads/master or master or refs/pull/1/merge or refs/tags/tag
:type branch: str
:param variables: Space separated "name=value" pairs for the variables you would like to set.
:type variables: [str]
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/azext_devops/dev/pipelines/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def pipeline_run(id=None, branch=None, commit_id=None, name=None, open=False, va
:param name: Name of the pipeline to queue. Ignored if --id is supplied.
:type name: str
:param branch: Name of the branch on which the pipeline run is to be queued. Example: refs/heads/master or master
or refs/pull/1/merge
or refs/pull/1/merge or refs/tags/tag
:type branch: str
:param folder_path: Folder path of pipeline. Default is root level folder.
:type folder_path: str
Expand Down

0 comments on commit f7399f4

Please sign in to comment.