python-jcli 1.0.0__py3-none-any.whl → 1.0.1__py3-none-any.whl

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.
Files changed (44) hide show
  1. jcli/__init__.py +1 -1
  2. jcli/cli.py +30 -10
  3. jcli/cli_helpers.py +5 -42
  4. jcli/skills/jcli/build/SKILL.md +123 -0
  5. jcli/specs/_auth.yaml +15 -0
  6. jcli/{plugins/skills.py → specs/plugins/jcli_commands.py} +64 -46
  7. jcli/specs/plugins/jenkins_auth.py +75 -0
  8. jcli/specs/plugins/jenkins_methods.py +332 -0
  9. jcli/specs/plugins/jenkins_pipeline_validate.py +51 -0
  10. jcli/specs/plugins/jenkins_plugin.py +77 -0
  11. jcli/specs/plugins/jenkins_system.py +137 -0
  12. jcli/specs/resources/build.yaml +160 -0
  13. jcli/specs/resources/credential.yaml +97 -0
  14. jcli/specs/resources/job.yaml +184 -0
  15. jcli/specs/resources/node.yaml +69 -0
  16. jcli/specs/resources/pipeline.yaml +62 -0
  17. jcli/specs/resources/plugin.yaml +65 -0
  18. jcli/specs/resources/system.yaml +72 -0
  19. jcli/specs/resources/view.yaml +75 -0
  20. {python_jcli-1.0.0.dist-info → python_jcli-1.0.1.dist-info}/METADATA +10 -9
  21. python_jcli-1.0.1.dist-info/RECORD +40 -0
  22. jcli/plugins/__init__.py +0 -28
  23. jcli/plugins/build.py +0 -197
  24. jcli/plugins/config.py +0 -268
  25. jcli/plugins/credential.py +0 -210
  26. jcli/plugins/job.py +0 -425
  27. jcli/plugins/node.py +0 -134
  28. jcli/plugins/pipeline.py +0 -108
  29. jcli/plugins/plugin.py +0 -173
  30. jcli/plugins/system.py +0 -173
  31. jcli/plugins/view.py +0 -148
  32. jcli/sdk/build.py +0 -182
  33. jcli/sdk/credential.py +0 -143
  34. jcli/sdk/job.py +0 -191
  35. jcli/sdk/job_templates.py +0 -128
  36. jcli/sdk/node.py +0 -139
  37. jcli/sdk/pipeline.py +0 -121
  38. jcli/sdk/plugin.py +0 -155
  39. jcli/sdk/system.py +0 -202
  40. jcli/sdk/view.py +0 -94
  41. python_jcli-1.0.0.dist-info/RECORD +0 -44
  42. {python_jcli-1.0.0.dist-info → python_jcli-1.0.1.dist-info}/WHEEL +0 -0
  43. {python_jcli-1.0.0.dist-info → python_jcli-1.0.1.dist-info}/entry_points.txt +0 -0
  44. {python_jcli-1.0.0.dist-info → python_jcli-1.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,160 @@
1
+ name: build
2
+ description: Manage Jenkins builds
3
+ methods:
4
+ list:
5
+ description: List recent builds for a job
6
+ http:
7
+ method: GET
8
+ path: "job/{{ job_name | replace('/', '/job/') }}/api/json"
9
+ query:
10
+ tree: "builds[number,url,result,timestamp,duration,building]{% if limit > 0 %}{0,{{ limit }}}{% endif %}"
11
+ body: ''
12
+ params:
13
+ path:
14
+ - name: job_name
15
+ type: string
16
+ argument: true
17
+ body:
18
+ - name: limit
19
+ type: int
20
+ default: 10
21
+ description: Maximum builds to show
22
+ output:
23
+ items_path: $.builds
24
+ fields:
25
+ - name: number
26
+ alias: Number
27
+ - name: result
28
+ alias: Result
29
+ - name: duration
30
+ alias: Duration
31
+ - name: building
32
+ alias: Building
33
+
34
+ get:
35
+ description: Show details for a specific build
36
+ http:
37
+ method: GET
38
+ path: "job/{{ job_name | replace('/', '/job/') }}/{{ number }}/api/json"
39
+ params:
40
+ path:
41
+ - name: job_name
42
+ type: string
43
+ argument: true
44
+ - name: number
45
+ type: int
46
+ argument: true
47
+
48
+ trigger:
49
+ description: Trigger a new build for a job (with optional KEY=VAL params)
50
+ type: plugin:jenkins_build_trigger
51
+ params:
52
+ body:
53
+ - name: job_name
54
+ type: string
55
+ argument: true
56
+ - name: params
57
+ type: string
58
+ multiple: true
59
+
60
+ log:
61
+ description: Show console log for a build (-f to follow live, -n for trailing lines)
62
+ type: plugin:jenkins_build_log
63
+ params:
64
+ body:
65
+ - name: job_name
66
+ type: string
67
+ argument: true
68
+ - name: number
69
+ type: int
70
+ argument: true
71
+ - name: follow
72
+ type: bool
73
+ description: Follow the log live (tail -f style)
74
+ - name: lines
75
+ type: int
76
+ description: "Number of trailing lines to show (default: all)"
77
+
78
+ stop:
79
+ description: Stop a running build
80
+ http:
81
+ method: POST
82
+ path: "job/{{ job_name | replace('/', '/job/') }}/{{ number }}/stop"
83
+ params:
84
+ path:
85
+ - name: job_name
86
+ type: string
87
+ argument: true
88
+ - name: number
89
+ type: int
90
+ argument: true
91
+
92
+ queue:
93
+ description: Show the current Jenkins build queue
94
+ http:
95
+ method: GET
96
+ path: queue/api/json
97
+ output:
98
+ items_path: $.items
99
+ fields:
100
+ - name: id
101
+ alias: ID
102
+ - name: why
103
+ alias: Why
104
+ - name: inQueueSince
105
+ alias: Since
106
+
107
+ artifacts:
108
+ description: List artifacts produced by a build
109
+ http:
110
+ method: GET
111
+ path: "job/{{ job_name | replace('/', '/job/') }}/{{ build_number }}/api/json"
112
+ query:
113
+ tree: "artifacts[fileName,relativePath]"
114
+ params:
115
+ path:
116
+ - name: job_name
117
+ type: string
118
+ argument: true
119
+ - name: build_number
120
+ type: int
121
+ argument: true
122
+ output:
123
+ items_path: $.artifacts
124
+ fields:
125
+ - name: fileName
126
+ alias: File
127
+ - name: relativePath
128
+ alias: Path
129
+
130
+ rebuild:
131
+ description: Rebuild a build reusing its parameters (with optional --set overrides)
132
+ type: plugin:jenkins_build_rebuild
133
+ params:
134
+ body:
135
+ - name: job_name
136
+ type: string
137
+ argument: true
138
+ - name: build_number
139
+ type: int
140
+ argument: true
141
+ - name: set
142
+ type: string
143
+ multiple: true
144
+ description: Override parameters (KEY=VAL)
145
+
146
+ replay:
147
+ description: Replay a Pipeline build with a modified Jenkinsfile
148
+ type: plugin:jenkins_build_replay
149
+ params:
150
+ body:
151
+ - name: job_name
152
+ type: string
153
+ argument: true
154
+ - name: build_number
155
+ type: int
156
+ argument: true
157
+ - name: jenkinsfile
158
+ type: file
159
+ argument: true
160
+ description: Jenkinsfile content to replay with
@@ -0,0 +1,97 @@
1
+ name: credential
2
+ description: Manage Jenkins credentials
3
+ methods:
4
+ list:
5
+ description: List credentials in a store/domain
6
+ http:
7
+ method: GET
8
+ path: "credentials/store/{{ store }}/domain/{{ domain }}/api/json"
9
+ params:
10
+ path:
11
+ - name: store
12
+ type: string
13
+ default: system
14
+ - name: domain
15
+ type: string
16
+ default: "_"
17
+ query:
18
+ - name: depth
19
+ type: int
20
+ output:
21
+ items_path: $.credentials
22
+ fields:
23
+ - name: id
24
+ alias: ID
25
+ - name: description
26
+ alias: Description
27
+ - name: typeName
28
+ alias: Type
29
+ get:
30
+ description: Get credential details
31
+ http:
32
+ method: GET
33
+ path: "credentials/store/{{ store }}/domain/_/credential/{{ cred_id }}/api/json"
34
+ params:
35
+ path:
36
+ - name: cred_id
37
+ type: string
38
+ argument: true
39
+ - name: store
40
+ type: string
41
+ default: system
42
+ create:
43
+ description: Create a credential from XML config
44
+ http:
45
+ method: POST
46
+ path: "credentials/store/{{ store }}/domain/{{ domain }}/createCredentials"
47
+ headers:
48
+ Content-Type: application/xml
49
+ body: "{{ xml_data }}"
50
+ params:
51
+ path:
52
+ - name: store
53
+ type: string
54
+ default: system
55
+ - name: domain
56
+ type: string
57
+ default: "_"
58
+ body:
59
+ - name: xml_data
60
+ type: file
61
+ argument: true
62
+ update:
63
+ description: Update an existing credential
64
+ http:
65
+ method: POST
66
+ path: "credentials/store/{{ store }}/domain/_/credential/{{ cred_id }}/updateCredentials"
67
+ headers:
68
+ Content-Type: application/xml
69
+ body: "{{ xml_data }}"
70
+ params:
71
+ path:
72
+ - name: cred_id
73
+ type: string
74
+ argument: true
75
+ - name: store
76
+ type: string
77
+ default: system
78
+ body:
79
+ - name: xml_data
80
+ type: file
81
+ argument: true
82
+ delete:
83
+ description: Delete a credential
84
+ http:
85
+ method: POST
86
+ path: "credentials/store/{{ store }}/domain/{{ domain }}/credential/{{ cred_id }}/doDelete"
87
+ params:
88
+ path:
89
+ - name: cred_id
90
+ type: string
91
+ argument: true
92
+ - name: store
93
+ type: string
94
+ default: system
95
+ - name: domain
96
+ type: string
97
+ default: "_"
@@ -0,0 +1,184 @@
1
+ name: job
2
+ description: Manage Jenkins jobs
3
+ methods:
4
+ list:
5
+ description: List all Jenkins jobs
6
+ http:
7
+ method: GET
8
+ path: api/json
9
+ query:
10
+ tree: jobs[name,url,color]
11
+ output:
12
+ items_path: $.jobs
13
+ fields:
14
+ - name: name
15
+ alias: Name
16
+ - name: url
17
+ alias: URL
18
+ - name: color
19
+ alias: Color
20
+ get:
21
+ description: Show details for a specific job
22
+ http:
23
+ method: GET
24
+ path: job/{{ name }}/api/json
25
+ params:
26
+ path:
27
+ - name: name
28
+ type: string
29
+ argument: true
30
+ output:
31
+ items_path: $
32
+ fields:
33
+ - name: name
34
+ alias: Name
35
+ - name: description
36
+ alias: Description
37
+ - name: color
38
+ alias: Color
39
+ - name: buildable
40
+ alias: Buildable
41
+ - name: disabled
42
+ alias: Disabled
43
+ create:
44
+ description: Create a new job from XML config file or parameters
45
+ type: plugin:jenkins_job_create
46
+ params:
47
+ path:
48
+ - name: name
49
+ type: string
50
+ argument: true
51
+ body:
52
+ - name: config_file
53
+ type: file
54
+ - name: job_type
55
+ type: enum
56
+ choices: [freestyle, pipeline]
57
+ - name: git_url
58
+ type: string
59
+ - name: git_branch
60
+ type: string
61
+ default: main
62
+ - name: description
63
+ type: string
64
+ - name: shell
65
+ type: string
66
+ - name: cron
67
+ type: string
68
+ - name: jenkinsfile
69
+ type: string
70
+ default: Jenkinsfile
71
+ - name: script
72
+ type: string
73
+ update:
74
+ description: Update a job's configuration from an XML file
75
+ http:
76
+ method: POST
77
+ path: job/{{ name }}/config.xml
78
+ headers:
79
+ Content-Type: application/xml
80
+ body: '{{ config_xml }}'
81
+ params:
82
+ path:
83
+ - name: name
84
+ type: string
85
+ argument: true
86
+ body:
87
+ - name: config_xml
88
+ type: file
89
+ argument: true
90
+ delete:
91
+ description: Delete a job
92
+ http:
93
+ method: POST
94
+ path: job/{{ name }}/doDelete
95
+ params:
96
+ path:
97
+ - name: name
98
+ type: string
99
+ argument: true
100
+ copy:
101
+ description: Copy a job to a new name
102
+ http:
103
+ method: POST
104
+ path: createItem
105
+ query:
106
+ name: '{{ new_name }}'
107
+ mode: copy
108
+ from: '{{ from_name }}'
109
+ params:
110
+ path:
111
+ - name: from_name
112
+ type: string
113
+ argument: true
114
+ - name: new_name
115
+ type: string
116
+ argument: true
117
+ rename:
118
+ description: Rename a job
119
+ http:
120
+ method: POST
121
+ path: job/{{ old_name }}/doRename
122
+ query:
123
+ newName: '{{ new_name }}'
124
+ params:
125
+ path:
126
+ - name: old_name
127
+ type: string
128
+ argument: true
129
+ - name: new_name
130
+ type: string
131
+ argument: true
132
+ enable:
133
+ description: Enable a disabled job
134
+ http:
135
+ method: POST
136
+ path: job/{{ name }}/enable
137
+ params:
138
+ path:
139
+ - name: name
140
+ type: string
141
+ argument: true
142
+ disable:
143
+ description: Disable a job
144
+ http:
145
+ method: POST
146
+ path: job/{{ name }}/disable
147
+ params:
148
+ path:
149
+ - name: name
150
+ type: string
151
+ argument: true
152
+ config:
153
+ description: Print the XML configuration of a job
154
+ http:
155
+ method: GET
156
+ path: job/{{ name }}/config.xml
157
+ params:
158
+ path:
159
+ - name: name
160
+ type: string
161
+ argument: true
162
+ create-folder:
163
+ description: Create a new folder
164
+ http:
165
+ method: POST
166
+ path: createItem
167
+ query:
168
+ name: '{{ name }}'
169
+ mode: com.cloudbees.hudson.plugins.folder.Folder
170
+ params:
171
+ path:
172
+ - name: name
173
+ type: string
174
+ argument: true
175
+ delete-folder:
176
+ description: Delete a folder and all its contents
177
+ http:
178
+ method: POST
179
+ path: job/{{ name }}/doDelete
180
+ params:
181
+ path:
182
+ - name: name
183
+ type: string
184
+ argument: true
@@ -0,0 +1,69 @@
1
+ name: node
2
+ description: Manage Jenkins nodes (agents)
3
+ methods:
4
+ list:
5
+ description: List all Jenkins nodes
6
+ http:
7
+ method: GET
8
+ path: computer/api/json
9
+ output:
10
+ items_path: $.computer
11
+ fields:
12
+ - name: displayName
13
+ alias: Name
14
+ - name: offline
15
+ alias: Offline
16
+ - name: temporarilyOffline
17
+ alias: Temp Offline
18
+ get:
19
+ description: Get details of a specific node
20
+ http:
21
+ method: GET
22
+ path: "computer/{{ name }}/api/json"
23
+ params:
24
+ path:
25
+ - name: name
26
+ type: string
27
+ argument: true
28
+ delete:
29
+ description: Delete a Jenkins node
30
+ http:
31
+ method: POST
32
+ path: "computer/{{ name }}/doDelete"
33
+ params:
34
+ path:
35
+ - name: name
36
+ type: string
37
+ argument: true
38
+ toggle:
39
+ description: Toggle a node offline or online
40
+ http:
41
+ method: POST
42
+ path: "computer/{{ name }}/toggleOffline"
43
+ params:
44
+ path:
45
+ - name: name
46
+ type: string
47
+ argument: true
48
+ body:
49
+ - name: offlineMessage
50
+ type: string
51
+ create:
52
+ description: Create a new Jenkins agent node
53
+ type: plugin:jenkins_node_create
54
+ params:
55
+ body:
56
+ - name: name
57
+ type: string
58
+ argument: true
59
+ - name: num_executors
60
+ type: int
61
+ default: 1
62
+ - name: remote_fs
63
+ type: string
64
+ default: /tmp
65
+ - name: labels
66
+ type: string
67
+ - name: launch_method
68
+ type: string
69
+ default: hudson.slaves.JNLPLauncher
@@ -0,0 +1,62 @@
1
+ name: pipeline
2
+ description: Manage Jenkins pipelines
3
+ methods:
4
+ stages:
5
+ description: List stages for a Pipeline build
6
+ http:
7
+ method: GET
8
+ path: "job/{{ job_name | replace('/', '/job/') }}/{{ build_number }}/wfapi/describe"
9
+ params:
10
+ path:
11
+ - name: job_name
12
+ type: string
13
+ argument: true
14
+ - name: build_number
15
+ type: int
16
+ argument: true
17
+ output:
18
+ items_path: $.stages
19
+ fields:
20
+ - name: name
21
+ alias: Stage
22
+ - name: status
23
+ alias: Status
24
+ - name: durationMillis
25
+ alias: Duration
26
+ log:
27
+ description: Get log output for a Pipeline step
28
+ http:
29
+ method: GET
30
+ path: "job/{{ job_name | replace('/', '/job/') }}/{{ build_number }}/execution/node/{{ node_id }}/wfapi/log"
31
+ params:
32
+ path:
33
+ - name: job_name
34
+ type: string
35
+ argument: true
36
+ - name: build_number
37
+ type: int
38
+ argument: true
39
+ - name: node_id
40
+ type: string
41
+ argument: true
42
+ validate:
43
+ description: Validate a Jenkinsfile against the server
44
+ type: plugin:jenkins_pipeline_validate
45
+ params:
46
+ body:
47
+ - name: jenkinsfile
48
+ type: file
49
+ argument: true
50
+ pending:
51
+ description: Show pending input actions for a Pipeline build
52
+ http:
53
+ method: GET
54
+ path: "job/{{ job_name | replace('/', '/job/') }}/{{ build_number }}/wfapi/pendingInputActions"
55
+ params:
56
+ path:
57
+ - name: job_name
58
+ type: string
59
+ argument: true
60
+ - name: build_number
61
+ type: int
62
+ argument: true
@@ -0,0 +1,65 @@
1
+ name: plugin
2
+ description: Manage Jenkins plugins
3
+ methods:
4
+ list:
5
+ description: List installed Jenkins plugins
6
+ http:
7
+ method: GET
8
+ path: pluginManager/api/json
9
+ query:
10
+ tree: "plugins[shortName,version,active,hasUpdate]"
11
+ output:
12
+ items_path: $.plugins
13
+ fields:
14
+ - name: shortName
15
+ alias: Name
16
+ - name: version
17
+ alias: Version
18
+ - name: active
19
+ alias: Active
20
+ - name: hasUpdate
21
+ alias: Update
22
+ get:
23
+ description: Show details for a single plugin
24
+ type: plugin:jenkins_plugin_get
25
+ params:
26
+ body:
27
+ - name: short_name
28
+ type: string
29
+ argument: true
30
+ install:
31
+ description: Install one or more plugins (NAME or NAME@VERSION)
32
+ type: plugin:jenkins_plugin_install
33
+ params:
34
+ body:
35
+ - name: plugins
36
+ type: string
37
+ multiple: true
38
+ argument: true
39
+ uninstall:
40
+ description: Uninstall a plugin
41
+ http:
42
+ method: POST
43
+ path: "pluginManager/plugin/{{ short_name }}/doUninstall"
44
+ params:
45
+ path:
46
+ - name: short_name
47
+ type: string
48
+ argument: true
49
+ check-updates:
50
+ description: Check for plugin updates
51
+ http:
52
+ method: POST
53
+ path: pluginManager/checkUpdates
54
+ output:
55
+ format: json
56
+ restart:
57
+ description: Restart a plugin
58
+ http:
59
+ method: POST
60
+ path: "pluginManager/plugin/{{ short_name }}/restart"
61
+ params:
62
+ path:
63
+ - name: short_name
64
+ type: string
65
+ argument: true
@@ -0,0 +1,72 @@
1
+ name: system
2
+ description: Jenkins system information and management
3
+ methods:
4
+ info:
5
+ description: Show Jenkins system version and stats
6
+ type: plugin:jenkins_system_info
7
+ params:
8
+ body: {}
9
+
10
+ load:
11
+ description: Show queue length and executor usage
12
+ type: plugin:jenkins_system_load
13
+ params:
14
+ body: {}
15
+
16
+ quiet-down:
17
+ description: Put Jenkins into quiet-down mode
18
+ http:
19
+ method: POST
20
+ path: quietDown
21
+ query:
22
+ reason: '{{ reason }}'
23
+ params:
24
+ query:
25
+ - name: reason
26
+ type: string
27
+
28
+ cancel-quiet-down:
29
+ description: Cancel quiet-down mode
30
+ http:
31
+ method: POST
32
+ path: cancelQuietDown
33
+
34
+ restart:
35
+ description: Trigger a safe restart of Jenkins
36
+ http:
37
+ method: POST
38
+ path: safeRestart
39
+
40
+ script:
41
+ description: Execute a Groovy script on the server
42
+ type: plugin:jenkins_system_script
43
+ params:
44
+ body:
45
+ - name: script
46
+ type: string
47
+ argument: true
48
+
49
+ users:
50
+ description: List all Jenkins users
51
+ http:
52
+ method: GET
53
+ path: asynchPeople/api/json
54
+ output:
55
+ items_path: $.users
56
+ fields:
57
+ - name: id
58
+ alias: ID
59
+ - name: fullName
60
+ alias: Name
61
+
62
+ token:
63
+ description: Generate a new API token for a user
64
+ type: plugin:jenkins_system_token
65
+ params:
66
+ body:
67
+ - name: username
68
+ type: string
69
+ argument: true
70
+ - name: token_name
71
+ type: string
72
+ default: jcli-generated