App-JenkinsCli

 view release on metacpan or  search on metacpan

README.pod  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
=head1 SYNOPSIS
 
   jenkins-cli [option] command
 
 OPTIONS:
  -b --base-url[=]str
                The base url of the Jenkins instance to talk to
  -U --username[=]str
                The username to interact with Jenkins
  -P --password[=]str
                The passowrd of --username
 
  -v --verbose  Show more detailed option
     --version  Prints the version information
     --help     Prints this help information
     --man      Prints the full documentation for jenkins-cli
 
 COMMANDS:
  ls|list [search]
                List jenkins jobs

README.pod  view on Meta::CPAN

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
=head1 CONFIGURATION
 
You can save your configuration into C<~/.jenkins-cli.yml> so that you don't
have to enter them each time. The following is an example of what the file
looks like:
 
  ---
  username: admin
  password: my-secrent-password
 
=head1 SUPPORT AND DOCUMENTATION
 
After installing, you can find documentation for this module with the
perldoc command.
 
    perldoc App::JenkinsCli
 
You can also look for information at:

bin/jenkins-cli  view on Meta::CPAN

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
                my ($option, $auto, $errors) = @_;
                my $sub_command = $option->cmd;
                if ( $sub_command eq '--' ) {
                    warn '--';
                }
            },
        },
        [
            'base_url|base-url|b=s',
            'username|U=s',
            'password|P=s',
            'colors|c=s%',
            'color!',
            'test|T!',
            'verbose|v+',
        ],
    );
 
    # do stuff here
    my $jenkins = App::JenkinsCli->new(
        base_url => $options->base_url || _error('Missing base_url!'),
        api_key  => $options->username || _error('Missing username!'),
        api_pass => $options->password || _error('Missing password!'),
        test     => $options->test,
        colours  => $options->colors,
        opt      => $options,
    );
 
    return $jenkins->$cmd(@{ $opt->files }) || 0;
}
 
sub _error {
    my ($msg) = @_;

bin/jenkins-cli  view on Meta::CPAN

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
=head1 SYNOPSIS
 
   jenkins-cli [option] command
 
 OPTIONS:
  -b --base-url[=]str
                The base url of the Jenkins instance to talk to
  -U --username[=]str
                The username to interact with Jenkins
  -P --password[=]str
                The passowrd of --username
 
  -v --verbose  Show more detailed option
     --version  Prints the version information
     --help     Prints this help information
     --man      Prints the full documentation for jenkins-cli
 
 COMMANDS:
  ls|list [search]
                List jenkins jobs

bin/jenkins-cli  view on Meta::CPAN

179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
=head1 CONFIGURATION AND ENVIRONMENT
 
You can save your configuration into C<~/.jenkins-cli.yml> so that you don't
have to enter them each time. The following is an example of what the file
looks like:
 
  ---
  username: admin
  password: my-secrent-password
 
=head1 DEPENDENCIES
 
=head1 INCOMPATIBILITIES
 
=head1 BUGS AND LIMITATIONS
 
There are no known bugs in this module.
 
Please report problems to Ivan Wills (ivan.wills@gmail.com).

example/rebuild-to-success  view on Meta::CPAN

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
        name        => 'jenkins-cli',
        conf_prefix => '.',
        helper      => 1,
        default     => {
            sleep => 10,
        },
    },
    [
        'base_url|base-url|b=s',
        'username|U=s',
        'password|P=s',
        'start',
        'sleep|s=i',
        'verbose|v+',
    ],
);
 
# do stuff here
my $jenkins = Jenkins::API->new({
    base_url => $options->base_url,
    api_key  => $options->username,
    api_pass => $options->password,
});
 
my $job    = shift @ARGV || die "No job supplied!\n";
my ($result, $build) = status($jenkins, $job);
my $number = $result->{nextBuildNumber} - 1;
 
while ( $build->{building} || $build->{result} ne 'SUCCESS' ) {
 
    if ( ! $build->{building} && $build->{number} == $number ) {
        warn "$job : Retrying\n";

lib/App/JenkinsCli.pm  view on Meta::CPAN

541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
=item base_url
 
The base URL of Jenkins
 
=item api_key
 
The username to access jenkins by
 
=item api_pass
 
The password to access jenkins by
 
=item test
 
Flag to not actually perform changes
 
=item jenkins
 
Internal L<Jenkins::API> object
 
=item colours



( run in 3.159 seconds using v1.01-cache-2.11-cpan-9b1e4054eb1 )