Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run arguments addition #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
https://www.youtube.com/watch?v=PlsW2hd06R0
autoscatto committed Aug 2, 2017

Verified

This commit was signed with the committer’s verified signature.
TimothyWillard Timothy Willard
commit 3a09b91f2fc625333e469cbd1c5214b1ae5ec88d
2 changes: 2 additions & 0 deletions jenkins_cli/cli.py
Original file line number Diff line number Diff line change
@@ -236,6 +236,8 @@ def setbranch(self, args):
print("Cannot set branch name")

def start(self, args):
if args.bargs is not None:
args.bargs = dict([x.split(':') for x in args.bargs])
for job in args.job_name:
job_name = self._check_job(job)
start_status = self.jenkins.build_job(job_name, parameters=args.bargs)
13 changes: 1 addition & 12 deletions jenkins_cli/cli_arguments.py
Original file line number Diff line number Diff line change
@@ -3,17 +3,6 @@
from jenkins_cli.cli import get_jobs_legend
from jenkins_cli.version import version

def string_to_dict(s):
try:
_d = {}
for x in s.split():
k,v = x.split(':')
_d[k] = v
return _d
except:
return None


def load_parser():
"""
Create a parser and load it with CLI arguments
@@ -52,7 +41,7 @@ def load_parser():

start_parser = subparsers.add_parser('start', help='Start job')
start_parser.add_argument('job_name', help='Job to start', nargs='*')
start_parser.add_argument('--bargs', metavar='bargs', help='Build arguments. (in key1:value1 key2:value2 format)', default=None, type=string_to_dict)
start_parser.add_argument('--bargs', metavar='bargs', help='Build arguments. (in key1:value1 key2:value2 format)', nargs='*', default=None)

start_parser = subparsers.add_parser('info', help='Job info')
start_parser.add_argument('job_name', help='Job to get info for')