Adjust some of the dependencies.
multi_key_dict is not shipped by OpenStack Zuul templates
`build-openstack-docs-pti` or `openstack-cover-jobs` we thus need to
depend on `requirements.txt`.
setuptools v66.0.0 removed support for PEP 440 non-conforming versions.
It provides pkg_resources which we use in PluginVersion.
Tox `whitelist_externals` has been renamed `allowlist_externals`.
Signed-off-by: Antoine Musso <hashar@free.fr>
Change-Id: Ie791c2bb0e7b3784913f45768d2f3db4c66ccae5
Use full job name in `get_job_info_regex` instead of just the name, so
that matches will work in folders as well.
Closes-Bug: 1685575
Change-Id: I97ba8ca004387b376a511ba52fc9fdd2aeb98a63
When retreiving data from builds, the build number can have a string portion.
This is for matrix jobs that define a label to retrieve one sub-build of the
matrix job.
The URL structure is:
https://<jenkins_server>/job/>job_name>/<number>/label=<configuration>/
Allowing a string for build number allows for it to be specifed as, e.g.:
1/label=amd64
And whilst being somewhat a workaround, works without introducing complexity
and modifying function calls for extra parameters.
Change-Id: Ic409df6e20e85d6a417c6490472b3729f1f20cd2
Enable calls to retreive artifacts from Jenkins and also to pull
the stages data from the wfapi endpoint.
Change-Id: I59eb403d54416ed45a918d98fc2f43c3c02441d0
stestr 3.0.0 does not support python 2.7 but has been released without
the proper metadata to reflect that. As a result, there is a python2 wheel
stestr-3.0.0-py2-none-any.whl which get picked up.
Blacklist stestr 3.0.0 to fix '--list': no such option error
Drop pypy testing since pypy jobs are always failling.
Signed-off-by: Antoine Musso <hashar@free.fr>
Signed-off-by: Andreas Jaeger <aj@suse.com>
Change-Id: Ia2f7c814f21c78f29ec9024997469625f92bc401
Pipeline jobs in in Jenkins 2.x appear as placeholder tasks for their
entire lifetime when queried via the API. The fix for #1659787
introduced completly ignoring placeholder tasks. Thus pipeline jobs are
never included in the list returned by get_running_builds.
This commit will change the behaviour of get_running_builds as follows:
- Placeholder tasks will be included: So running pipeline jobs
will be included.
- Builds which do not have a build number yet will be ignored:
This prevents the exception described in #1659787.
Change-Id: I30351ec78d6186b0674e3c08be00076b0ce2333e
Closes-Bug: #1750372
Related-Bug: #1659787
Previously, reconfig_credential() passed empty `data` with
`Content-Length: 0` to the credentials configuration rather
than the credentials data.
This patch fixes the issue by passing the config_xml data to
the configuration API to properly update the credential.
Change-Id: Idef50f5a31d55991698b6217f55f15a9308b8526
Replace the readthedocs template that warns about a broken setup
with a template that just builds the documents
(build-openstack-docs-pti) so that we can remove the obsolete template.
If the repo wants to use publish later to readthedocs, the template
can be changed to docs-on-readthedocs as explained in
http://lists.openstack.org/pipermail/openstack-dev/2018-August/132836.html
Change-Id: I343d16e6ec8180f4fd9ac058eaab06378ccee6bc
The repo uses docs-on-read-the-docs, remove extra
build-openstack-sphinx gate job.
Without this change, two docs jobs would be building in gate, tox-docs
and build-sphinx. One is enough.
Also, use templates instead of individual jobs.
Import other templates from project-config, use the failing docs
template since readthedocs is not setup yet.
Remove publish-to-pypi, this should stay in project-config.
Fix sphinx requirements for python 3.
Fix decoding in failing test.
Change-Id: Ic4f715b45c1284ea49339e96c2aa87b2e81fcbea
Make sure to use fullName from the API results to correctly
compute the URL for the additional API request.
Change-Id: I7ca1f2e15a6c40883ba376b182c2c991ca76e8b2
Closes-Bug:#1828051
Other specific requests may need a body. Thus remove the general check
for an empty body and add a more specific one where needed.
I noticed this because when updating a Jenkins job with Jenkins Job
Builder I got an EmptyResponseException even though updating worked
correctly.
Change-Id: Ie144e6fb0b922a681e6c65ffbe5120da72a495f0
This is a mechanically generated patch to add a unit test job running
under Python 3.6 as part of the python3-first goal.
See the python3-first goal document for details:
https://governance.openstack.org/tc/goals/stein/python3-first.html
Change-Id: I80117242630a1aa6df39b33b0ab66616ab8923a9
Story: #2002586
The commands used by constraints need at least tox 2.0. Update to
reflect reality, which should help with local running of constraints
targets.
Change-Id: I8146e56453c518f8d8ae822157c1e4931708959a
Now that jobs_in_folder isn't reused in all other get_(all_)jobs tests
there's no more any reason to keep jobs_in_folder_named_job a separate
test.
Change-Id: Ic51a4b2cac3105cf9406d2a7864943a7df1248be
On our Jenkins instance with almost a hundred folders, JJB update
stalls for quite a while because it calls get_all_jobs. When invoked
locally at the Jenkins master, it's a matter of seconds, on a fast
broadband link and VPN, it's 2 minutes, and on a train it's easily 10
minutes.
But there's trick!
curl \
--show-error --silent --fail \
--user : --negotiate \
--get \
--data-urlencode \
tree=jobs\[url\,name\,jobs\[url\,name\,jobs\[url\,name\,\
jobs\[url\,name\,jobs\[url\,name\,jobs\[url\,name\,\
jobs\[url\,name\,jobs\[url\,name\,jobs\[url\,name\,\
jobs\[url\,name\,jobs\]\]\]\]\]\]\]\]\]\]
https://jenkins.example.com/api/json
This returns almost instantly.
And it gets better: if we fail to correctly guess the nesting level
necessary, Jenkins returns
…, "jobs": [{}, {}, …], …
so we can easily detect that we need to recurse deeper.
Change-Id: I7268259149e4bc8939c512a112c7e6ec1908224f
This abstraction did more harm than good -- pretended to create correct
JSON responses from a simpler structure, but created responses that were
very far from what Jenkins would return:
* "url" fields didn't contain folders, but nobody noticed as these
weren't used anyway
* "jobs" fields contained the string "null" (not JSON null, an actual
JSON string!), whereas real Jenkins returns a list of almost empty
objects (just a "class" field, if Jenkins is new enough, otherwise
nothing)
* "color" field is absent from folders
The usage of deepcopy, insert and append totally obstructed the real
contents of those responses from most readers. Let's just be a bit
verbose here, please.
Change-Id: Ida2cfa3662e491e4178228096dc622cdd859202f
Avoid repeatedly serializing and splitting the root path component of
jobs being added to the list to be processed and returned.
Attempting to split a string path using 'job' introduces a bug if a job
ever happens to also use the name 'job' as part of its name. This could
be fixed by using root.split('/job/') but it still seems hackish.
Maintain the root path to the folder in the hierarchy as a list of path
components, add to it when descending and store the result of joining
it with '/job/' as a separate variable to avoid needing to re-parse.
Change-Id: I074ad74ad935c50716141a79822ca84999734c3f
This would've caught that the info parameter is ignored in get_info and
I'm going to refactor/improve get_all_jobs so I need stricter tests
anyway.
Also, this makes test_unsafe_chars useful. Before it was a totally
meaningless test that didn't test anything at all. :-(
(Actually the get_info problem was caught by this test, but I'm
committing the fix first to not break git bisect.)
Change-Id: Ifd06bbbd9969a2739322e36ae83f521490a6eaa0
In some network setups Jenkins may be hidden behind complex reverse
proxy setups that require additional custom headers to be set on
each request in order to pass them trough
Allow providing such headers using JENKINS_API_EXTRA_HEADERS environment
variable
Change-Id: If071c5c707f916ba5f4f2c371ec600b7476bf723
HTTP specification states clearly that HEAD requests
should have no body, so we should not fail on these.
Change-Id: I9d2418f26c26b2a40f6bafaf86ed6640fbf83b0c
This, I think, would've caused get_all_jobs to loop indefinitely if the
Jenkins instance has folders. Am I really the first to have caught this?
Change-Id: I4158b0d068135de08a3337486d8a4b41d8b7cda6
Detects if API url is redirected and corrects it in order
to avoid doubling number of requests and even failing
POST ones because of having them silently converted by
requests from POST to GET.
Displays a warning to the user when redirection occurs
because almost always this means that they are using an
old endpoint, like a non secured one.
Change-Id: I7387bf150dad307342f9a6a91afbae32859bc82e
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
Existing code assumes the script sent by the user is terminated with a newline.
Appending magic string without '\n' before print() command results in a syntactically
incorrect Groovy code.
This patch ensures that '\n' is added between user's provided script and appended
magic string.
Change-Id: I39021f1058e7434d487efb4bc7aca18416b2c08e
If the keep_alive is not available because of using reverse
proxy, the header 'Content-Lenght' may not be available,
causing the exception:
Error communicating with server[...]: empty response
However, if 'Location' header is present, the response is valid.
Add unit tests:
- build_job must pass even if no 'content-lenght'
in response header
- build_job must fail if no 'location' in response header
Change-Id: I4da6dd19f9d8302a76652a3686a9377f9a2503a6
Closes-Bug:#1775047