Created
March 28, 2024 15:48
-
-
Save bhubr/e3d451441607df823fd1e63176cef8cc to your computer and use it in GitHub Desktop.
Extract a pipeline's jobs durations in GitLab CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// paste & run in browser console, at: | |
// https://gitlab.com/<login>/<repo>/-/pipelines/<pipeline id>/builds | |
(() => { | |
const jobsTable = document.querySelector("[data-testid=jobs-tab-table]"); | |
const rows = jobsTable.querySelectorAll("tbody tr"); | |
const jobs = Array.from(rows) | |
.reverse() | |
.map((row) => { | |
const duration = row | |
.querySelector("[data-testid=job-duration]") | |
.textContent.trim(); | |
const stage = row | |
.querySelector("[data-testid=job-stage-name]") | |
.textContent.trim(); | |
return { stage, duration }; | |
}); | |
console.log(JSON.stringify(jobs, null, 2)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment