그룹 수준 변수 API
그룹 변수 목록
그룹의 변수 목록을 가져옵니다.
GET /groups/:id/variables
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 그룹의 ID 또는 URL 인코딩 경로 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/variables"
[
{
"key": "TEST_VARIABLE_1",
"variable_type": "env_var",
"value": "TEST_1",
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*",
"description": null
},
{
"key": "TEST_VARIABLE_2",
"variable_type": "env_var",
"value": "TEST_2",
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*",
"description": null
}
]
변수 세부정보 보기
filter
매개변수는 도입되었습니다 GitLab 16.9에.
그룹의 특정 변수의 세부정보를 가져옵니다. 동일한 키를 가진 변수가 여러 개인 경우, filter
를 사용하여 올바른 environment_scope
를 선택합니다.
GET /groups/:id/variables/:key
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 그룹의 ID 또는 URL 인코딩 경로 |
key |
string | 예 | 변수의 key
|
filter |
해시 | 아니오 | 사용 가능한 필터: [environment_scope] . filter 매개변수 세부정보를 참조하세요. |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/variables/TEST_VARIABLE_1"
{
"key": "TEST_VARIABLE_1",
"variable_type": "env_var",
"value": "TEST_1",
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*",
"description": null
}
변수 생성
새 변수를 생성합니다.
POST /groups/:id/variables
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 그룹의 ID 또는 URL 인코딩 경로 |
key |
string | 예 | 변수의 key ; 255자 이하이어야 하며, A-Z , a-z , 0-9 및 _ 만 허용됩니다. |
value |
string | 예 | 변수의 value . |
description |
string | 아니오 | 변수의 description ; 255자 이하이어야 합니다. 기본값: null . |
environment_scope |
string | 아니오 | 변수의 environment scope. Premium 및 Ultimate 전용. |
masked |
boolean | 아니오 | 변수가 마스킹되었는지 여부. |
protected |
boolean | 아니오 | 변수가 보호되는지 여부. |
raw |
boolean | 아니오 | 변수가 원시 문자열로 처리되는지 여부. 기본값: false . true 일 경우, 값의 변수가 확장되지 않습니다. |
variable_type |
string | 아니오 | 변수의 유형. 사용 가능한 유형은 env_var (기본값) 및 file 입니다. |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
"https://gitlab.example.com/api/v4/groups/1/variables" --form "key=NEW_VARIABLE" --form "value=new value"
{
"key": "NEW_VARIABLE",
"value": "new value",
"variable_type": "env_var",
"protected": false,
"masked": false,
"raw": false,
"environment_scope": "*",
"description": null
}
변수 업데이트
filter
매개변수는 도입되었습니다 GitLab 16.9에서.
그룹의 변수를 업데이트합니다. 동일한 키를 가진 변수 여러 개가 있는 경우,
filter
를 사용하여 올바른 environment_scope
를 선택합니다.
PUT /groups/:id/variables/:key
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 그룹의 ID 또는 URL 인코딩 경로 |
key |
문자열 | 예 | 변수의 key
|
value |
문자열 | 예 | 변수의 value
|
description |
문자열 | 아니오 | 변수의 설명. 기본값: null . 도입됨 GitLab 16.2에서. |
environment_scope |
문자열 | 아니오 | 변수의 환경 범위. Premium과 Ultimate 전용. |
filter |
해시 | 아니오 | 사용 가능한 필터: [environment_scope] . filter 매개변수 세부정보를 참조하세요. |
masked |
불리언 | 아니오 | 변수가 마스킹되어 있는지 여부 |
protected |
불리언 | 아니오 | 변수가 보호되어 있는지 여부 |
raw |
불리언 | 아니오 | 변수가 원시 문자열로 처리되는지 여부. 기본값: false . true 인 경우, 값의 변수는 확장되지 않습니다. |
variable_type |
문자열 | 아니오 | 변수의 유형. 사용 가능한 유형은: env_var (기본값) 및 file 입니다. |
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" \
"https://gitlab.example.com/api/v4/groups/1/variables/NEW_VARIABLE" --form "value=updated value"
{
"key": "NEW_VARIABLE",
"value": "updated value",
"variable_type": "env_var",
"protected": true,
"masked": true,
"raw": true,
"environment_scope": "*",
"description": null
}
변수 제거
filter
매개변수는 도입되었습니다 GitLab 16.9에서.
그룹의 변수를 제거합니다. 동일한 키를 가진 변수 여러 개가 있는 경우,
filter
를 사용하여 올바른 environment_scope
를 선택합니다.
DELETE /groups/:id/variables/:key
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 그룹의 ID 또는 URL 인코딩 경로 |
key |
문자열 | 예 | 변수의 key
|
filter |
해시 | 아니오 | 사용 가능한 필터: [environment_scope] . filter 매개변수 세부정보를 참조하세요. |
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" \
"https://gitlab.example.com/api/v4/groups/1/variables/VARIABLE_1"
filter
매개변수
- 도입됨 GitLab 16.9에서.
여러 변수에 동일한 key
가 있는 경우, GET, PUT 또는 DELETE 요청은 다음과 같은 결과를 반환할 수 있습니다:
제공된 매개변수와 함께 여러 변수가 있습니다. 'filter[environment_scope]'을 사용하세요.
일치하는 environment_scope
속성을 가진 변수를 선택하려면 filter[environment_scope]
를 사용하세요.
예를 들어:
-
GET:
curl --globoff --header "PRIVATE-TOKEN: <your_access_token>" \ "https://gitlab.example.com/api/v4/groups/1/variables/SCOPED_VARIABLE_1?filter[environment_scope]=production"
-
PUT:
curl --request PUT --globoff --header "PRIVATE-TOKEN: <your_access_token>" \ "https://gitlab.example.com/api/v4/groups/1/variables/SCOPED_VARIABLE_1?value=scoped-variable-updated-value&environment_scope=production&filter[environment_scope]=production"
-
DELETE:
curl --request DELETE --globoff --header "PRIVATE-TOKEN: <your_access_token>" \ "https://gitlab.example.com/api/v4/groups/1/variables/SCOPED_VARIABLE_1?filter[environment_scope]=production"