Jenkins Parameterized Job 실행 시 Response 예제
목차
사용 목적
Parameterized Job Build 실행 시 어떤 명령어를 작성해야 하는지, 어떤 결과를 확인할 수 있는지 알아보려 한다.
사용 방법
- 파라미터가 1개일 때
curl -X POST http://[JENKINS_URL]/job/[JOB_NAME]/buildWithParameters --data [PARAM1]=[VALUE1] --user [USER_NAME]:[API_TOKEN] -v - 파라미터가 2개일 때
curl -X POST http://[JENKINS_URL]/job/[JOB_NAME]/buildWithParameters --data [PARAM1]=[VALUE1] --data [PARAM2]=[VALUE2] --user [USER_NAME]:[API_TOKEN] -vJENKINS_URL: Jenkins URL 주소 JOB_NAME: Build 실행할 Job 이름 PARAM1, PARAM2: 파라미터 이름 VALUE1, VALUE2: 파라미터의 결과값 USER_NAME: 관리자 계정 ID API_TOKEN: Jenkins API Token
결과
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying [JENKINS_URL]...
* Connected to [JENKINS_URL] ([JENKINS_URL]) port [JENKINS_URL_PORT] (#0)
* Server auth using Basic with user '[USER_ID]'
> POST /job/[JOB_NAME]/buildWithParameters HTTP/1.1
> Host: [JENKINS_URL]
> Authorization: Basic [ ]
> User-Agent: curl/7.81.0
> Accept: */*
> Content-Length: 9
> Content-Type: application/x-www-form-urlencoded
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 201 Created
< Date: [ ]
< X-Content-Type-Options: nosniff
< Location: http://[JENKINS_URL]/queue/item/12/
< Content-Length: 0
< Server: Jetty(10.0.11)
<
* Connection #0 to host [JENKINS_URL] left intact