Skip to content

Instantly share code, notes, and snippets.

@bhubr
Created March 28, 2024 15:48
Show Gist options
  • Save bhubr/e3d451441607df823fd1e63176cef8cc to your computer and use it in GitHub Desktop.
Save bhubr/e3d451441607df823fd1e63176cef8cc to your computer and use it in GitHub Desktop.
Extract a pipeline's jobs durations in GitLab CI
// 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