jester 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/{Jenkinsfile → Jenkinsfile.example} +0 -5
- data/README.md +55 -14
- data/lib/jester/cli.rb +16 -6
- data/lib/jester/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 024e35ca37ebac5d582998a41191bc3314bf3789
|
|
4
|
+
data.tar.gz: 0c89f3d07164926300e0ab61690cc790206c72d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 14a6cc1099fc0a5d9a00888faeae4be1dac3cc2cf08e61dbcef1d4b43ba5cf2dc876635292d15c9f36be8f44a977b0636313a299e2f7c57e35c5535615919de9
|
|
7
|
+
data.tar.gz: 6524412d631e36dbc55df35a8ded16af349c36699051127a42bcd19fe4800fd29ee3fc467950c6914078918ffa368762bda1b1b11b5693686eeed8106ef1573c
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -17,27 +17,18 @@ All of this is done from the command line - logging in to the Jenkins UI *not* r
|
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Install the gem via:
|
|
21
21
|
|
|
22
|
-
```
|
|
23
|
-
gem
|
|
22
|
+
```sh
|
|
23
|
+
gem install jester
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
And then execute:
|
|
27
|
-
|
|
28
|
-
$ bundle
|
|
29
|
-
|
|
30
|
-
Or install it yourself as:
|
|
31
|
-
|
|
32
|
-
$ gem install jester
|
|
33
|
-
|
|
34
|
-
-----
|
|
35
26
|
|
|
36
27
|
## Usage
|
|
37
28
|
|
|
38
29
|
If you don't have a Jenkins instance running, you can run one easily in Docker:
|
|
39
30
|
|
|
40
|
-
```
|
|
31
|
+
```sh
|
|
41
32
|
docker run -d -p 8080:8080 --name localjenkins jenkins/jenkins:lts
|
|
42
33
|
docker logs localjenkins
|
|
43
34
|
open http://localhost:8080
|
|
@@ -46,7 +37,57 @@ open http://localhost:8080
|
|
|
46
37
|
|
|
47
38
|
Then you should be able to run jester using the defaults for `-s` / `--url`.
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
** Run Jester **
|
|
41
|
+
|
|
42
|
+
Command usage:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Commands:
|
|
46
|
+
jester build # Build (run) a Jenkins pipeline job
|
|
47
|
+
jester help [COMMAND] # Describe available commands or one specific command
|
|
48
|
+
jester new # Create new Jenkins pipeline job
|
|
49
|
+
jester test # Test Jenkins server connectivity
|
|
50
|
+
jester version # Output version of jester
|
|
51
|
+
|
|
52
|
+
Options:
|
|
53
|
+
-s, [--url=URL] # URL of Jenkins master
|
|
54
|
+
# Default: http://localhost:8080
|
|
55
|
+
-u, [--username=USERNAME] # User to connect with
|
|
56
|
+
# Default: admin
|
|
57
|
+
-p, [--password=PASSWORD] # Password to connect with
|
|
58
|
+
# Default: admin
|
|
59
|
+
-v, [--verbose], [--no-verbose] # Toggle verbose/debug output
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Run your local pipeline on Jenkins (assuming defaults, like Jenkins running on localhost:8080):
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
$ jester test
|
|
67
|
+
Testing authenticated connectivity to http://localhost:8080...
|
|
68
|
+
Success! Running Jenkins version 2.121.3
|
|
69
|
+
|
|
70
|
+
$ jester build -f Jenkinsfile.example
|
|
71
|
+
Job config update succeeded.
|
|
72
|
+
Build running - getting output...
|
|
73
|
+
Job 1 result: SUCCESS
|
|
74
|
+
See jester-test-job.log for output.
|
|
75
|
+
|
|
76
|
+
$ cat jester-test-job.log
|
|
77
|
+
Started by user admin
|
|
78
|
+
Running in Durability level: MAX_SURVIVABILITY
|
|
79
|
+
[Pipeline] node
|
|
80
|
+
Running on Jenkins in /var/jenkins_home/workspace/jester-test-job
|
|
81
|
+
[Pipeline] {
|
|
82
|
+
[Pipeline] echo
|
|
83
|
+
hello world!
|
|
84
|
+
[Pipeline] }
|
|
85
|
+
[Pipeline] // node
|
|
86
|
+
[Pipeline] End of Pipeline
|
|
87
|
+
Finished: SUCCESS
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Rinse and repeat...
|
|
50
91
|
|
|
51
92
|
## Development
|
|
52
93
|
|
data/lib/jester/cli.rb
CHANGED
|
@@ -2,6 +2,7 @@ require 'thor'
|
|
|
2
2
|
require 'faraday'
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'uri'
|
|
5
|
+
require 'pry'
|
|
5
6
|
|
|
6
7
|
module Jester
|
|
7
8
|
class Cli < Thor
|
|
@@ -75,15 +76,24 @@ module Jester
|
|
|
75
76
|
|
|
76
77
|
if job_exists?(@options[:job_name])
|
|
77
78
|
path = "/job/" + @options[:job_name] + "/config.xml"
|
|
79
|
+
puts "Job already exists, using path: #{path}" if debug
|
|
78
80
|
else
|
|
79
81
|
path = "/createItem?name=" + @options[:job_name]
|
|
82
|
+
puts "Job doesn't exist yet, using path: #{path}" if debug
|
|
80
83
|
end
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
begin
|
|
85
|
+
r = post( @options[:url] + path, xml )
|
|
86
|
+
if r.status != 200
|
|
87
|
+
puts "Job config update failed."
|
|
88
|
+
raise 'JobPostFailed'
|
|
89
|
+
else
|
|
90
|
+
puts "Job config update succeeded."
|
|
91
|
+
end
|
|
92
|
+
rescue Exception => e
|
|
93
|
+
puts "Exception: " + e.message
|
|
94
|
+
puts "POST response status: #{r.status}"
|
|
95
|
+
puts "POST response body: #{r.body}" if debug
|
|
96
|
+
return e
|
|
87
97
|
end
|
|
88
98
|
|
|
89
99
|
build_path = "/job/" + @options[:job_name] + "/build?delay=0sec"
|
data/lib/jester/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jester
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- adampats
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-12-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|
|
@@ -109,7 +109,7 @@ files:
|
|
|
109
109
|
- ".ruby-version"
|
|
110
110
|
- ".travis.yml"
|
|
111
111
|
- Gemfile
|
|
112
|
-
- Jenkinsfile
|
|
112
|
+
- Jenkinsfile.example
|
|
113
113
|
- LICENSE.txt
|
|
114
114
|
- README.md
|
|
115
115
|
- Rakefile
|