Skip to content

Commit abd4651

Browse files
Merge branch 'master' into create_credential_by_id
2 parents ab97534 + ff2f305 commit abd4651

File tree

124 files changed

+5513
-4697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+5513
-4697
lines changed

.github/workflows/python-package.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: CI_TEST
5+
6+
on:
7+
push:
8+
paths:
9+
- '**.py'
10+
- '**.yml'
11+
pull_request:
12+
branches: [ "master" ]
13+
workflow_dispatch: # allow manual run
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
23+
token: ["stable"]
24+
25+
steps:
26+
- name: Harden Runner
27+
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
28+
with:
29+
egress-policy: audit
30+
allowed-endpoints: >
31+
azure.archive.ubuntu.com:80
32+
esm.ubuntu.com:443
33+
files.pythonhosted.org:443
34+
ftp-chi.osuosl.org:443
35+
ftp-nyc.osuosl.org:443
36+
get.jenkins.io:443
37+
github.com:443
38+
api.github.com:443
39+
int.api.stepsecurity.io:443
40+
mirror.xmission.com:443
41+
motd.ubuntu.com:443
42+
packages.microsoft.com:443
43+
ppa.launchpadcontent.net:443
44+
pypi.org:443
45+
updates.jenkins-ci.org:80
46+
updates.jenkins.io:443
47+
mirrors.updates.jenkins.io:443
48+
updates.jenkins.io:80
49+
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
53+
- name: Install uv
54+
uses: astral-sh/setup-uv@v5
55+
with:
56+
python-version: ${{ matrix.python-version }}
57+
enable-cache: true
58+
59+
- name: Install python
60+
run: uv python install
61+
62+
- name: setup java 17
63+
uses: actions/setup-java@v3
64+
with:
65+
java-version: '17'
66+
distribution: 'temurin'
67+
68+
- name: Install dependencies
69+
run: |
70+
sudo apt-get install libkrb5-dev
71+
72+
- name: Lint with flake8
73+
run: |
74+
uv run flake8 jenkinsapi/ --count --select=E9,F63,F7,F82 --ignore F821,W503,W504 --show-source --statistics
75+
uv run flake8 jenkinsapi/ --count --exit-zero --max-complexity=10 --max-line-length=79 --statistics
76+
77+
- name: Test with pytest
78+
env:
79+
JENKINS_VERSION: ${{ matrix.token }}
80+
run: |
81+
uv run pytest -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ coverage.xml
2929
.vscode/
3030
*.war
3131
venv/
32+
tags
33+
.pytype/

.pre-commit-config.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
repos:
3+
- repo: https://github.com/psf/black
4+
rev: 22.10.0
5+
hooks:
6+
- id: black
7+
args:
8+
- --line-length=79
9+
# these folders wont be formatted by black
10+
- --exclude="""\.git |
11+
\.__pycache__|
12+
\.hg|
13+
\.mypy_cache|
14+
\.tox|
15+
\.venv|
16+
_build|
17+
buck-out|
18+
build|
19+
dist"""
20+
language_version: python3
21+
- repo: https://github.com/pre-commit/pre-commit-hooks
22+
rev: v4.3.0
23+
hooks:
24+
- id: end-of-file-fixer
25+
- id: trailing-whitespace
26+
- id: mixed-line-ending
27+
- id: check-byte-order-marker
28+
- id: check-executables-have-shebangs
29+
- id: check-merge-conflict
30+
- id: check-symlinks
31+
- id: check-vcs-permalinks
32+
- id: debug-statements
33+
- id: check-yaml
34+
files: .*\.(yaml|yml)$

.travis.yml .travis.yml.todelete

File renamed without changes.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 PyContribs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: test lint tox coverage dist
22

33
test:
4-
py.test -sv jenkinsapi_tests
4+
pytest -sv jenkinsapi_tests
55

66
lint:
77
pycodestyle
@@ -14,4 +14,4 @@ dist:
1414
python setup.py sdist bdist_wheel
1515

1616
coverage:
17-
py.test -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests
17+
pytest -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests

README.rst

+46-66
Original file line numberDiff line numberDiff line change
@@ -4,75 +4,48 @@ jenkinsapi
44
.. image:: https://badge.fury.io/py/jenkinsapi.png
55
:target: http://badge.fury.io/py/jenkinsapi
66

