Version 1.0.4 - Remove pipelines
All checks were successful
Deployment Pipeline / deploy (push) Successful in 26s
All checks were successful
Deployment Pipeline / deploy (push) Successful in 26s
This commit is contained in:
parent
46224bdf6d
commit
025435b48e
@ -37,12 +37,11 @@ module.exports.updateFile = function (file) {
|
|||||||
|
|
||||||
module.exports.getSettings = function () {
|
module.exports.getSettings = function () {
|
||||||
const file = this.getFile()
|
const file = this.getFile()
|
||||||
return {"jenkins_token": file.JENKINS_TOKEN, "omega_token": file.OMEGA_KEY}
|
return {"omega_token": file.OMEGA_KEY}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.saveSettings = function (settings) {
|
module.exports.saveSettings = function (settings) {
|
||||||
const file = this.getFile()
|
const file = this.getFile()
|
||||||
file.JENKINS_TOKEN = settings.jenkins_token
|
|
||||||
file.OMEGA_KEY = settings.omega_token
|
file.OMEGA_KEY = settings.omega_token
|
||||||
this.updateFile(file)
|
this.updateFile(file)
|
||||||
}
|
}
|
||||||
|
138
bin/pipelines.js
138
bin/pipelines.js
@ -1,138 +0,0 @@
|
|||||||
const { LogType } = require("loguix")
|
|
||||||
const fs = require("fs")
|
|
||||||
const path = require("path")
|
|
||||||
const { __glob } = require("./global-variables")
|
|
||||||
const clog = new LogType("Pïpeline")
|
|
||||||
const config = require("./config")
|
|
||||||
|
|
||||||
const tokenkey = config.getFile().JENKINS_TOKEN
|
|
||||||
|
|
||||||
module.exports.getAllPipelines = function() {
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
|
|
||||||
|
|
||||||
fetch(`https://jenkins.raphix.fr/api/json`, {
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
"Accept": "application/json",
|
|
||||||
"Authorization": `Basic ${tokenkey}`
|
|
||||||
},
|
|
||||||
credentials: "include"
|
|
||||||
})
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(async list => {
|
|
||||||
|
|
||||||
const pipelinesJobs = new Array()
|
|
||||||
|
|
||||||
for(const job of list.jobs) {
|
|
||||||
await fetch(`${job.url}/api/json`, {
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
"Accept": "application/json",
|
|
||||||
"Authorization": `Basic ${tokenkey}`
|
|
||||||
},
|
|
||||||
credentials: "include"
|
|
||||||
})
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(async res => {
|
|
||||||
|
|
||||||
if(res._class == "org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject") {
|
|
||||||
await getJobMain(res).then(resJ => {
|
|
||||||
res.jobs[0] = resJ
|
|
||||||
pipelinesJobs.push(res)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
pipelinesJobs.push(res)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
list.jobs = pipelinesJobs
|
|
||||||
|
|
||||||
resolve(list)
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
resolve("UNAVAILABLE")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports.startPipeline = function(pipeline) {
|
|
||||||
|
|
||||||
|
|
||||||
// If it's a freestyle job, build with params
|
|
||||||
|
|
||||||
if(pipeline.type == "org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject") {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
fetch(`${pipeline.url}/job/${pipeline.jobname}/build?delay=0sec`, {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Authorization": `Basic ${tokenkey}`
|
|
||||||
},
|
|
||||||
credentials: "include"
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
resolve("OK")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
|
|
||||||
const parameters = pipeline.fields
|
|
||||||
|
|
||||||
const formatedParams = new URLSearchParams()
|
|
||||||
|
|
||||||
for(const param of parameters) {
|
|
||||||
formatedParams.append(param.name, param.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fetch(`${pipeline.url}/buildWithParameters?delay=0sec`, {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Authorization": `Basic ${tokenkey}`,
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded"
|
|
||||||
},
|
|
||||||
credentials: "include",
|
|
||||||
body: formatedParams
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
resolve("OK")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function getJobMain(res) {
|
|
||||||
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
|
|
||||||
await fetch(`${res.jobs[0].url}/api/json`, {
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Authorization': `Basic ${tokenkey}`
|
|
||||||
},
|
|
||||||
credentials: 'include'
|
|
||||||
}).then(res => res.json())
|
|
||||||
.then(res => {
|
|
||||||
resolve(res)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
@ -8,7 +8,6 @@ const files = require("./files.js")
|
|||||||
const config = require("./config.js")
|
const config = require("./config.js")
|
||||||
const links = require("./links.js")
|
const links = require("./links.js")
|
||||||
const service = require("./services.js")
|
const service = require("./services.js")
|
||||||
const pipeline = require("./pipelines.js")
|
|
||||||
const plog = new LogType("Web")
|
const plog = new LogType("Web")
|
||||||
const cook = require("cookie")
|
const cook = require("cookie")
|
||||||
const http = require("http")
|
const http = require("http")
|
||||||
@ -166,16 +165,6 @@ module.exports.serverIO = function(server) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.checkPermission("PIPELINES")) {
|
|
||||||
GetRequest("PL_GET_ALL", async () => {
|
|
||||||
GetAnswer("PL_GET_ALL", await pipeline.getAllPipelines())
|
|
||||||
})
|
|
||||||
|
|
||||||
PostRequest("PL_START", async (settings) => {
|
|
||||||
PostAnswer("PL_START", await pipeline.startPipeline(settings))
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(user.checkPermission("USERS")) {
|
if(user.checkPermission("USERS")) {
|
||||||
GetRequest("US_ALL", async () => {
|
GetRequest("US_ALL", async () => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "neutral",
|
"name": "neutral",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"description": "Panel d'administration de Raphix",
|
"description": "Panel d'administration de Raphix",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -733,10 +733,12 @@ class Service {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
|
/*
|
||||||
|
|
||||||
* Permet de créer un composant de vue de type "Pipeline"
|
* Permet de créer un composant de vue de type "Pipeline"
|
||||||
* @param {object} properties Propriétés du composant de vue
|
* @param {object} properties Propriétés du composant de vue
|
||||||
*/
|
|
||||||
|
|
||||||
class Pipeline {
|
class Pipeline {
|
||||||
name;
|
name;
|
||||||
@ -954,6 +956,8 @@ class Pipeline {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
class User {
|
class User {
|
||||||
constructor(properties) {
|
constructor(properties) {
|
||||||
this.username = properties.username
|
this.username = properties.username
|
||||||
@ -1027,10 +1031,7 @@ class User {
|
|||||||
<input type="checkbox" id="${this.username}_perm_SERVERS">
|
<input type="checkbox" id="${this.username}_perm_SERVERS">
|
||||||
<label for="${this.username}_perm_SERVERS">Serveurs</label>
|
<label for="${this.username}_perm_SERVERS">Serveurs</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<input type="checkbox" id="${this.username}_perm_PIPELINES">
|
|
||||||
<label for="${this.username}_perm_PIPELINES">Pipelines</label>
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="${this.username}_perm_METRICS">
|
<input type="checkbox" id="${this.username}_perm_METRICS">
|
||||||
<label for="${this.username}_perm_METRICS">Metrics</label>
|
<label for="${this.username}_perm_METRICS">Metrics</label>
|
||||||
@ -1090,7 +1091,7 @@ class User {
|
|||||||
editPermissions.push(getID(`${this.username}_perm_SERVICES`))
|
editPermissions.push(getID(`${this.username}_perm_SERVICES`))
|
||||||
editPermissions.push(getID(`${this.username}_perm_LINKS`))
|
editPermissions.push(getID(`${this.username}_perm_LINKS`))
|
||||||
editPermissions.push(getID(`${this.username}_perm_SERVERS`))
|
editPermissions.push(getID(`${this.username}_perm_SERVERS`))
|
||||||
editPermissions.push(getID(`${this.username}_perm_PIPELINES`))
|
|
||||||
editPermissions.push(getID(`${this.username}_perm_METRICS`))
|
editPermissions.push(getID(`${this.username}_perm_METRICS`))
|
||||||
editPermissions.push(getID(`${this.username}_perm_USERS`))
|
editPermissions.push(getID(`${this.username}_perm_USERS`))
|
||||||
editPermissions.push(getID(`${this.username}_perm_SETTINGS`))
|
editPermissions.push(getID(`${this.username}_perm_SETTINGS`))
|
||||||
|
@ -22,11 +22,13 @@ const explorer = new ViewComponent({
|
|||||||
permission: "SERVERS"
|
permission: "SERVERS"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
const pipelines = new ViewComponent({
|
const pipelines = new ViewComponent({
|
||||||
name: "Gestion des pipelines",
|
name: "Gestion des pipelines",
|
||||||
icon: "fa-solid fa-code-merge",
|
icon: "fa-solid fa-code-merge",
|
||||||
permission: "PIPELINES"
|
permission: "PIPELINES"
|
||||||
})
|
})*/
|
||||||
|
|
||||||
const metrics = new ViewComponent({
|
const metrics = new ViewComponent({
|
||||||
name: "Web Metrik",
|
name: "Web Metrik",
|
||||||
|
@ -30,15 +30,6 @@ services.createWindow(async () => {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const jenkinsService = new Service({
|
|
||||||
name: "Jenkins",
|
|
||||||
description: "Gestionnaire de pipeline",
|
|
||||||
icon: "/images/services/jenkins.svg",
|
|
||||||
url: "https://jenkins.raphix.fr" ,
|
|
||||||
canAccess: true,
|
|
||||||
View: View
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
const raphixwebsite = new Service({
|
const raphixwebsite = new Service({
|
||||||
name: "Raphix.fr",
|
name: "Raphix.fr",
|
||||||
@ -71,7 +62,6 @@ services.createWindow(async () => {
|
|||||||
allServices.push(subsonicsService.generateHTML())
|
allServices.push(subsonicsService.generateHTML())
|
||||||
allServices.push(lavalink.generateHTML())
|
allServices.push(lavalink.generateHTML())
|
||||||
allServices.push(giteaService.generateHTML())
|
allServices.push(giteaService.generateHTML())
|
||||||
allServices.push(jenkinsService.generateHTML())
|
|
||||||
allServices.push(raphixwebsite.generateHTML())
|
allServices.push(raphixwebsite.generateHTML())
|
||||||
allServices.push(cvraphix.generateHTML())
|
allServices.push(cvraphix.generateHTML())
|
||||||
|
|
||||||
@ -79,7 +69,6 @@ services.createWindow(async () => {
|
|||||||
|
|
||||||
await subsonicsService.loadScript()
|
await subsonicsService.loadScript()
|
||||||
await giteaService.loadScript()
|
await giteaService.loadScript()
|
||||||
await jenkinsService.loadScript()
|
|
||||||
await raphixwebsite.loadScript()
|
await raphixwebsite.loadScript()
|
||||||
await cvraphix.loadScript()
|
await cvraphix.loadScript()
|
||||||
await lavalink.loadScript()
|
await lavalink.loadScript()
|
||||||
|
@ -19,8 +19,6 @@ settings.createWindow(async () => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="category">
|
<div class="category">
|
||||||
<p>Configuration des Tokens</p>
|
<p>Configuration des Tokens</p>
|
||||||
<p class='user-line-displayname'>Jenkins</p>
|
|
||||||
<input class='field' type="text" id="jenkins_token" placeholder="Token Jenkins">
|
|
||||||
<p class='user-line-displayname'> Omega </p>
|
<p class='user-line-displayname'> Omega </p>
|
||||||
<input class='field' type="text" id="omega_token" placeholder="Token Omega">
|
<input class='field' type="text" id="omega_token" placeholder="Token Omega">
|
||||||
<button id="st-save" class="btn green"><span> Sauvegarder</span></button>
|
<button id="st-save" class="btn green"><span> Sauvegarder</span></button>
|
||||||
@ -93,11 +91,9 @@ settings.createWindow(async () => {
|
|||||||
const restartButton = document.getElementById("st-restart")
|
const restartButton = document.getElementById("st-restart")
|
||||||
const stopButton = document.getElementById("st-stop")
|
const stopButton = document.getElementById("st-stop")
|
||||||
const saveButton = document.getElementById("st-save")
|
const saveButton = document.getElementById("st-save")
|
||||||
const jenkinsToken = document.getElementById("jenkins_token")
|
|
||||||
const omegaToken = document.getElementById("omega_token")
|
const omegaToken = document.getElementById("omega_token")
|
||||||
|
|
||||||
get("SETTINGS_GET").then((settings) => {
|
get("SETTINGS_GET").then((settings) => {
|
||||||
jenkinsToken.value = settings.jenkins_token
|
|
||||||
omegaToken.value = settings.omega_token
|
omegaToken.value = settings.omega_token
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -111,12 +107,11 @@ settings.createWindow(async () => {
|
|||||||
|
|
||||||
saveButton.addEventListener("click", () => {
|
saveButton.addEventListener("click", () => {
|
||||||
post("SETTINGS_SAVE", {
|
post("SETTINGS_SAVE", {
|
||||||
jenkins_token: jenkinsToken.value,
|
|
||||||
omega_token: omegaToken.value
|
omega_token: omegaToken.value
|
||||||
})
|
})
|
||||||
|
|
||||||
get("SETTINGS_GET").then((settings) => {
|
get("SETTINGS_GET").then((settings) => {
|
||||||
jenkinsToken.value = settings.jenkins_token
|
|
||||||
omegaToken.value = settings.omega_token
|
omegaToken.value = settings.omega_token
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -61,10 +61,7 @@ users.createWindow(async () => {
|
|||||||
<input type="checkbox" id="perm_SERVERS">
|
<input type="checkbox" id="perm_SERVERS">
|
||||||
<label for="perm_SERVERS">Serveurs</label>
|
<label for="perm_SERVERS">Serveurs</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<input type="checkbox" id="perm_PIPELINES">
|
|
||||||
<label for="perm_PIPELINES">Pipelines</label>
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="perm_METRICS">
|
<input type="checkbox" id="perm_METRICS">
|
||||||
<label for="perm_METRICS">Metrics</label>
|
<label for="perm_METRICS">Metrics</label>
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
<script src="/javascripts/link.js"></script>
|
<script src="/javascripts/link.js"></script>
|
||||||
<script src="/javascripts/service.js"></script>
|
<script src="/javascripts/service.js"></script>
|
||||||
<script src="/javascripts/server.js"></script>
|
<script src="/javascripts/server.js"></script>
|
||||||
<script src="/javascripts/pipeline.js"></script>
|
|
||||||
<script src="/javascripts/filexplorer.js"></script>
|
<script src="/javascripts/filexplorer.js"></script>
|
||||||
<script src="/javascripts/user.js"></script>
|
<script src="/javascripts/user.js"></script>
|
||||||
<script src="/javascripts/metric.js"></script>
|
<script src="/javascripts/metric.js"></script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user