인스턴스 수준 CI/CD 변수 API

Tier: Free, Premium, Ultimate Offering: Self-Managed, GitLab Dedicated

모든 인스턴스 변수 나열

모든 인스턴스 수준 변수의 디렉터리을 가져옵니다.

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
    }
]

인스턴스 변수 세부 정보 표시

특정 인스턴스 수준 변수의 세부 정보를 가져옵니다.

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
}

인스턴스 변수 생성

새로운 인스턴스 수준 변수를 생성합니다.

인스턴스 수준 변수의 최대 수는 변경할 수 있습니다.

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
}

인스턴스 변수 업데이트

인스턴스 수준 변수를 업데이트합니다.

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"