Skip to content

Commit

Permalink
fix(Jenkins): Bugfix to allow multibyte Jenkins job name
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesin11 committed Nov 17, 2020
1 parent 21dee8f commit f6b09e9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/client/jenkins_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ export class JenkinsClient {
}

async fetchJobRuns(jobName: string, lastRunId?: number) {
const res = await this.axios.get(`job/${jobName}/wfapi/runs`, {
const url = encodeURI(`job/${jobName}/wfapi/runs`)
const res = await this.axios.get(url, {
params: {
fullStages: "true"
}
Expand All @@ -220,29 +221,30 @@ export class JenkinsClient {
}

async fetchJobRun(jobName: string, runId: number) {
const res = await this.axios.get(`job/${jobName}/${runId}/wfapi/describe`)
const url = encodeURI(`job/${jobName}/${runId}/wfapi/describe`)
const res = await this.axios.get(url)

return res.data as WfapiRunResponse
}

async fetchBuild(jobName: string, runId: number) {
const res = await this.axios.get(`job/${jobName}/${runId}/api/json`)
const url = encodeURI(`job/${jobName}/${runId}/api/json`)
const res = await this.axios.get(url)

return res.data as BuildResponse
}

async fetchLastBuild(jobName: string) {
const res = await this.axios.get(`/job/${jobName}/lastBuild/api/json`)
const url = encodeURI(`/job/${jobName}/lastBuild/api/json`)
const res = await this.axios.get(url)

return res.data as BuildResponse
}

async fetchArtifacts(jobName: string, runId: number, paths: string[]): Promise<Artifact[]> {
const pathResponses = paths.map((path) => {
const response = this.axios.get(
`job/${jobName}/${runId}/artifact/${path}`,
{ responseType: 'arraybuffer'}
)
const url = encodeURI(`job/${jobName}/${runId}/artifact/${path}`)
const response = this.axios.get(url, { responseType: 'arraybuffer'})
return { path, response }
})

Expand Down

0 comments on commit f6b09e9

Please sign in to comment.