기능 플래그 API

Tier: Free, Premium, Ultimate
Offering: Self-managed

이 API는 GitLab의 개발에 사용되는 Flipper 기반 기능 플래그를 관리하기 위한 것입니다.

모든 메서드는 관리자 권한이 필요합니다.

API는 불리언 및 시간 비율 게이트 값만 지원합니다.

모든 기능 목록

모든 지속된 기능의 목록과 그 게이트 값을 가져옵니다.

GET /features
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/features"

예시 응답:

[
  {
    "name": "experimental_feature",
    "state": "off",
    "gates": [
      {
        "key": "boolean",
        "value": false
      }
    ],
    "definition": null
  },
  {
    "name": "my_user_feature",
    "state": "on",
    "gates": [
      {
        "key": "percentage_of_actors",
        "value": 34
      }
    ],
    "definition": {
      "name": "my_user_feature",
      "introduced_by_url": "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40880",
      "rollout_issue_url": "https://gitlab.com/gitlab-org/gitlab/-/issues/244905",
      "group": "group::ci",
      "type": "development",
      "default_enabled": false
    }
  },
  {
    "name": "new_library",
    "state": "on",
    "gates": [
      {
        "key": "boolean",
        "value": true
      }
    ],
    "definition": null
  }
]

모든 기능 정의 목록

모든 기능 정의의 목록을 가져옵니다.

GET /features/definitions
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/features/definitions"

예시 응답:

[
  {
    "name": "geo_pages_deployment_replication",
    "introduced_by_url": "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68662",
    "rollout_issue_url": "https://gitlab.com/gitlab-org/gitlab/-/issues/337676",
    "milestone": "14.3",
    "log_state_changes": null,
    "type": "development",
    "group": "group::geo",
    "default_enabled": true
  }
]

기능 설정 또는 생성

기능의 게이트 값을 설정합니다. 주어진 이름의 기능이 아직 존재하지 않으면 생성됩니다. 값은 불리언이거나 시간을 나타내는 정수일 수 있습니다.

경고:
개발 중인 기능을 활성화하기 전에 보안 및 안정성 위험을 이해해야 합니다.

POST /features/:name
속성 유형 필수 설명
name string 생성하거나 업데이트할 기능의 이름
value integer/string 활성화/비활성화를 위한 true 또는 false, 또는 시간 비율을 나타내기 위한 정수
key string 아니오 percentage_of_actors 또는 percentage_of_time (기본값)
feature_group string 아니오 기능 그룹 이름
user string 아니오 GitLab 사용자 이름 또는 쉼표로 구분된 여러 사용자 이름
group string 아니오 예를 들어 gitlab-org와 같은 GitLab 그룹의 경로, 또는 쉼표로 구분된 여러 그룹 경로
namespace string 아니오 예를 들어 john-doe와 같은 GitLab 그룹 또는 사용자 네임스페이스의 경로, 또는 쉼표로 구분된 여러 네임스페이스 경로. GitLab 15.0에 도입됨.
project string 아니오 예를 들어 gitlab-org/gitlab-foss와 같은 프로젝트 경로, 또는 쉼표로 구분된 여러 프로젝트 경로
repository string 아니오 예를 들어 gitlab-org/gitlab-test.git, gitlab-org/gitlab-test.wiki.git, snippets/21.git 등과 같은 저장소 경로. 여러 저장소 경로는 쉼표로 구분하여 입력하십시오.
force boolean 아니오 YAML 정의와 같은 기능 플래그 검증 확인을 건너뜁니다.

하나의 API 호출로 feature_group, user, group, namespace, project, 및 repository에 대해 기능을 활성화하거나 비활성화할 수 있습니다.

curl --data "value=30" --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/features/new_library"

예시 응답:

{
  "name": "new_library",
  "state": "conditional",
  "gates": [
    {
      "key": "boolean",
      "value": false
    },
    {
      "key": "percentage_of_time",
      "value": 30
    }
  ],
  "definition": {
    "name": "my_user_feature",
    "introduced_by_url": "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40880",
    "rollout_issue_url": "https://gitlab.com/gitlab-org/gitlab/-/issues/244905",
    "group": "group::ci",
    "type": "development",
    "default_enabled": false
  }
}

배우 롤아웃 비율 설정

배우 비율로 롤아웃합니다.

POST https://gitlab.example.com/api/v4/features/my_user_feature?private_token=<your_access_token>
Content-Type: application/x-www-form-urlencoded
value=42&key=percentage_of_actors&

예시 응답:

{
  "name": "my_user_feature",
  "state": "conditional",
  "gates": [
    {
      "key": "boolean",
      "value": false
    },
    {
      "key": "percentage_of_actors",
      "value": 42
    }
  ],
  "definition": {
    "name": "my_user_feature",
    "introduced_by_url": "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40880",
    "rollout_issue_url": "https://gitlab.com/gitlab-org/gitlab/-/issues/244905",
    "group": "group::ci",
    "type": "development",
    "default_enabled": false
  }
}

my_user_feature42%의 배우에게 롤아웃합니다.

기능 삭제

기능 게이트를 제거합니다. 게이트가 존재하든 존재하지 않든 응답은 동일합니다.

DELETE /features/:name