7-
.. image:: https://travis-ci.com/pycontribs/jenkinsapi.png?branch=master
8-
:target: https://travis-ci.com/pycontribs/jenkinsapi
9-
107
.. image:: https://codecov.io/gh/pycontribs/jenkinsapi/branch/master/graph/badge.svg
118
:target: https://codecov.io/gh/pycontribs/jenkinsapi
129

13-
.. image:: https://requires.io/github/pycontribs/jenkinsapi/requirements.png?branch=master
14-
:target: https://requires.io/github/pycontribs/jenkinsapi/requirements/?branch=master
15-
:alt: Requirements Status
16-
1710
About this library
1811
-------------------
1912

2013
Jenkins is the market leading continuous integration system, originally created by Kohsuke Kawaguchi.
2114

22-
Jenkins (and It's predecessor Hudson) are useful projects for automating common development tasks (e.g. unit-testing, production batches) - but they are somewhat Java-centric. Thankfully the designers have provided an excellent and complete REST interface. This library wraps up that interface as more conventional python objects in order to make many Jenkins oriented tasks easier to automate.
15+
Jenkins (and its predecessor Hudson) are useful projects for automating common development tasks (e.g. unit-testing, production batches) - but they are somewhat Java-centric.
16+
| Jenkinsapi makes scripting Jenkins tasks a breeze by wrapping the REST api into familiar python objects.
17+
| Here is a list of some of the most commonly used functionality
2318
24-
This library allows you to automate most common Jenkins operations using Python, such as:
25-
26-
* Ability to add/remove/query Jenkins jobs
27-
* Ability to execute jobs and:
19+
* Add, remove, and query Jenkins jobs
20+
* Control pipeline execution
2821
* Query the results of a completed build
2922
* Block until jobs are complete or run jobs asyncronously
3023
* Get objects representing the latest builds of a job
31-
* Work with build artifacts:
24+
* Artifact management
3225
* Search for artifacts by simple criteria
3326
* Install artifacts to custom-specified directory structures
34-
* Ability to search for builds by source code revision
35-
* Ability to add/remove/query:
36-
* Slaves (Webstart and SSH slaves)
27+
* Search for builds by source code revision
28+
* Create, destroy, and monitor
29+
* Build nodes (Webstart and SSH slaves)
3730
* Views (including nested views using NestedViews Jenkins plugin)
3831
* Credentials (username/password and ssh key)
39-
* Username/password auth support for jenkins instances with auth turned on
40-
* Ability to script jenkins installation including plugins
41-
42-
For a full documentation spec of what this library supports see: http://jenkinsapi.readthedocs.io/en/latest/index.html
32+
* Authentication support for username and password
33+
* Manage jenkins and plugin installation
4334

44-
Python versions
45-
---------------
46-
47-
The project has been tested against Python versions:
35+
Full library capabilities are outlined in the `Documentation <http://jenkinsapi.readthedocs.io/en/latest/index.html>`_
4836

49-
* 2.7
50-
* 3.4
51-
* 3.5
52-
* 3.6
53-
* 3.7
54-
55-
Jenkins versions
56-
----------------
57-
58-
Project tested on both stable (LTS) and latest Jenkins versions.
5937

6038
Known issues
6139
------------
6240
* Job deletion operations fail unless Cross-Site scripting protection is disabled.
63-
64-
For other issues, please refer to the support URL below.
41+
| For other issues, please refer to the `support URL <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
6542
6643
Important Links
6744
---------------
68-
69-
Support and bug-reports: https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open
70-
71-
Project source code: github: https://github.com/pycontribs/jenkinsapi
72-
73-
Project documentation: https://jenkinsapi.readthedocs.org/en/latest/
74-
75-
Releases: http://pypi.python.org/pypi/jenkinsapi
45+
* `Support and bug-reports <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
46+
* `Source Code <https://github.com/pycontribs/jenkinsapi>`_
47+
* `Documentation <https://jenkinsapi.readthedocs.org/en/latest/>`_
48+
* `Releases <http://pypi.python.org/pypi/jenkinsapi>`_
7649

7750
Installation
7851
-------------
@@ -114,20 +87,14 @@ JenkinsAPI is intended to map the objects in Jenkins (e.g. Builds, Views, Jobs)
11487

11588
.. code-block:: python
11689
117-
>>> import jenkinsapi
118-
>>> from jenkinsapi.jenkins import Jenkins
119-
>>> J = Jenkins('http://localhost:8080')
120-
>>> J.version
121-
1.542
122-
>>> J.keys() # Jenkins objects appear to be dict-like, mapping keys (job-names) to
123-
['foo', 'test_jenkinsapi']
124-
>>> J['test_jenkinsapi']
125-
<jenkinsapi.job.Job test_jenkinsapi>
126-
>>> J['test_jenkinsapi'].get_last_good_build()
127-
<jenkinsapi.build.Build test_jenkinsapi #77>
128-
...
129-
130-
More examples available on Github: https://github.com/pycontribs/jenkinsapi/tree/master/examples
90+
from jenkinsapi.jenkins import Jenkins
91+
J = Jenkins('http://localhost:8080')
92+
print(J.version) # 1.542
93+
print(J.keys()) # foo, test_jenkinsapi
94+
print(J.get('test_jenkinsapi')) # <jenkinsapi.job.Job test_jenkinsapi>
95+
print(J.get('test_jenkinsapi').get_last_good_build()) # <jenkinsapi.build.Build test_jenkinsapi #77>
96+
97+
More examples available on `Github <https://github.com/pycontribs/jenkinsapi/tree/master/examples>`_
13198

13299
Testing
133100
-------
@@ -144,28 +111,41 @@ missing test dependencies:
144111

145112
.. code-block:: bash
146113
147-
virtualenv
148-
source .venv/bin/active
149-
(venv) python setup.py test
114+
python -m venv ./.venv/jenkinsapi
115+
source .venv/jenkinsapi/bin/activate
116+
pip install -r requirements.txt
117+
python setup.py test
150118
151119
Development
152120
-----------
153121

154-
* Make sure that you have Java_ installed.
122+
* Make sure that you have Java_ installed. Jenkins will be automatically
123+
downloaded and started during tests.
155124
* Create virtual environment for development
156125
* Install package in development mode
157126

158127
.. code-block:: bash
159128
160-
(venv) pip install -e .
161-
(venv) pip install -r test-requirements.txt
129+
pip install -r test-requirements.txt
162130
163131
* Make your changes, write tests and check your code
164132

165133
.. code-block:: bash
166134
167-
(venv) tox
135+
pytest -sv
136+
137+
Python versions
138+
---------------
168139

140+
The project has been tested against Python versions:
141+
142+
* 3.8 - 3.13
143+
* 2.7 - last version compatible with Python 2.7 is tagged Py2 in repository and available on PyPi as version 0.3.13
144+
145+
Jenkins versions
146+
----------------
147+
148+
Project tested on both stable (LTS) and latest Jenkins versions.
169149

170150
Project Contributors
171151
--------------------
@@ -194,4 +174,4 @@ The above copyright notice and this permission notice shall be included in all c
194174

195175
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
196176

197-
.. _Java: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
177+
.. _Java: https://www.oracle.com/java/technologies/downloads/#java17

doc/source/rules_for_contributors.rst doc/CONTRIBUTING.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ The JenkinsAPI project welcomes contributions via GitHub. Please bear in mind th
66
Python compatibility
77
--------------------
88

9-
The project currently targets Python 2.6 and Python 2.7. Support for Python 3.x will be introduced soon. Please do not add any features which
10-
will break our supported Python 2.x versions or make it harder for us to migrate to Python 3.x
9+
The project currently targets Python 3.8+. Last version compatible with Python 2.7 is tagged as Py2.
10+
11+
Code formatting
12+
---------------
13+
14+
The project follows strict PEP8 guidelines. Please use a tool like black to format your code before submitting a pull request. Tell black to use 79 characters per line (black -l 79).
1115

1216
Test Driven Development
1317
-----------------------
1418

15-
Please do not submit pull requests without tests. That's really important. Our project is all about test-driven development. It would be
16-
embarrasing if our project failed because of a lack of tests!
19+
Please do not submit pull requests without tests. That's really important. Our project is all about test-driven development. It would be embarrasing if our project failed because of a lack of tests!
1720

1821
You might want to follow a typical test driven development cycle: http://en.wikipedia.org/wiki/Test-driven_development
1922

@@ -24,7 +27,7 @@ Features implemented without tests will be removed. Unmaintained features (which
2427
Check the CI status before comitting
2528
------------------------------------
2629

27-
We have a Travis CI account - please verify that your branch works before making a pull request.
30+
Project uses Github Actions, please verify that your branch passes all tests before making a pull request.
2831

2932
Any problems?
3033
-------------

doc/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
docs.zipfile.filename=docs_html.zip
22
docs.html.dir=html
3-
docs.source.dir=source
3+
docs.source.dir=source

0 commit comments

Comments
 (0)