Skip to content

Commit

Permalink
Merge pull request #1639 from adrianschroeter/token_parameters
Browse files Browse the repository at this point in the history
Support parameters on token triggers
  • Loading branch information
dmach authored Oct 11, 2024
2 parents 7eddadf + 44767f2 commit 70975fc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
22 changes: 21 additions & 1 deletion osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,16 @@ def do_showlinked(self, subcmd, opts, *args):
help='Trigger the action of a token')
@cmdln.option('', '--scm-token', metavar='SCM_TOKEN',
help='The scm\'s access token (only in combination with a --operation=workflow option)')
@cmdln.option('-a', '--arch',
help='Release/Rebuild only binaries from the specified architecture')
@cmdln.option('-r', '--repo',
help='Release/Rebuild only binaries from the specified repository')
@cmdln.option('--target-project', metavar='PROJECT',
help='Release only to specified project')
@cmdln.option('--target-repo', metavar='REPO',
help='Release only to specified repository')
@cmdln.option('--set-release', metavar='RELEASE_TAG',
help='Rename binaries during release using this release tag')
def do_token(self, subcmd, opts, *args):
"""
Show and manage authentication token
Expand Down Expand Up @@ -1731,7 +1741,17 @@ def do_token(self, subcmd, opts, *args):
print(status.to_string())
elif opts.trigger:
print("Trigger token")
status = obs_api.Token.do_trigger(apiurl, token=opts.trigger, project=project, package=package)
status = obs_api.Token.do_trigger(
apiurl,
token=opts.trigger,
project=project,
package=package,
repo=opts.repo,
arch=opts.arch,
target_project=opts.target_project,
target_repo=opts.target_repo,
set_release=opts.set_release,
)
print(status.to_string())
else:
if args and args[0] in ['create', 'delete', 'trigger']:
Expand Down
10 changes: 10 additions & 0 deletions osc/obs_api/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def do_trigger(
operation: Optional[str] = None,
project: Optional[str] = None,
package: Optional[str] = None,
repo: Optional[str] = None,
arch: Optional[str] = None,
target_project: Optional[str] = None,
target_repo: Optional[str] = None,
set_release: Optional[str] = None,
):
if operation:
url_path = ["trigger", operation]
Expand All @@ -168,6 +173,11 @@ def do_trigger(
url_query = {
"project": project,
"package": package,
"repository": repo,
"architecture": arch,
"targetproject": target_project,
"targetrepository": target_repo,
"setrelease": set_release,
}

headers = {
Expand Down

0 comments on commit 70975fc

Please sign in to comment.