4 releases (breaking)

0.4.0 Dec 22, 2023
0.3.0 Jul 7, 2023
0.2.0 Jun 30, 2023
0.1.0 Jun 15, 2023

#286 in HTTP server

Download history 155/week @ 2024-06-24 165/week @ 2024-07-01 150/week @ 2024-07-08 151/week @ 2024-07-15 149/week @ 2024-07-22 157/week @ 2024-07-29 155/week @ 2024-08-05 152/week @ 2024-08-12 152/week @ 2024-08-19 133/week @ 2024-08-26 136/week @ 2024-09-02 145/week @ 2024-09-09 8/week @ 2024-09-16 245/week @ 2024-09-23 6/week @ 2024-09-30

282 downloads per month

GPL-2.0-or-later

43KB
1K SLoC

jenkinsctl

Jenkins manager

The project aims to wrap Jenkins json api and some post requests which can be performed on Jenkins parts (such as 'delete node').

It is a very early stage of development (it'd be better to say hobby project to learn Rust). Current functionality includes:

  • shutdown Set 'prepare to shutdown' bunner with optional reason
    • on Set shutdown banner
    • off Cancel shutdown
  • restart Restart Jenkins instance (soft/hard)
  • copy Copy job from the existing one
    • job Copy job
    • view Copy view
  • node Node actions
    • show Show node information
    • list List all (with optional status information)
  • job
    • list Recursively list all the jobs in an instance
    • build Build a job (use '-' as param list to build with defaults)
    • remove Remove a job (use with caution, the action is permanent)

Build a job

There are two types of the jobs in Jenkins: parameterized and un-parameterized.

To build a job without parameters use the following command:

jenkinsctl job build <JOB>

To build a job with parameters use:

jenkinsctl job build <JOB> [PARAMS]

jenkinsctl accepts parameters in the following format: param=value,...,param=value

You can also perform a parameterized build using defaults:

jenkinsctl job build <JOB> -

To stream a job's execution process to stdout, add the -f switch:

jenkinsctl job build <JOB> [PARAMS] -f

Abort a job

Jenkins rest api provides three levels of interruption:

  • stop aborts a pipeline;
  • term forcibly terminates a build;
  • kill hard kill a pipeline (the most destructive way to stop a pipeline);

jenkinsctl wraps it with the *nix signals equivalent:

jenkinsctl job kill -s <HUP|TERM|KILL|1|15|9> <JOB> <BUILD>

Rebuild a job

It is possible to rebuild particular job in a Jenkins web ui, however there is no rest api endpoint for the rebuild operation.

Therefore the rebuild option starts new build with the same parameters as in a build specified by the arg.

Technically there is no differences, you can only notice that a job is not being rebuilt but started with the same parameters in a console log output.

jenkinsctl job rebuild <JOB> <BUILD>

Dependencies

~10–23MB
~325K SLoC