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

Tier: Free, Premium, Ultimate Offering: 자체 관리, GitLab Dedicated

모든 인스턴스 변수 나열

History
  • description parameter introduced in 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
    }
]

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

History
  • description parameter introduced in GitLab 16.8.

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

GET /admin/ci/variables/:key
속성 유형 필수 설명
key string 변수의 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
}

인스턴스 변수 생성

History
  • description parameter introduced in GitLab 16.8.

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

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

POST /admin/ci/variables
속성 유형 필수 설명
key string 변수의 key. 최대 255자까지, A-Z, a-z, 0-9, _만 사용 가능합니다.
value string 변수의 value. 최대 10,000자까지 가능합니다.
description string 아니요 변수의 설명. 최대 255자까지 가능합니다.
masked boolean 아니요 변수가 마스킹된지 여부입니다.
protected boolean 아니요 변수가 보호되는지 여부입니다.
raw boolean 아니요 변수가 확장 가능한지 여부입니다.
variable_type string 아니요 변수의 유형. 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
}

인스턴스 변수 수정

History
  • description parameter introduced in GitLab 16.8.

인스턴스 수준 변수를 수정합니다.

PUT /admin/ci/variables/:key
속성 유형 필수 설명
description string 아니요 변수의 설명. 최대 255자까지 가능합니다.
key string 변수의 key. 최대 255자까지, A-Z, a-z, 0-9, _만 사용 가능합니다.
masked boolean 아니요 변수가 마스킹된지 여부입니다.
protected boolean 아니요 변수가 보호되는지 여부입니다.
raw boolean 아니요 변수가 확장 가능한지 여부입니다.
value string 변수의 value. 최대 10,000자까지 가능합니다.
variable_type string 아니요 변수의 유형. 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"