Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fetchExecutorInfo() {
Fetch.fetchJSON(`${UrlConfig.getRestBaseURL()}/organizations/${AppConfig.getOrganizationName()}/computers/`)
.then(response => {
this.setComputers(response.computers);
});
}
}
checkPipelineNameAvailable(name) {
const path = UrlConfig.getRestBaseURL();
const checkUrl = Utils.cleanSlashes(`${path}/organizations/${this.organization}/pipelines/${name}`);
const fetchOptions = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
};
return this._fetch(checkUrl, { fetchOptions }).then(() => false, () => true);
}
function getCredentialsUrl(organization) {
const path = UrlConfig.getRestBaseURL();
return Utils.cleanSlashes(`${path}/organizations/${organization}/credentials/user/`);
}
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));
}
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',
},
checkPipelineNameAvailable(name) {
const path = UrlConfig.getRestBaseURL();
const checkUrl = Utils.cleanSlashes(`${path}/organizations/${this.organization}/pipelines/${name}`);
const fetchOptions = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
};
return this._fetch(checkUrl, { fetchOptions }).then(() => false, () => true);
}
}