Code Monkey home page Code Monkey logo

riffraff's Introduction

The riffraff logo

Travis (.org) Codecov branch GoDoc Go Report Card

usage

A commandline interface for Jenkins.

Features

  • Queries the current status of jobs in parallel.
  • Can trigger Jenkins builds from the commandline.
  • Visualizes the status of jobs and nodes.
  • Can diff the output two runs.
riffraff is a commandline interface for Jenkins

Usage:
  riffraff [command]

Available Commands:
  build       Trigger build for all matching jobs
  diff        Print a diff between two builds of a job
  help        Help about any command
  log         Show the logs of a job
  nodes       Show the status of all Jenkins nodes
  open        Open a job in the browser
  queue       Show the queue of all matching jobs
  status      Show the status of all matching jobs

Flags:
  -h, --help      help for riffraff
      --salt      Show failed salt states
  -v, --verbose   Verbose mode. Print full job output

Use "riffraff [command] --help" for more information about a command.

Installation

go get github.com/mre/riffraff

...or download a static binary from the releases page.

Getting started

You need to set the following environment variables:

export JENKINS_URL="http://example.com/"
export JENKINS_USER="username"
export JENKINS_PW="password"

You might want to put those into your ~/.bashrc, ~/.zshrc or equivalent.

Usage

riffraff status jenkins-job-name

This will print the current status of all Jenkins jobs matching the given pattern (jenkins-job-name in this case). You can use any regular expression for that, e.g.:

riffraff status "^application-.*-unittests$"

You can get the full output of each last job matching the pattern with

riffraff status -v "^application-.*-unittests$"

Development

  • Install golang version 1.11 or later for go modules support
  • Clone this repository to a directory in your $GOPATH/src tree (recommended) or usego get -u github.com/mre/riffraff.git (uses https not SSH)
  • In the source folder run go run main.go to install modules and run riffraff
  • If you don't have a Jenkins server you can run it by using its .war file (recommended) or installing its .deb file

OBTW

The tool is named after the butler from the Rocky Horror Picture Show, and not the rapper with the same name ;-).

Credits

Logo design: Franziska Böhm noxmoon.de (CC-BY-SA)

riffraff's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar dnivra26 avatar faabiosr avatar finfinack avatar jmartin84 avatar mre avatar nox-moon avatar ptisserand avatar rking788 avatar steakunderscore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

riffraff's Issues

Add status icons for Jenkins nodes

When running riffraff status <my_job_name>, we get a list of all jobs and an icon for their status:

? job1 (https://example.com/job/job1/)
✓ job2 (https://example.com/job/job2/)
✗ job3 (https://example.com/job/job3/)

The same out put would be nice for riffraff nodes, but so far the icon is missing:

jenkins1: Online
jenkins2: Online
jenkins3: Offline
jenkins4: Online

but the output should be

✓ jenkins1: Online
✓ jenkins2: Online
✗ jenkins3: Offline
✓ jenkins4: Online

The easiest way to do it is to just copy and paste the code from the status command to the nodes command.
A slightly cleaner way would be to have a printStatus command, which encapsulates the printing of the text and the icons.
Maybe even better would be to define a custom log formatter, e.g. by using logrus. See example here.

Would be nice if anyone wants to tackle that.

Create a project logo!

This one goes out to all the creative types: We need a project logo!

I was thinking of a vector graphic of Riffraff, the butler from the Rocky Horror Picture Show.
Would be amazing if somebody took Riffraff and vectorized it in the style of the original Jenkins logo:

jenkins-logo

If anyone wants to tackle this, feel free to add a comment here or send a pull request. 🎨

Add tests

Right now, this library has zero tests.
That's bad when trying to refactor the codebase in the future.

We should at least add some basic unit tests for the functionality we provide. I'm thinking about adding some tests for each command and for finding jobs.
Would be nice if someone likes to tackle that. Mentorship can be provided.

Add `history` command

riffraff history <jobname> should show a list of the last 10 builds by default.
The number of builds to show should be configurable with a flag.

Move to Github Actions

I would like to remove Travis support in favor of Github Actions as I made some great experiences with this new service. Help welcome!

Make riffraff work with multibranch pipelines

Jenkins has support for so called multibranch pipelines. go-jenkins also supports this feature. Unfortunately I didn't get around to add that functionality to riffraff. As a result, multibranch pipelines show up with a yellow question mark when running "status", a build can't be triggered, and the logs cannot be printed.

As I use multibranch pipelines a lot at work, that would be a great feature to have.

What we need to do is use the go-jenkins features for multibranch pipelines and test it against a multibranch pipeline. I could do the testing on my side or we use any other Jenkins for it. Of course, tests are also an option.

If somebody wants to tackle this, that would be awesome. 😊

Move to Go modules

Golang introduced modules in 1.11.
It's a nice way to build go packages outside of the GOPATH and with proper version management.
Trying Go modules in other projects, I'm very happy with that change and I would also like to adopt Go modules for this project.

Maybe somebody wants to tackle that.
Here is what you need to do.

Add continuous integration

Would be nice to run the tests on every change. We should add Travis CI or Drone.io support.
PRs welcome!

nil pointer dereference for open command

Calling riffraff open fails with SIGSEGV

./riffraff open     
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x6ba520]

goroutine 1 [running]:
github.com/mre/riffraff/vendor/github.com/bndr/gojenkins.(*Jenkins).GetAllJobNames(0x0, 0x0, 0xc000146540, 0x1, 0x0, 0x1)
	/home/henry/go/src/github.com/mre/riffraff/vendor/github.com/bndr/gojenkins/jenkins.go:368 +0x40
github.com/mre/riffraff/job.FindMatchingJobs(0x0, 0x0, 0x0, 0x9, 0x0, 0xc000048180, 0x0, 0xc000178120)
	/home/henry/go/src/github.com/mre/riffraff/job/find.go:11 +0x40
github.com/mre/riffraff/commands.Open.Exec(0x0, 0x0, 0x0, 0x4, 0x0)
	/home/henry/go/src/github.com/mre/riffraff/commands/open.go:22 +0x5a
main.main()
	/home/henry/go/src/github.com/mre/riffraff/main.go:80 +0x37b

Add goreleaser to Travis CI

Goreleaser is a tool for automatically building and deploying Go binaries for different architectures. It's very handy as it avoids doing manual work when releasing new versions.

Would be nice to run goreleaser automatically on every tag.
Here is an example that we can integrate into our Travis CI:
https://goreleaser.com/ci/

Not sure if we need any additional project permissions for pushing the release to Github,
but I'm sure we can find out.

Help appreciated. Accepting PRs here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.