Jenkins - Redirect Native UI to Blue Ocean

Redirect the native Jenkins UI to Blue Ocean

目前为 2024-10-29 提交的版本。查看 最新版本

// ==UserScript==
// @name         Jenkins - Redirect Native UI to Blue Ocean
// @namespace    http://hear.com
// @version      2024-07-11
// @description  Redirect the native Jenkins UI to Blue Ocean
// @author       [email protected]
// @match        https://jenkins.audibene.net/job/Audibene-GMBH/job/*/job/*/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=audibene.net
// @tag          productivity
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const url = window.location.href
    const parameterizedUrl = "https://jenkins.audibene.net/blue/organizations/jenkins/:organizationId%2F:repo/detail/:pr/:run/pipeline/";

    const regex = /https:\/\/jenkins\.audibene\.net\/job\/(?<organizationId>[^\/]+)\/job\/(?<repo>[^\/]+)\/job\/(?<pr>[^\/]+)\/(?<run>[^\/]+)\/pipeline-graph\//;

    const match = url.match(regex);

    if (match) {
        const { organizationId, repo, pr, run } = match.groups;

        const hydratedUrl = parameterizedUrl
        .replace(':organizationId', organizationId)
        .replace(':repo', repo)
        .replace(':pr', pr)
        .replace(':run', run);

        console.log(`Hydrated URL: ${hydratedUrl}`);

        if (confirm('Redirect to Blue Ocean?')) {
            window.location.href = hydratedUrl;
        }
    } else {
        console.log("No match found");
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址