We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use the @jenkins-cd/blueocean-core-js.Utils.cleanSlashes function in @jenkins-cd/blueocean-core-js

To help you get started, we’ve selected a few @jenkins-cd/blueocean-core-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / credentials / git / GitPWCredentialsApi.ts View on Github external
createCredential(repositoryUrl, userName, password, branchName, requirePush) {
        const path = UrlConfig.getJenkinsRootURL();
        const validateCredUrl = Utils.cleanSlashes(`${path}/blue/rest/organizations/${this.organization}/scm/git/validate`);

        const requestBody: any = {
            userName,
            password,
            repositoryUrl,
        };

        if (branchName) {
            requestBody.branch = branchName;
        }

        if (requirePush) {
            requestBody.repositoryUrl = true; // Only set if true!
        }

        const fetchOptions = {
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / credentials / git / GitPWCredentialsApi.ts View on Github external
findExistingCredential(repositoryUrl) {
        const root = UrlConfig.getJenkinsRootURL();
        const credUrl = Utils.cleanSlashes(`${root}/blue/rest/organizations/${this.organization}/scm/git/?repositoryUrl=${repositoryUrl}`);

        // Create error in sync code for better stack trace
        const possibleError = new TypedError();

        return this._fetch(credUrl).then(
            result => this._findExistingCredentialSuccess(result),
            error => {
                const { responseBody } = error;

                if (responseBody.message.indexOf('Existing credential failed') >= 0) {
                    throw possibleError.populate(LoadError.TOKEN_REVOKED, responseBody);
                }

                throw possibleError.populate(LoadError.TOKEN_INVALID, responseBody);
            }
        );
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / credentials / CredentialsApi.js View on Github external
function getCredentialsUrl(organization) {
    const path = UrlConfig.getRestBaseURL();
    return Utils.cleanSlashes(`${path}/organizations/${organization}/credentials/user/`);
}
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / bitbucket / api / BbCreationApi.js View on Github external
findBranches(pipelineName) {
        const path = UrlConfig.getJenkinsRootURL();
        const pipelineUrl = Utils.cleanSlashes(`${path}/blue/rest/organizations/${this.organization}/pipelines/${pipelineName}/`);
        return this._fetch(pipelineUrl)
            .then(response => capabilityAugmenter.augmentCapabilities(response))
            .then(pipeline => this._findBranchesSuccess(pipeline), error => this._findBranchesFailure(error));
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / credentials / CredentialsApi.js View on Github external
listAllCredentials() {
        const path = UrlConfig.getRestBaseURL();
        const searchUrl = Utils.cleanSlashes(`${path}/search?q=type:credential;organization:${this.organization}`, false);

        return this._fetch(searchUrl)
            .then(data => capabilityAugmenter.augmentCapabilities(data))
            .then(creds => this._listAllCredentialsSuccess(creds), error => this._listAllCredentialsFailure(error));
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / bitbucket / server / api / BbServerApi.js View on Github external
validateVersion(id) {
        const path = UrlConfig.getJenkinsRootURL();
        const serverUrl = Utils.cleanSlashes(`${path}/blue/rest/organizations/${this.organization}/scm/${this.scmId}/servers/${id}/validate`);
        return this._fetch(serverUrl);
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / credentials / github / GithubCredentialsApi.js View on Github external
createAccessToken(accessToken, apiUrl) {
        const path = UrlConfig.getJenkinsRootURL();
        let tokenUrl = Utils.cleanSlashes(`${path}/blue/rest/organizations/${this.organization}/scm/${this.scmId}/validate`);
        tokenUrl = GithubApiUtils.appendApiUrlParam(tokenUrl, apiUrl);

        const requestBody = {
            accessToken,
        };

        const fetchOptions = {
            method: 'PUT',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify(requestBody),
        };

        return this._fetch(tokenUrl, { fetchOptions }).catch(error => this._createAccessTokenFailure(error));
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / bitbucket / server / api / BbServerApi.js View on Github external
createServer(serverName, serverUrl) {
        const path = UrlConfig.getJenkinsRootURL();
        const createUrl = Utils.cleanSlashes(`${path}/blue/rest/organizations/${this.organization}/scm/${this.scmId}/servers`);

        const requestBody = {
            name: serverName,
            apiUrl: serverUrl,
        };

        const fetchOptions = {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify(requestBody),
        };

        return this._fetch(createUrl, { fetchOptions });
    }
github jenkinsci / blueocean-plugin / blueocean-dashboard / src / main / js / creation / git / GitCreationApi.js View on Github external
createPipeline(repositoryUrl, credentialId, name) {
        const path = UrlConfig.getRestBaseURL();
        const createUrl = Utils.cleanSlashes(`${path}/organizations/${this.organization}/pipelines`);

        const requestBody = {
            name,
            $class: 'io.jenkins.blueocean.blueocean_git_pipeline.GitPipelineCreateRequest',
            scmConfig: {
                uri: repositoryUrl,
                credentialId,
            },
        };

        const fetchOptions = {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify(requestBody),