인스턴스 수준 CI/CD 변수 API
Tier: Free, Premium, Ultimate
Offering: Self-managed, GitLab Dedicated
모든 인스턴스 변수 나열
description매개변수는 GitLab 16.8에서 도입되었습니다.
모든 인스턴스 수준 변수의 디렉터리을 가져옵니다.
GET /admin/ci/variables
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/admin/ci/variables"
[
    {
        "key": "TEST_VARIABLE_1",
        "description": null,
        "variable_type": "env_var",
        "value": "TEST_1",
        "protected": false,
        "masked": false,
        "raw": false
    },
    {
        "key": "TEST_VARIABLE_2",
        "description": null,
        "variable_type": "env_var",
        "value": "TEST_2",
        "protected": false,
        "masked": false,
        "raw": false
    }
]
인스턴스 변수 세부 정보 표시
description매개변수는 GitLab 16.8에서 도입되었습니다.
특정 인스턴스 수준 변수의 세부 정보를 가져옵니다.
GET /admin/ci/variables/:key
| 속성 | 타입 | 필수여부 | 설명 | 
|---|---|---|---|
key
 | string | Yes | 변수의 key 값
 | 
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/admin/ci/variables/TEST_VARIABLE_1"
{
    "key": "TEST_VARIABLE_1",
    "description": null,
    "variable_type": "env_var",
    "value": "TEST_1",
    "protected": false,
    "masked": false,
    "raw": false
}
인스턴스 변수 생성
description매개변수는 GitLab 16.8에서 도입되었습니다.
새로운 인스턴스 수준 변수를 생성합니다.
인스턴스 수준 변수의 최대 개수는 변경할 수 있습니다.
POST /admin/ci/variables
| 속성 | 타입 | 필수여부 | 설명 | 
|---|---|---|---|
key
 | string | Yes | 변수의 key 값. 최대 255자, A-Z, a-z, 0-9, _ 만 허용됩니다.
 | 
value
 | string | Yes | 변수의 value 값. 최대 10,000자까지 가능합니다.
 | 
description
 | string | No | 변수의 설명. 최대 255자까지 가능합니다. | 
masked
 | boolean | No | 변수가 마스킹되었는지 여부. | 
protected
 | boolean | No | 변수가 보호되는지 여부. | 
raw
 | boolean | No | 변수가 확장 가능한지 여부. | 
variable_type
 | string | No | 변수의 유형. 사용 가능한 유형은 env_var (기본값)과 file입니다.
 | 
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/admin/ci/variables" --form "key=NEW_VARIABLE" --form "value=new value"
{
    "key": "NEW_VARIABLE",
    "description": null,
    "value": "new value",
    "variable_type": "env_var",
    "protected": false,
    "masked": false,
    "raw": false
}
인스턴스 변수 업데이트
description매개변수는 GitLab 16.8에서 도입되었습니다.
인스턴스 수준 변수를 업데이트합니다.
PUT /admin/ci/variables/:key
| 속성 | 타입 | 필수여부 | 설명 | 
|---|---|---|---|
description
 | string | No | 변수의 설명. 최대 255자까지 가능합니다. | 
key
 | string | Yes | 변수의 key 값. 최대 255자, A-Z, a-z, 0-9, _ 만 허용됩니다.
 | 
masked
 | boolean | No | 변수가 마스킹되었는지 여부. | 
protected
 | boolean | No | 변수가 보호되는지 여부. | 
raw
 | boolean | No | 변수가 확장 가능한지 여부. | 
value
 | string | Yes | 변수의 value 값. 최대 10,000자까지 가능합니다.
 | 
variable_type
 | string | No | 변수의 유형. 사용 가능한 유형은 env_var (기본값)과 file입니다.
 | 
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/admin/ci/variables/NEW_VARIABLE" --form "value=updated value"
{
    "key": "NEW_VARIABLE",
    "description": null,
    "value": "updated value",
    "variable_type": "env_var",
    "protected": true,
    "masked": true,
    "raw": true
}
인스턴스 변수 제거
인스턴스 수준 변수를 제거합니다.
DELETE /admin/ci/variables/:key
| 속성 | 타입 | 필수여부 | 설명 | 
|---|---|---|---|
key
 | string | Yes | 변수의 key 값
 | 
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/admin/ci/variables/VARIABLE_1"
도움말