Crates.io | jenq |
lib.rs | jenq |
version | 0.1.2 |
source | src |
created_at | 2018-11-29 12:52:37.022778 |
updated_at | 2018-11-30 01:43:05.733957 |
description | Query jenkins for jobs matching filters |
homepage | https://github.com/clux/jenq |
repository | |
max_upload_size | |
id | 99206 |
size | 31,995 |
Query for jenkins history for parametrised jobs.
Set evars to authenticate with jenkins:
export JENKINS_URL=https://jenkins.domain.invalid
export JENKINS_API_TOKEN=API_TOKEN_FROM_USER_PAGE
export JENKINS_API_USER=user.name
The user only requires read access to the jobs you want to query.
Ask jenq
for history
, latest
, or console
for a named job, optionally specifying filters:
jenq history myjobname -f APP:myapp -f VERSION=0.1.2
jenq console myjobname -f APP:myapp
jenq latest myjobname
Filters can work in all subcommands, and match jenkins StringParameters. Here myjobname
is assumed to have two string parameters: APP
, and VERSION
.
The history
example above gets history where both values of the parameters match.
The console
example above gets the latest console output where the APP
parameter matches.
The latest
example above gets the latest job number from jenkins without matching anything.
Creates a table of last matching jobs (gaps in numbers caused by filters):
BUILD UPDATED RESULT
189 2018-11-27 20:09:44 Some(Success)
182 2018-11-26 17:22:24 Some(Success)
160 2018-11-23 15:33:33 Some(Success)
130 2018-11-22 12:08:15 Some(Success)
Note: the build numbers are underlined, clickable links in your terminal if your terminal emulator supports it.
Produces a link and information about last build matching your parameters:
myjobnames#189 (478354) at 2018-11-27 20:09:44 UTC on https://jenkins.domain.invalid/job/myjobname/189/
Get the raw console output of the latest matching job, or numbered job:
jenq console myjobname
jenq console myjobname 32
Produces the raw console output, along with the expected jenkins gunk (here truncated):
Started by upstream project "myjobname" build number 32
originally caused by:
Started by remote host 1.1.1.1
[EnvInject] - Loading node environment variables.
....🐘.....
shipcat::kube: Waiting 65s for deployment webapp to rollout (not ready yet)
shipcat::helm::direct: successfully rolled out webapp
Finished: SUCCESS
Latest stable with rust installed:
cargo install jenq # latest stable
Latest stable without rust installed (linux only):
JENQ_VERSION=0.1.1
curl -sSL https://github.com/clux/jenq/releases/download/${JENQ_VERSION}/jenq.x86_64-unknown-linux-musl.tar.gz | tar xz -C /usr/local
Substitute JENQ_VERSION
variable for the version you want.
Add this to your ~/.bash_completion
file:
if hash jenq 2> /dev/null; then
source <(jenq completions bash)
fi
Clone and build:
git clone git@github.com:clux/jenq.git && cd jenq
cargo build
ln -sf $PWD/target/debug/jenq /usr/local/bin/jenq
Apache 2.0 licensed. See LICENSE for details.
Derivative work from shipcat 0.74.0 licensed under Apache 2.0