this is not a beauty contest

This commit is contained in:
Telesphoreo 2022-06-19 15:44:07 -05:00
parent 0cf8876e7d
commit 1db34af14e

View File

@ -8,7 +8,7 @@ export type Job = {
url: string url: string
} }
export type Build = { export type Build = {
number: number, number: number,
url: string, url: string,
changes?: BuildChange[], changes?: BuildChange[],
@ -22,7 +22,7 @@ export type BuildChange = {
} }
export function getJobs(): Promise<Job[]> { export function getJobs(): Promise<Job[]> {
let jobs: Job[] = [] let jobs: Job[] = []
let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/api/json?pretty=true`) let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/api/json`)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request.then(value => { request.then(value => {
@ -34,14 +34,14 @@ export function getJobs(): Promise<Job[]> {
export function getBuilds(version: string): Promise<Build[]> { export function getBuilds(version: string): Promise<Build[]> {
let builds: Build[] = [] let builds: Build[] = []
let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/api/json?pretty=true`) let request = axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/api/json`)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
request.then(value => { request.then(value => {
builds = value.data.builds as Build[] builds = value.data.builds as Build[]
let count = 0; let count = 0;
for (let build of builds) { for (let build of builds) {
axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/${build.number}/api/json?pretty=true`).then(value1 => { axios.get(`${JENKINS_URL}/${ARTIFACT_NAME}/job/${version}/${build.number}/api/json`).then(value1 => {
build.timestamp = value1.data.timestamp build.timestamp = value1.data.timestamp
let changeSet: any[] = value1.data.changeSets let changeSet: any[] = value1.data.changeSets
if (changeSet.length > 0) { if (changeSet.length > 0) {