0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[jenkins-cli] Jenkins の実行済みジョブの全ジョブ番号を得る

Last updated at Posted at 2021-09-13

概要

滅多に無いとは思うが、どうしても実行済みの全ジョブ番号を取り出す必要があった.1

このとき、job/ジョブ名/api/json だと直近 100件ほどの情報しか取得できていなかった.

job/ジョブ名/api/json?tree=allBuilds[number]&depth=1 で全件取り出せた.

$ curl -X GET --user '<ユーザ名>:<APIキー>' \
   "http://<IP>:<PORT>/job/ジョブ名/api/json?tree=allBuilds[number]&depth=1" | \
  jq -r '.allBuilds[].number'

参考にした情報

https://stackoverflow.com/questions/48921231/how-to-retrieve-all-previous-builds-for-a-jenkins-job-through-the-api

  1. このとき、「最終ジョブ番号」を求めてから 1〜「最終ジョブ番号」とする方法では都合が悪かった

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?