diff --git a/app/assets/javascripts/packages/list/packages_list_app_bundle.js b/app/assets/javascripts/packages/list/packages_list_app_bundle.js deleted file mode 100644 index 2911cf70a33..00000000000 --- a/app/assets/javascripts/packages/list/packages_list_app_bundle.js +++ /dev/null @@ -1,23 +0,0 @@ -import Vue from 'vue'; -import Translate from '~/vue_shared/translate'; -import PackagesListApp from './components/packages_list_app.vue'; -import { createStore } from './stores'; - -Vue.use(Translate); - -export default () => { - const el = document.getElementById('js-vue-packages-list'); - const store = createStore(); - store.dispatch('setInitialState', el.dataset); - - return new Vue({ - el, - store, - components: { - PackagesListApp, - }, - render(createElement) { - return createElement('packages-list-app'); - }, - }); -}; diff --git a/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/app.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/app.vue index 6016757c1b9..00f3cb09a78 100644 --- a/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/app.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/details/components/app.vue @@ -16,7 +16,7 @@ import { s__, __ } from '~/locale'; import TerraformTitle from '~/packages_and_registries/infrastructure_registry/details/components/details_title.vue'; import TerraformInstallation from '~/packages_and_registries/infrastructure_registry/details/components/terraform_installation.vue'; import Tracking from '~/tracking'; -import PackageListRow from '~/packages/shared/components/package_list_row.vue'; +import PackageListRow from '~/packages_and_registries/infrastructure_registry/shared/package_list_row.vue'; import PackagesListLoader from '~/packages/shared/components/packages_list_loader.vue'; import { TrackingActions, SHOW_DELETE_SUCCESS_ALERT } from '~/packages/shared/constants'; import { packageTypeToTrackCategory } from '~/packages/shared/utils'; diff --git a/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/infrastructure_search.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/infrastructure_search.vue similarity index 100% rename from app/assets/javascripts/packages_and_registries/infrastructure_registry/components/infrastructure_search.vue rename to app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/infrastructure_search.vue diff --git a/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/infrastructure_title.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/infrastructure_title.vue similarity index 100% rename from app/assets/javascripts/packages_and_registries/infrastructure_registry/components/infrastructure_title.vue rename to app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/infrastructure_title.vue diff --git a/app/assets/javascripts/packages/list/components/packages_list.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/packages_list.vue similarity index 90% rename from app/assets/javascripts/packages/list/components/packages_list.vue rename to app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/packages_list.vue index 23ba070aa26..cd15909e6b8 100644 --- a/app/assets/javascripts/packages/list/components/packages_list.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/packages_list.vue @@ -3,10 +3,10 @@ import { GlPagination, GlModal, GlSprintf } from '@gitlab/ui'; import { mapState, mapGetters } from 'vuex'; import { s__ } from '~/locale'; import Tracking from '~/tracking'; -import PackagesListRow from '../../shared/components/package_list_row.vue'; -import PackagesListLoader from '../../shared/components/packages_list_loader.vue'; -import { TrackingActions } from '../../shared/constants'; -import { packageTypeToTrackCategory } from '../../shared/utils'; +import PackagesListRow from '~/packages_and_registries/infrastructure_registry/shared/package_list_row.vue'; +import PackagesListLoader from '~/packages/shared/components/packages_list_loader.vue'; +import { TrackingActions } from '~/packages/shared/constants'; +import { packageTypeToTrackCategory } from '~/packages/shared/utils'; export default { components: { diff --git a/app/assets/javascripts/packages/list/components/packages_list_app.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/packages_list_app.vue similarity index 92% rename from app/assets/javascripts/packages/list/components/packages_list_app.vue rename to app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/packages_list_app.vue index 31d90fa4dee..c4927a24d33 100644 --- a/app/assets/javascripts/packages/list/components/packages_list_app.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/list/components/packages_list_app.vue @@ -7,10 +7,10 @@ import { s__ } from '~/locale'; import { SHOW_DELETE_SUCCESS_ALERT } from '~/packages/shared/constants'; import { FILTERED_SEARCH_TERM } from '~/packages_and_registries/shared/constants'; import { getQueryParams, extractFilterAndSorting } from '~/packages_and_registries/shared/utils'; -import InfrastructureTitle from '~/packages_and_registries/infrastructure_registry/components/infrastructure_title.vue'; -import InfrastructureSearch from '~/packages_and_registries/infrastructure_registry/components/infrastructure_search.vue'; -import { DELETE_PACKAGE_SUCCESS_MESSAGE } from '../constants'; -import PackageList from './packages_list.vue'; +import InfrastructureTitle from '~/packages_and_registries/infrastructure_registry/list/components/infrastructure_title.vue'; +import InfrastructureSearch from '~/packages_and_registries/infrastructure_registry/list/components/infrastructure_search.vue'; +import PackageList from '~/packages_and_registries/infrastructure_registry/list/components/packages_list.vue'; +import { DELETE_PACKAGE_SUCCESS_MESSAGE } from '~/packages/list/constants'; export default { components: { diff --git a/app/assets/javascripts/packages_and_registries/infrastructure_registry/list_app_bundle.js b/app/assets/javascripts/packages_and_registries/infrastructure_registry/list_app_bundle.js index 7e6e98f4fb5..764603cebe0 100644 --- a/app/assets/javascripts/packages_and_registries/infrastructure_registry/list_app_bundle.js +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/list_app_bundle.js @@ -1,6 +1,6 @@ import Vue from 'vue'; import { s__ } from '~/locale'; -import PackagesListApp from '~/packages/list/components/packages_list_app.vue'; +import PackagesListApp from '~/packages_and_registries/infrastructure_registry/list/components/packages_list_app.vue'; import { createStore } from '~/packages/list/stores'; import Translate from '~/vue_shared/translate'; @@ -18,9 +18,6 @@ export default () => { PackagesListApp, }, provide: { - titleComponent: 'InfrastructureTitle', - searchComponent: 'InfrastructureSearch', - iconComponent: 'InfrastructureIconAndName', emptyPageTitle: s__('InfrastructureRegistry|You have no Terraform modules in your project'), noResultsText: s__( 'InfrastructureRegistry|Terraform modules are the main way to package and reuse resource configurations with Terraform. Learn more about how to %{noPackagesLinkStart}create Terraform modules%{noPackagesLinkEnd} in GitLab.', diff --git a/app/assets/javascripts/packages_and_registries/infrastructure_registry/components/infrastructure_icon_and_name.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/shared/infrastructure_icon_and_name.vue similarity index 100% rename from app/assets/javascripts/packages_and_registries/infrastructure_registry/components/infrastructure_icon_and_name.vue rename to app/assets/javascripts/packages_and_registries/infrastructure_registry/shared/infrastructure_icon_and_name.vue diff --git a/app/assets/javascripts/packages/shared/components/package_list_row.vue b/app/assets/javascripts/packages_and_registries/infrastructure_registry/shared/package_list_row.vue similarity index 83% rename from app/assets/javascripts/packages/shared/components/package_list_row.vue rename to app/assets/javascripts/packages_and_registries/infrastructure_registry/shared/package_list_row.vue index eee0e470c7b..faf0b298718 100644 --- a/app/assets/javascripts/packages/shared/components/package_list_row.vue +++ b/app/assets/javascripts/packages_and_registries/infrastructure_registry/shared/package_list_row.vue @@ -3,11 +3,12 @@ import { GlButton, GlLink, GlSprintf, GlTooltipDirective, GlTruncate } from '@gi import { s__ } from '~/locale'; import ListItem from '~/vue_shared/components/registry/list_item.vue'; import timeagoMixin from '~/vue_shared/mixins/timeago'; -import { PACKAGE_ERROR_STATUS, PACKAGE_DEFAULT_STATUS } from '../constants'; -import { getPackageTypeLabel } from '../utils'; -import PackagePath from './package_path.vue'; -import PackageTags from './package_tags.vue'; -import PublishMethod from './publish_method.vue'; +import { PACKAGE_ERROR_STATUS, PACKAGE_DEFAULT_STATUS } from '~/packages/shared/constants'; +import { getPackageTypeLabel } from '~/packages/shared/utils'; +import PackagePath from '~/packages/shared/components/package_path.vue'; +import PackageTags from '~/packages/shared/components/package_tags.vue'; +import PublishMethod from '~/packages/shared/components/publish_method.vue'; +import InfrastructureIconAndName from '~/packages_and_registries/infrastructure_registry/shared/infrastructure_icon_and_name.vue'; export default { name: 'PackageListRow', @@ -20,23 +21,12 @@ export default { PackagePath, PublishMethod, ListItem, - PackageIconAndName: () => - import(/* webpackChunkName: 'package_registry_components' */ './package_icon_and_name.vue'), - InfrastructureIconAndName: () => - import( - /* webpackChunkName: 'infrastructure_registry_components' */ '~/packages_and_registries/infrastructure_registry/components/infrastructure_icon_and_name.vue' - ), + InfrastructureIconAndName, }, directives: { GlTooltip: GlTooltipDirective, }, mixins: [timeagoMixin], - inject: { - iconComponent: { - from: 'iconComponent', - default: 'PackageIconAndName', - }, - }, props: { packageEntity: { type: Object, @@ -130,9 +120,9 @@ export default { - + {{ packageType }} - + " "http://gitlab.example.com/api -H "Accept:application/json" \ -H "Content-Type:application/json" \ -X POST --data '{"name":"cluster-3", "environment_scope":"production", "platform_kubernetes_attributes":{"api_url":"https://example.com", "token":"12345", "ca_cert":"-----BEGIN CERTIFICATE-----qpoeiXXZafCM0ZDJkZjM...-----END CERTIFICATE-----"}}' - ``` Example response: @@ -255,7 +253,6 @@ Example request: curl --header "Private-Token: " "http://gitlab.example.com/api/v4/admin/clusters/9" \ -H "Content-Type:application/json" \ -X PUT --data '{"name":"update-cluster-name", "platform_kubernetes_attributes":{"api_url":"https://new-example.com","token":"new-token"}}' - ``` Example response: @@ -290,7 +287,6 @@ Example response: "management_project": null, "project": null } - ``` ## Delete instance cluster diff --git a/doc/api/issues_statistics.md b/doc/api/issues_statistics.md index a760424f6a2..11f24d94763 100644 --- a/doc/api/issues_statistics.md +++ b/doc/api/issues_statistics.md @@ -49,7 +49,7 @@ GET /issues_statistics?confidential=true | `created_before` | datetime | no | Return issues created on or before the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | | `updated_after` | datetime | no | Return issues updated on or after the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | | `updated_before` | datetime | no | Return issues updated on or before the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | -| `confidential` | boolean | no | Filter confidential or public issues. | +| `confidential` | boolean | no | Filter confidential or public issues. | ```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/issues_statistics" @@ -105,7 +105,7 @@ GET /groups/:id/issues_statistics?confidential=true | `created_before` | datetime | no | Return issues created on or before the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | | `updated_after` | datetime | no | Return issues updated on or after the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | | `updated_before` | datetime | no | Return issues updated on or before the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | -| `confidential` | boolean | no | Filter confidential or public issues. | +| `confidential` | boolean | no | Filter confidential or public issues. | ```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/groups/4/issues_statistics" @@ -161,7 +161,7 @@ GET /projects/:id/issues_statistics?confidential=true | `created_before` | datetime | no | Return issues created on or before the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | | `updated_after` | datetime | no | Return issues updated on or after the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | | `updated_before` | datetime | no | Return issues updated on or before the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | -| `confidential` | boolean | no | Filter confidential or public issues. | +| `confidential` | boolean | no | Filter confidential or public issues. | ```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/4/issues_statistics" diff --git a/doc/api/labels.md b/doc/api/labels.md index a8cb56f1573..5de227c8e1f 100644 --- a/doc/api/labels.md +++ b/doc/api/labels.md @@ -119,7 +119,7 @@ GET /projects/:id/labels/:label_id | Attribute | Type | Required | Description | | --------- | ------- | -------- | --------------------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a project's label. | | `include_ancestor_groups` | boolean | no | Include ancestor groups. Defaults to `true`. | @@ -195,7 +195,7 @@ DELETE /projects/:id/labels/:label_id | Attribute | Type | Required | Description | | --------- | ------- | -------- | --------------------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a group's label. | ```shell @@ -216,7 +216,7 @@ PUT /projects/:id/labels/:label_id | Attribute | Type | Required | Description | | --------------- | ------- | --------------------------------- | ------------------------------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a group's label. | | `new_name` | string | yes if `color` is not provided | The new name of the label | | `color` | string | yes if `new_name` is not provided | The color of the label given in 6-digit hex notation with leading '#' sign (for example, #FFAABB) or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords) | @@ -265,7 +265,7 @@ PUT /projects/:id/labels/:label_id/promote | Attribute | Type | Required | Description | | --------------- | ------- | --------------------------------- | ------------------------------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a group's label. | ```shell @@ -303,7 +303,7 @@ POST /projects/:id/labels/:label_id/subscribe | Attribute | Type | Required | Description | | ---------- | ----------------- | -------- | ------------------------------------ | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a project's label | ```shell @@ -341,7 +341,7 @@ POST /projects/:id/labels/:label_id/unsubscribe | Attribute | Type | Required | Description | | ---------- | ----------------- | -------- | ------------------------------------ | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a project's label | ```shell diff --git a/doc/api/merge_request_context_commits.md b/doc/api/merge_request_context_commits.md index b40d67ab4e3..9984c5abb70 100644 --- a/doc/api/merge_request_context_commits.md +++ b/doc/api/merge_request_context_commits.md @@ -17,8 +17,10 @@ GET /projects/:id/merge_requests/:merge_request_iid/context_commits Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `merge_request_iid` (required) - The internal ID of the merge request +| Attribute | Type | Required | Description | +|---------------------|---------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `merge_request_iid` | integer | yes | The internal ID of the merge request | ```json [ @@ -49,8 +51,10 @@ POST /projects/:id/merge_requests/:merge_request_iid/context_commits Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `merge_request_iid` (required) - The internal ID of the merge request +| Attribute | Type | Required | Description | +|---------------------|---------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `merge_request_iid` | integer | yes | The internal ID of the merge request | ```plaintext POST /projects/:id/merge_requests/ @@ -88,9 +92,8 @@ DELETE /projects/:id/merge_requests/:merge_request_iid/context_commits Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `merge_request_iid` (required) - The internal ID of the merge request - -| Attribute | Type | Required | Description | -| --------- | ---- | -------- | ----------- | -| `commits` | string array | yes | The context commits' SHA | +| Attribute | Type | Required | Description | +|---------------------|--------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `merge_request_iid` | integer | yes | The internal ID of the merge request | +| `commits` | string array | yes | The context commits' SHA | diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 98af228a064..f9f1b8b1bb5 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -85,7 +85,7 @@ Parameters: | `sort` | string | no | Return requests sorted in `asc` or `desc` order. Default is `desc`. | | `milestone` | string | no | Return merge requests for a specific milestone. `None` returns merge requests with no milestone. `Any` returns merge requests that have an assigned milestone. | | `view` | string | no | If `simple`, returns the `iid`, URL, title, description, and basic state of merge request. | -| `labels` | string | no | Return merge requests matching a comma separated list of labels. `None` lists all merge requests with no labels. `Any` lists all merge requests with at least one label. `No+Label` (Deprecated) lists all merge requests with no labels. Predefined names are case-insensitive. | +| `labels` | string | no | Return merge requests matching a comma-separated list of labels. `None` lists all merge requests with no labels. `Any` lists all merge requests with at least one label. `No+Label` (Deprecated) lists all merge requests with no labels. Predefined names are case-insensitive. | | `with_labels_details` | boolean | no | If `true`, response returns more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. | | `with_merge_status_recheck` | boolean | no | If `true`, this projection requests (but does not guarantee) that the `merge_status` field be recalculated asynchronously. Default is `false`. | | `created_after` | datetime | no | Return merge requests created on or after the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | @@ -272,7 +272,7 @@ Parameters: | `sort` | string | no | Return requests sorted in `asc` or `desc` order. Default is `desc`. | | `milestone` | string | no | Return merge requests for a specific milestone. `None` returns merge requests with no milestone. `Any` returns merge requests that have an assigned milestone. | | `view` | string | no | If `simple`, returns the `iid`, URL, title, description, and basic state of merge request. | -| `labels` | string | no | Return merge requests matching a comma separated list of labels. `None` lists all merge requests with no labels. `Any` lists all merge requests with at least one label. `No+Label` (Deprecated) lists all merge requests with no labels. Predefined names are case-insensitive. | +| `labels` | string | no | Return merge requests matching a comma-separated list of labels. `None` lists all merge requests with no labels. `Any` lists all merge requests with at least one label. `No+Label` (Deprecated) lists all merge requests with no labels. Predefined names are case-insensitive. | | `with_labels_details` | boolean | no | If `true`, response returns more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. | | `with_merge_status_recheck` | boolean | no | If `true`, this projection requests (but does not guarantee) that the `merge_status` field be recalculated asynchronously. Default is `false`. | | `created_after` | datetime | no | Return merge requests created on or after the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`) | @@ -459,7 +459,7 @@ Parameters: | `sort` | string | no | Return merge requests sorted in `asc` or `desc` order. Default is `desc`. | | `milestone` | string | no | Return merge requests for a specific milestone. `None` returns merge requests with no milestone. `Any` returns merge requests that have an assigned milestone. | | `view` | string | no | If `simple`, returns the `iid`, URL, title, description, and basic state of merge request. | -| `labels` | string | no | Return merge requests matching a comma separated list of labels. `None` lists all merge requests with no labels. `Any` lists all merge requests with at least one label. `No+Label` (Deprecated) lists all merge requests with no labels. Predefined names are case-insensitive. | +| `labels` | string | no | Return merge requests matching a comma-separated list of labels. `None` lists all merge requests with no labels. `Any` lists all merge requests with at least one label. `No+Label` (Deprecated) lists all merge requests with no labels. Predefined names are case-insensitive. | | `with_labels_details` | boolean | no | If `true`, response returns more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21413) in GitLab 12.7.| | `with_merge_status_recheck` | boolean | no | If `true`, this projection requests (but does not guarantee) that the `merge_status` field be recalculated asynchronously. Default is `false`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31890) in GitLab 13.0. | | `created_after` | datetime | no | Return merge requests created on or after the given time. Expected in ISO 8601 format (`2019-03-15T08:00:00Z`). | diff --git a/doc/api/milestones.md b/doc/api/milestones.md index 84b4e2fe39d..3c1e09eaace 100644 --- a/doc/api/milestones.md +++ b/doc/api/milestones.md @@ -27,7 +27,7 @@ Parameters: | Attribute | Type | Required | Description | | ---------------------------- | ------ | -------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | | `iids[]` | integer array | optional | Return only the milestones having the given `iid` (Note: ignored if `include_parent_milestones` is set as `true`) | | `state` | string | optional | Return only `active` or `closed` milestones | | `title` | string | optional | Return only the milestones having the given `title` | @@ -68,8 +68,10 @@ GET /projects/:id/milestones/:milestone_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `milestone_id` (required) - The ID of the project's milestone +| Attribute | Type | Required | Description | +|----------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `milestone_id` | integer | yes | The ID of the project's milestone | ## Create new milestone @@ -81,11 +83,13 @@ POST /projects/:id/milestones Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `title` (required) - The title of a milestone -- `description` (optional) - The description of the milestone -- `due_date` (optional) - The due date of the milestone -- `start_date` (optional) - The start date of the milestone +| Attribute | Type | Required | Description | +|---------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `title` | string | yes | The title of a milestone | +| `description` | string | no | The description of the milestone | +| `due_date` | string | no | The due date of the milestone | +| `start_date` | string | no | The start date of the milestone | ## Edit milestone @@ -97,13 +101,15 @@ PUT /projects/:id/milestones/:milestone_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `milestone_id` (required) - The ID of a project milestone -- `title` (optional) - The title of a milestone -- `description` (optional) - The description of a milestone -- `due_date` (optional) - The due date of the milestone -- `start_date` (optional) - The start date of the milestone -- `state_event` (optional) - The state event of the milestone (close or activate) +| Attribute | Type | Required | Description | +|----------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `milestone_id` | integer | yes | The ID of the project's milestone | +| `title` | string | no | The title of a milestone | +| `description` | string | no | The description of the milestone | +| `due_date` | string | no | The due date of the milestone | +| `start_date` | string | no | The start date of the milestone | +| `state_event` | string | no | The state event of the milestone (close or activate) | ## Delete project milestone @@ -115,8 +121,10 @@ DELETE /projects/:id/milestones/:milestone_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `milestone_id` (required) - The ID of the project's milestone +| Attribute | Type | Required | Description | +|----------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `milestone_id` | integer | yes | The ID of the project's milestone | ## Get all issues assigned to a single milestone @@ -128,8 +136,10 @@ GET /projects/:id/milestones/:milestone_id/issues Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `milestone_id` (required) - The ID of a project milestone +| Attribute | Type | Required | Description | +|----------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `milestone_id` | integer | yes | The ID of the project's milestone | ## Get all merge requests assigned to a single milestone @@ -141,8 +151,10 @@ GET /projects/:id/milestones/:milestone_id/merge_requests Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `milestone_id` (required) - The ID of a project milestone +| Attribute | Type | Required | Description | +|----------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `milestone_id` | integer | yes | The ID of the project's milestone | ## Promote project milestone to a group milestone @@ -156,8 +168,10 @@ POST /projects/:id/milestones/:milestone_id/promote Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `milestone_id` (required) - The ID of a project milestone +| Attribute | Type | Required | Description | +|----------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `milestone_id` | integer | yes | The ID of the project's milestone | ## Get all burndown chart events for a single milestone **(PREMIUM)** @@ -172,5 +186,7 @@ GET /projects/:id/milestones/:milestone_id/burndown_events Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `milestone_id` (required) - The ID of a project milestone +| Attribute | Type | Required | Description | +|----------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `milestone_id` | integer | yes | The ID of the project's milestone | diff --git a/doc/api/notes.md b/doc/api/notes.md index 6a3db0a2aab..879ffaca191 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -54,7 +54,7 @@ GET /projects/:id/issues/:issue_iid/notes?sort=asc&order_by=updated_at | Attribute | Type | Required | Description | | ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | `issue_iid` | integer | yes | The IID of an issue | `sort` | string | no | Return issue notes sorted in `asc` or `desc` order. Default is `desc` | `order_by` | string | no | Return issue notes ordered by `created_at` or `updated_at` fields. Default is `created_at` @@ -120,9 +120,11 @@ GET /projects/:id/issues/:issue_iid/notes/:note_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) -- `issue_iid` (required) - The IID of a project issue -- `note_id` (required) - The ID of an issue note +| Attribute | Type | Required | Description | +|-------------|----------------|----------|---------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `issue_iid` | integer | yes | The IID of a project issue | +| `note_id` | integer | yes | The ID of an issue note | ```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/issues/11/notes/1" @@ -138,11 +140,13 @@ POST /projects/:id/issues/:issue_iid/notes Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) -- `issue_iid` (required) - The IID of an issue -- `body` (required) - The content of a note. Limited to 1,000,000 characters. -- `confidential` (optional) - The confidential flag of a note. Default is false. -- `created_at` (optional) - Date time string, ISO 8601 formatted. Example: `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) +| Attribute | Type | Required | Description | +|----------------|----------------|----------|------------------------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding). | +| `issue_iid` | integer | yes | The IID of an issue. | +| `body` | string | yes | The content of a note. Limited to 1,000,000 characters. | +| `confidential` | boolean | no | The confidential flag of a note. Default is false. | +| `created_at` | string | no | Date time string, ISO 8601 formatted. Example: `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) | ```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/issues/11/notes?body=note" @@ -158,11 +162,13 @@ PUT /projects/:id/issues/:issue_iid/notes/:note_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding). -- `issue_iid` (required) - The IID of an issue. -- `note_id` (required) - The ID of a note. -- `body` (optional) - The content of a note. Limited to 1,000,000 characters. -- `confidential` (optional) - The confidential flag of a note. +| Attribute | Type | Required | Description | +|----------------|----------------|----------|----------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding). | +| `issue_iid` | integer | yes | The IID of an issue. | +| `note_id` | integer | yes | The ID of a note. | +| `body` | string | no | The content of a note. Limited to 1,000,000 characters. | +| `confidential` | boolean | no | The confidential flag of a note. | ```shell curl --request PUT --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/issues/11/notes?body=note" @@ -180,7 +186,7 @@ Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | | `issue_iid` | integer | yes | The IID of an issue | | `note_id` | integer | yes | The ID of a note | @@ -203,7 +209,7 @@ GET /projects/:id/snippets/:snippet_id/notes?sort=asc&order_by=updated_at | Attribute | Type | Required | Description | | ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | `snippet_id` | integer | yes | The ID of a project snippet | `sort` | string | no | Return snippet notes sorted in `asc` or `desc` order. Default is `desc` | `order_by` | string | no | Return snippet notes ordered by `created_at` or `updated_at` fields. Default is `created_at` @@ -222,9 +228,11 @@ GET /projects/:id/snippets/:snippet_id/notes/:note_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) -- `snippet_id` (required) - The ID of a project snippet -- `note_id` (required) - The ID of a snippet note +| Attribute | Type | Required | Description | +|--------------|----------------|----------|---------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `snippet_id` | integer | yes | The ID of a project snippet | +| `note_id` | integer | yes | The ID of a snippet note | ```json { @@ -260,10 +268,12 @@ POST /projects/:id/snippets/:snippet_id/notes Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) -- `snippet_id` (required) - The ID of a snippet -- `body` (required) - The content of a note. Limited to 1,000,000 characters. -- `created_at` (optional) - Date time string, ISO 8601 formatted. Example: `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) +| Attribute | Type | Required | Description | +|--------------|----------------|----------|------------------------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `snippet_id` | integer | yes | The ID of a snippet | +| `body` | string | yes | The content of a note. Limited to 1,000,000 characters. | +| `created_at` | string | no | Date time string, ISO 8601 formatted. Example: `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) | ```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/snippet/11/notes?body=note" @@ -279,10 +289,12 @@ PUT /projects/:id/snippets/:snippet_id/notes/:note_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) -- `snippet_id` (required) - The ID of a snippet -- `note_id` (required) - The ID of a note -- `body` (required) - The content of a note. Limited to 1,000,000 characters. +| Attribute | Type | Required | Description | +|--------------|----------------|----------|------------------------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `snippet_id` | integer | yes | The ID of a snippet | +| `note_id` | integer | yes | The ID of a snippet note | +| `body` | string | yes | The content of a note. Limited to 1,000,000 characters. | ```shell curl --request PUT --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/snippets/11/notes?body=note" @@ -300,7 +312,7 @@ Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | | `snippet_id` | integer | yes | The ID of a snippet | | `note_id` | integer | yes | The ID of a note | @@ -321,7 +333,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/notes?sort=asc&order_by=upda | Attribute | Type | Required | Description | | ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | `merge_request_iid` | integer | yes | The IID of a project merge request | `sort` | string | no | Return merge request notes sorted in `asc` or `desc` order. Default is `desc` | `order_by` | string | no | Return merge request notes ordered by `created_at` or `updated_at` fields. Default is `created_at` @@ -340,9 +352,11 @@ GET /projects/:id/merge_requests/:merge_request_iid/notes/:note_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) -- `merge_request_iid` (required) - The IID of a project merge request -- `note_id` (required) - The ID of a merge request note +| Attribute | Type | Required | Description | +|---------------------|----------------|----------|---------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `merge_request_iid` | integer | yes | The IID of a project merge request | +| `note_id` | integer | yes | The ID of a merge request note | ```json { @@ -383,10 +397,12 @@ POST /projects/:id/merge_requests/:merge_request_iid/notes Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) -- `merge_request_iid` (required) - The IID of a merge request -- `body` (required) - The content of a note. Limited to 1,000,000 characters. -- `created_at` (optional) - Date time string, ISO 8601 formatted. Example: `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) +| Attribute | Type | Required | Description | +|---------------------|----------------|----------|------------------------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `merge_request_iid` | integer | yes | The IID of a project merge request | +| `body` | string | yes | The content of a note. Limited to 1,000,000 characters. | +| `created_at` | string | no | Date time string, ISO 8601 formatted. Example: `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) | ### Modify existing merge request note @@ -398,10 +414,12 @@ PUT /projects/:id/merge_requests/:merge_request_iid/notes/:note_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) -- `merge_request_iid` (required) - The IID of a merge request -- `note_id` (required) - The ID of a note -- `body` (required) - The content of a note. Limited to 1,000,000 characters. +| Attribute | Type | Required | Description | +|---------------------|----------------|----------|---------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `merge_request_iid` | integer | yes | The IID of a project merge request | +| `note_id` | integer | no | The ID of a note | +| `body` | string | yes | The content of a note. Limited to 1,000,000 characters. | ```shell curl --request PUT --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/merge_requests/11/notes?body=note" @@ -419,7 +437,7 @@ Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | | `merge_request_iid` | integer | yes | The IID of a merge request | | `note_id` | integer | yes | The ID of a note | @@ -440,7 +458,7 @@ GET /groups/:id/epics/:epic_id/notes?sort=asc&order_by=updated_at | Attribute | Type | Required | Description | | ------------------- | ---------------- | ---------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | | `epic_id` | integer | yes | The ID of a group epic | | `sort` | string | no | Return epic notes sorted in `asc` or `desc` order. Default is `desc` | | `order_by` | string | no | Return epic notes ordered by `created_at` or `updated_at` fields. Default is `created_at` | @@ -461,7 +479,7 @@ Parameters: | Attribute | Type | Required | Description | | --------- | -------------- | -------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | | `epic_id` | integer | yes | The ID of an epic | | `note_id` | integer | yes | The ID of a note | @@ -502,7 +520,7 @@ Parameters: | Attribute | Type | Required | Description | | --------- | -------------- | -------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | | `epic_id` | integer | yes | The ID of an epic | | `body` | string | yes | The content of a note. Limited to 1,000,000 characters. | @@ -522,7 +540,7 @@ Parameters: | Attribute | Type | Required | Description | | --------- | -------------- | -------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | | `epic_id` | integer | yes | The ID of an epic | | `note_id` | integer | yes | The ID of a note | | `body` | string | yes | The content of a note. Limited to 1,000,000 characters. | @@ -543,7 +561,7 @@ Parameters: | Attribute | Type | Required | Description | | --------- | -------------- | -------- | ----------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) | | `epic_id` | integer | yes | The ID of an epic | | `note_id` | integer | yes | The ID of a note | diff --git a/doc/api/oauth2.md b/doc/api/oauth2.md index 8a8a54a753a..778c229e3c8 100644 --- a/doc/api/oauth2.md +++ b/doc/api/oauth2.md @@ -98,7 +98,7 @@ Before starting the flow, generate the `STATE`, the `CODE_VERIFIER` and the `COD This page asks the user to approve the request from the app to access their account based on the scopes specified in `REQUESTED_SCOPES`. The user is then redirected back to the specified `REDIRECT_URI`. The [scope parameter](https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes#requesting-particular-scopes) - is a space separated list of scopes associated with the user. + is a space-separated list of scopes associated with the user. For example,`scope=read_user+profile` requests the `read_user` and `profile` scopes. The redirect includes the authorization `code`, for example: @@ -126,7 +126,7 @@ Before starting the flow, generate the `STATE`, the `CODE_VERIFIER` and the `COD "created_at": 1607635748 } ``` - + 1. To retrieve a new `access_token`, use the `refresh_token` parameter. Refresh tokens may be used even after the `access_token` itself expires. This request: - Invalidates the existing `access_token` and `refresh_token`. @@ -178,7 +178,7 @@ be used as a CSRF token. This page asks the user to approve the request from the app to access their account based on the scopes specified in `REQUESTED_SCOPES`. The user is then redirected back to the specified `REDIRECT_URI`. The [scope parameter](https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes#requesting-particular-scopes) - is a space separated list of scopes associated with the user. + is a space-separated list of scopes associated with the user. For example,`scope=read_user+profile` requests the `read_user` and `profile` scopes. The redirect includes the authorization `code`, for example: @@ -206,7 +206,7 @@ be used as a CSRF token. "created_at": 1607635748 } ``` - + 1. To retrieve a new `access_token`, use the `refresh_token` parameter. Refresh tokens may be used even after the `access_token` itself expires. This request: - Invalidates the existing `access_token` and `refresh_token`. @@ -266,7 +266,7 @@ https://gitlab.example.com/oauth/authorize?client_id=APP_ID&redirect_uri=REDIREC This prompts the user to approve the applications access to their account based on the scopes specified in `REQUESTED_SCOPES` and then redirect back to the `REDIRECT_URI` you provided. The [scope parameter](https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes#requesting-particular-scopes) - is a space separated list of scopes you want to have access to (for example, `scope=read_user+profile` + is a space-separated list of scopes you want to have access to (for example, `scope=read_user+profile` would request `read_user` and `profile` scopes). The redirect includes a fragment with `access_token` as well as token details in GET parameters, for example: diff --git a/doc/api/project_badges.md b/doc/api/project_badges.md index 2e4ab0e2b8c..c6f979c1643 100644 --- a/doc/api/project_badges.md +++ b/doc/api/project_badges.md @@ -11,7 +11,7 @@ type: reference, api ## Placeholder tokens -Badges support placeholders that are replaced in real time in both the link and image URL. The allowed placeholders are: +Badges support placeholders that are replaced in real-time in both the link and image URL. The allowed placeholders are: diff --git a/doc/api/project_clusters.md b/doc/api/project_clusters.md index d2a574b5cbd..129b064c650 100644 --- a/doc/api/project_clusters.md +++ b/doc/api/project_clusters.md @@ -384,7 +384,6 @@ Example response: } } } - ``` ## Delete project cluster diff --git a/doc/api/project_snippets.md b/doc/api/project_snippets.md index 0ac2297e3c1..569270e5de1 100644 --- a/doc/api/project_snippets.md +++ b/doc/api/project_snippets.md @@ -36,7 +36,9 @@ GET /projects/:id/snippets Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user +| Attribute | Type | Required | Description | +|-----------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | ## Single snippet @@ -48,8 +50,10 @@ GET /projects/:id/snippets/:snippet_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `snippet_id` (required) - The ID of a project's snippet +| Attribute | Type | Required | Description | +|--------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `snippet_id` | integer | yes | The ID of a project's snippet | ```json { @@ -85,7 +89,7 @@ Parameters: | Attribute | Type | Required | Description | |:------------------|:----------------|:---------|:----------------------------------------------------------------------------------------------------------------| -| `id` | integer | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | | `title` | string | yes | Title of a snippet | | `file_name` | string | no | Deprecated: Use `files` instead. Name of a snippet file | | `content` | string | no | Deprecated: Use `files` instead. Content of a snippet | @@ -132,7 +136,7 @@ Parameters: | Attribute | Type | Required | Description | |:----------------------|:----------------|:---------|:----------------------------------------------------------------------------------------------------------------| -| `id` | integer | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | | `snippet_id` | integer | yes | The ID of a project's snippet | | `title` | string | no | Title of a snippet | | `file_name` | string | no | Deprecated: Use `files` instead. Name of a snippet file | @@ -183,8 +187,10 @@ DELETE /projects/:id/snippets/:snippet_id Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `snippet_id` (required) - The ID of a project's snippet +| Attribute | Type | Required | Description | +|:-------------|:---------------|:---------|:----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `snippet_id` | integer | yes | The ID of a project's snippet | Example request: @@ -203,8 +209,10 @@ GET /projects/:id/snippets/:snippet_id/raw Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `snippet_id` (required) - The ID of a project's snippet +| Attribute | Type | Required | Description | +|:-------------|:---------------|:---------|:----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `snippet_id` | integer | yes | The ID of a project's snippet | Example request: @@ -223,10 +231,12 @@ GET /projects/:id/snippets/:snippet_id/files/:ref/:file_path/raw Parameters: -- `id` (required) - The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user -- `snippet_id` (required) - The ID of a project's snippet -- `ref` (required) - The name of a branch, tag or commit, such as `main` -- `file_path` (required) - The URL-encoded path to the file, such as `snippet%2Erb` +| Attribute | Type | Required | Description | +|:-------------|:---------------|:---------|:----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `snippet_id` | integer | yes | The ID of a project's snippet | +| `ref` | string | yes | The name of a branch, tag or commit e.g. master | +| `file_path` | string | yes | The URL-encoded path to the file, e.g. snippet%2Erb | Example request: @@ -245,10 +255,10 @@ Available only for users with the Administrator [role](../user/permissions.md). GET /projects/:id/snippets/:snippet_id/user_agent_detail ``` -| Attribute | Type | Required | Description | -|---------------|---------|----------|--------------------------------------| -| `id` | integer or string | yes | The ID or [URL-encoded path of a project](index.md#namespaced-path-encoding). | -| `snippet_id` | Integer | yes | The ID of a snippet | +| Attribute | Type | Required | Description | +|--------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `snippet_id` | Integer | yes | The ID of a snippet | Example request: diff --git a/doc/api/project_statistics.md b/doc/api/project_statistics.md index c69e41a423e..c0a1227b295 100644 --- a/doc/api/project_statistics.md +++ b/doc/api/project_statistics.md @@ -21,7 +21,7 @@ GET /projects/:id/statistics | Attribute | Type | Required | Description | | ---------- | ------ | -------- | ----------- | -| `id` | integer / string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | Example response: diff --git a/doc/api/project_templates.md b/doc/api/project_templates.md index d4af0e8d78d..2ec30c80a6b 100644 --- a/doc/api/project_templates.md +++ b/doc/api/project_templates.md @@ -33,7 +33,7 @@ GET /projects/:id/templates/:type | Attribute | Type | Required | Description | | ---------- | ------ | -------- | ----------- | -| `id` | integer / string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | | `type` | string | yes | The type of the template. Accepted values are: `dockerfiles`, `gitignores`, `gitlab_ci_ymls`, `licenses`, `issues`, `merge_requests` | Example response (licenses): @@ -99,7 +99,7 @@ GET /projects/:id/templates/:type/:name | Attribute | Type | Required | Description | | ---------- | ------ | -------- | ----------- | -| `id` | integer / string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | | `type` | string | yes| The type of the template. One of: `dockerfiles`, `gitignores`, `gitlab_ci_ymls`, `licenses`, `issues`, or `merge_requests`. | | `name` | string | yes | The key of the template, as obtained from the collection endpoint | | `source_template_project_id` | integer | no | The project ID where a given template is being stored. This is useful when multiple templates from different projects have the same name. If multiple templates have the same name, the match from `closest ancestor` is returned if `source_template_project_id` is not specified | diff --git a/doc/api/projects.md b/doc/api/projects.md index 4caa4c4ffe6..ac266bd7fd2 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -2488,8 +2488,8 @@ GET /projects/:id/push_rule { "id": 1, "project_id": 3, - "commit_message_regex": "Fixes \d+\..*", - "commit_message_negative_regex": "ssh\:\/\/", + "commit_message_regex": "Fixes \\d+\\..*", + "commit_message_negative_regex": "ssh\\:\\/\\/", "branch_name_regex": "", "deny_delete_tag": false, "created_at": "2012-10-12T17:04:47Z", diff --git a/doc/api/protected_environments.md b/doc/api/protected_environments.md index 82bb1e55e77..c7de4c504a4 100644 --- a/doc/api/protected_environments.md +++ b/doc/api/protected_environments.md @@ -117,13 +117,13 @@ Example response: ```json { - "name":"production", - "deploy_access_levels":[ + "name": "production", + "deploy_access_levels": [ { - "access_level":40, - "access_level_description":"protected-access-group", - "user_id":null, - "group_id":9899826 + "access_level": 40, + "access_level_description": "protected-access-group", + "user_id": null, + "group_id": 9899826 } ] } diff --git a/doc/api/repositories.md b/doc/api/repositories.md index e93ffbc5e72..3ff8068a265 100644 --- a/doc/api/repositories.md +++ b/doc/api/repositories.md @@ -28,7 +28,7 @@ Supported attributes: | Attribute | Type | Required | Description | | :---------- | :------------- | :------- | :---------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | | `path` | string | no | The path inside repository. Used to get content of subdirectories. | | `ref` | string | no | The name of a repository branch or tag or if not given the default branch. | | `recursive` | boolean | no | Boolean value used to get a recursive tree (false by default). | @@ -104,7 +104,7 @@ Supported attributes: | Attribute | Type | Required | Description | | :-------- | :------------- | :------- | :---------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | | `sha` | string | yes | The blob SHA. | ## Raw blob content @@ -146,7 +146,7 @@ Supported attributes: | Attribute | Type | Required | Description | |:------------|:---------------|:---------|:----------------------| -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | | `sha` | string | no | The commit SHA to download. A tag, branch reference, or SHA can be used. This defaults to the tip of the default branch if not specified. | | `path` | string | no | The subpath of the repository to download. This defaults to the whole repository (empty string). | @@ -169,7 +169,7 @@ Supported attributes: | Attribute | Type | Required | Description | | :--------- | :------------- | :------- | :---------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | | `from` | string | yes | The commit SHA or branch name. | | `to` | string | yes | The commit SHA or branch name. | | `from_project_id` | integer | no | The ID to compare from | @@ -231,7 +231,7 @@ Supported attributes: | Attribute | Type | Required | Description | | :--------- | :------------- | :------- | :---------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. | | `order_by` | string | no | Return contributors ordered by `name`, `email`, or `commits` (orders by commit date) fields. Default is `commits`. | | `sort` | string | no | Return contributors sorted in `asc` or `desc` order. Default is `asc`. | @@ -263,7 +263,7 @@ GET /projects/:id/repository/merge_base | Attribute | Type | Required | Description | | --------- | -------------- | -------- | ------------------------------------------------------------------------------- | -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) | | `refs` | array | yes | The refs to find the common ancestor of, multiple refs can be passed | Example request: @@ -291,7 +291,7 @@ Example response: } ``` -## Generate changelog data +## Add changelog data to a changelog file > [Introduced](https://gitlab.com/groups/gitlab-com/gl-infra/-/epics/351) in GitLab 13.9. @@ -373,26 +373,26 @@ If the last tag is `v0.9.0` and the default branch is `main`, the range of commi included in this example is `v0.9.0..main`: ```shell -curl --header "PRIVATE-TOKEN: token" --data "version=1.0.0" "https://gitlab.com/api/v4/projects/42/repository/changelog" +curl --request POST --header "PRIVATE-TOKEN: token" --data "version=1.0.0" "https://gitlab.com/api/v4/projects/42/repository/changelog" ``` To generate the data on a different branch, specify the `branch` parameter. This command generates data from the `foo` branch: ```shell -curl --header "PRIVATE-TOKEN: token" --data "version=1.0.0&branch=foo" "https://gitlab.com/api/v4/projects/42/repository/changelog" +curl --request POST --header "PRIVATE-TOKEN: token" --data "version=1.0.0&branch=foo" "https://gitlab.com/api/v4/projects/42/repository/changelog" ``` To use a different trailer, use the `trailer` parameter: ```shell -curl --header "PRIVATE-TOKEN: token" --data "version=1.0.0&trailer=Type" "https://gitlab.com/api/v4/projects/42/repository/changelog" +curl --request POST --header "PRIVATE-TOKEN: token" --data "version=1.0.0&trailer=Type" "https://gitlab.com/api/v4/projects/42/repository/changelog" ``` To store the results in a different file, use the `file` parameter: ```shell -curl --header "PRIVATE-TOKEN: token" --data "version=1.0.0&file=NEWS" "https://gitlab.com/api/v4/projects/42/repository/changelog" +curl --request POST --header "PRIVATE-TOKEN: token" --data "version=1.0.0&file=NEWS" "https://gitlab.com/api/v4/projects/42/repository/changelog" ``` ### How it works @@ -707,3 +707,39 @@ tag_regex: '^version-(?P\d+)\.(?P\d+)\.(?P\d+)$' To test if your regular expression is working, you can use websites such as [regex101](https://regex101.com/). If the regular expression syntax is invalid, an error is produced when generating a changelog. + +## Generate changelog data + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/345934) in GitLab 14.6. + +Generate changelog data based on commits in a repository, without committing +them to a changelog file. + +Works exactly like `POST /projects/:id/repository/changelog`, except the changelog +data isn't committed to any changelog file. + +```plaintext +GET /projects/:id/repository/changelog +``` + +Supported attributes: + +| Attribute | Type | Required | Description | +| :-------- | :------- | :--------- | :---------- | +| `version` | string | yes | The version to generate the changelog for. The format must follow [semantic versioning](https://semver.org/). | +| `from` | string | no | The start of the range of commits (as a SHA) to use for generating the changelog. This commit itself isn't included in the list. | +| `to` | string | no | The end of the range of commits (as a SHA) to use for the changelog. This commit _is_ included in the list. Defaults to the branch specified in the `branch` attribute. | +| `date` | datetime | no | The date and time of the release, ISO 8601 formatted. Example: `2016-03-11T03:45:40Z`. Defaults to the current time. | +| `trailer` | string | no | The Git trailer to use for including commits, defaults to `Changelog`. | + +```shell +curl --header "PRIVATE-TOKEN: token" --data "version=1.0.0" "https://gitlab.com/api/v4/projects/42/repository/changelog" +``` + +Example Response: + +```json +{ + "notes": "## 1.0.0 (2021-11-17)\n\n### feature (2 changes)\n\n- [Title 2](namespace13/project13@ad608eb642124f5b3944ac0ac772fecaf570a6bf) ([merge request](namespace13/project13!2))\n- [Title 1](namespace13/project13@3c6b80ff7034fa0d585314e1571cc780596ce3c8) ([merge request](namespace13/project13!1))\n" +} +``` diff --git a/doc/api/repository_files.md b/doc/api/repository_files.md index cc210eacd49..fd024240e90 100644 --- a/doc/api/repository_files.md +++ b/doc/api/repository_files.md @@ -35,6 +35,12 @@ GET /projects/:id/repository/files/:file_path curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb?ref=master" ``` +| Attribute | Type | Required | Description | +|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `file_path` | string | yes | URL encoded full path to new file. Ex. `lib%2Fclass%2Erb`. | +| `ref` | string | yes | The name of branch, tag or commit | + Example response: ```json @@ -52,11 +58,6 @@ Example response: } ``` -Parameters: - -- `file_path` (required) - URL encoded full path to new file. Ex. lib%2Fclass%2Erb -- `ref` (required) - The name of branch, tag or commit - NOTE: `blob_id` is the blob SHA, see [repositories - Get a blob from repository](repositories.md#get-a-blob-from-repository) @@ -95,6 +96,12 @@ Allows you to receive blame information. Each blame range contains lines and cor GET /projects/:id/repository/files/:file_path/blame ``` +| Attribute | Type | Required | Description | +|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `file_path` | string | yes | URL encoded full path to new file. Ex. `lib%2Fclass%2Erb`. | +| `ref` | string | yes | The name of branch, tag or commit | + ```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/13083/repository/files/path%2Fto%2Ffile.rb/blame?ref=master" ``` @@ -127,11 +134,6 @@ Example response: ] ``` -Parameters: - -- `file_path` (required) - URL encoded full path to new file. Ex. lib%2Fclass%2Erb -- `ref` (required) - The name of branch, tag or commit - NOTE: `HEAD` method return just file metadata as in [Get file from repository](repository_files.md#get-file-from-repository). @@ -162,15 +164,16 @@ X-Gitlab-Size: 1476 GET /projects/:id/repository/files/:file_path/raw ``` +| Attribute | Type | Required | Description | +|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `file_path` | string | yes | URL encoded full path to new file. Ex. `lib%2Fclass%2Erb`. | +| `ref` | string | yes | The name of branch, tag or commit. Default is the `HEAD` of the project. | + ```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb/raw?ref=master" ``` -Parameters: - -- `file_path` (required) - URL encoded full path to new file, such as lib%2Fclass%2Erb. -- `ref` (optional) - The name of branch, tag or commit. Default is the `HEAD` of the project. - NOTE: Like [Get file from repository](repository_files.md#get-file-from-repository) you can use `HEAD` to get just file metadata. @@ -182,6 +185,18 @@ This allows you to create a single file. For creating multiple files with a sing POST /projects/:id/repository/files/:file_path ``` +| Attribute | Type | Required | Description | +|------------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `file_path` | string | yes | URL encoded full path to new file. Ex. `lib%2Fclass%2Erb`. | +| `branch` | string | yes | Name of the branch | +| `start_branch` | string | no | Name of the branch to start the new commit from | +| `encoding` | string | no | Change encoding to `base64`. Default is `text`. | +| `author_email` | string | no | Specify the commit author's email address | +| `author_name` | string | no | Specify the commit author's name | +| `content` | string | yes | File content | +| `commit_message` | string | yes | Commit message | + ```shell curl --request POST --header 'PRIVATE-TOKEN: ' \ --header "Content-Type: application/json" \ @@ -199,17 +214,6 @@ Example response: } ``` -Parameters: - -- `file_path` (required) - URL encoded full path to new file. Ex. lib%2Fclass%2Erb -- `branch` (required) - Name of the branch -- `start_branch` (optional) - Name of the branch to start the new commit from -- `encoding` (optional) - Change encoding to `base64`. Default is `text`. -- `author_email` (optional) - Specify the commit author's email address -- `author_name` (optional) - Specify the commit author's name -- `content` (required) - File content -- `commit_message` (required) - Commit message - ## Update existing file in repository This allows you to update a single file. For updating multiple files with a single request see the [commits API](commits.md#create-a-commit-with-multiple-files-and-actions). @@ -218,6 +222,19 @@ This allows you to update a single file. For updating multiple files with a sing PUT /projects/:id/repository/files/:file_path ``` +| Attribute | Type | Required | Description | +|------------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `file_path` | string | yes | URL encoded full path to new file. Ex. `lib%2Fclass%2Erb`. | +| `branch` | string | yes | Name of the branch | +| `start_branch` | string | no | Name of the branch to start the new commit from | +| `encoding` | string | no | Change encoding to `base64`. Default is `text`. | +| `author_email` | string | no | Specify the commit author's email address | +| `author_name` | string | no | Specify the commit author's name | +| `content` | string | yes | File content | +| `commit_message` | string | yes | Commit message | +| `last_commit_id` | string | no | Last known file commit ID | + ```shell curl --request PUT --header 'PRIVATE-TOKEN: ' \ --header "Content-Type: application/json" \ @@ -235,18 +252,6 @@ Example response: } ``` -Parameters: - -- `file_path` (required) - URL encoded full path to new file. Ex. lib%2Fclass%2Erb -- `branch` (required) - Name of the branch -- `start_branch` (optional) - Name of the branch to start the new commit from -- `encoding` (optional) - Change encoding to `base64`. Default is `text`. -- `author_email` (optional) - Specify the commit author's email address -- `author_name` (optional) - Specify the commit author's name -- `content` (required) - New file content -- `commit_message` (required) - Commit message -- `last_commit_id` (optional) - Last known file commit ID - If the commit fails for any reason we return a 400 error with a non-specific error message. Possible causes for a failed commit include: @@ -265,6 +270,17 @@ This allows you to delete a single file. For deleting multiple files with a sing DELETE /projects/:id/repository/files/:file_path ``` +| Attribute | Type | Required | Description | +|------------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------| +| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user | +| `file_path` | string | yes | URL encoded full path to new file. Ex. `lib%2Fclass%2Erb`. | +| `branch` | string | yes | Name of the branch | +| `start_branch` | string | no | Name of the branch to start the new commit from | +| `author_email` | string | no | Specify the commit author's email address. | +| `author_name` | string | no | Specify the commit author's name. | +| `commit_message` | string | yes | Commit message. | +| `last_commit_id` | string | no | Last known file commit ID. | + ```shell curl --request DELETE --header 'PRIVATE-TOKEN: ' \ --header "Content-Type: application/json" \ @@ -272,13 +288,3 @@ curl --request DELETE --header 'PRIVATE-TOKEN: ' \ "commit_message": "delete file"}' \ "https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb" ``` - -Parameters: - -- `file_path` (required) - URL encoded full path to new file. Ex. lib%2Fclass%2Erb -- `branch` (required) - Name of the branch -- `start_branch` (optional) - Name of the branch to start the new commit from -- `author_email` (optional) - Specify the commit author's email address -- `author_name` (optional) - Specify the commit author's name -- `commit_message` (required) - Commit message -- `last_commit_id` (optional) - Last known file commit ID diff --git a/doc/api/users.md b/doc/api/users.md index d8effc4d38f..da33b71aa35 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -269,7 +269,9 @@ GET /users/:id Parameters: -- `id` (required) - The ID of a user +| Attribute | Type | Required | Description | +|-----------|---------|----------|------------------| +| `id` | integer | yes | The ID of a user | ```json { @@ -303,7 +305,9 @@ GET /users/:id Parameters: -- `id` (required) - The ID of a user +| Attribute | Type | Required | Description | +|-----------|---------|----------|------------------| +| `id` | integer | yes | The ID of a user | Example Responses: @@ -509,8 +513,10 @@ DELETE /users/:id/identities/:provider Parameters: -- `id` (required) - The ID of the user -- `provider` (required) - External provider name +| Attribute | Type | Required | Description | +|------------|---------|----------|------------------------| +| `id` | integer | yes | The ID of a user | +| `provider` | string | yes | External provider name | ## User deletion @@ -523,10 +529,10 @@ DELETE /users/:id Parameters: -- `id` (required) - The ID of the user -- `hard_delete` (optional) - If true, contributions that would usually be - [moved to the ghost user](../user/profile/account/delete_account.md#associated-records) - are deleted instead, as well as groups owned solely by this user. +| Attribute | Type | Required | Description | +|---------------|---------|----------|----------------------------------------------| +| `id` | integer | yes | The ID of a user | +| `hard_delete` | boolean | no | If true, contributions that would usually be [moved to the ghost user](../user/profile/account/delete_account.md#associated-records) are deleted instead, as well as groups owned solely by this user. | ## List current user (for normal users) @@ -576,14 +582,16 @@ GET /user ## List current user (for admins) -Parameters: - -- `sudo` (optional) - the ID of a user to make the call in their place - ```plaintext GET /user ``` +Parameters: + +| Attribute | Type | Required | Description | +|-----------|---------|----------|--------------------------------------------------| +| `sudo` | integer | no | the ID of a user to make the call in their place | + ```json { "id": 1, @@ -936,7 +944,9 @@ GET /user/keys/:key_id Parameters: -- `key_id` (required) - The ID of an SSH key +| Attribute | Type | Required | Description | +|-----------|--------|----------|----------------------| +| `key_id` | string | yes | The ID of an SSH key | ```json { @@ -957,9 +967,11 @@ POST /user/keys Parameters: -- `title` (required) - new SSH key's title -- `key` (required) - new SSH key -- `expires_at` (optional) - The expiration date of the SSH key in ISO 8601 format (`YYYY-MM-DDTHH:MM:SSZ`) +| Attribute | Type | Required | Description | +|--------------|--------|----------|--------------------------------------------------------------------------------| +| `title` | string | yes | new SSH key's title | +| `key` | string | yes | new SSH key | +| `expires_at` | string | no | The expiration date of the SSH key in ISO 8601 format (`YYYY-MM-DDTHH:MM:SSZ`) | ```json { @@ -995,10 +1007,12 @@ POST /users/:id/keys Parameters: -- `id` (required) - ID of specified user -- `title` (required) - new SSH key's title -- `key` (required) - new SSH key -- `expires_at` (optional) - The expiration date of the SSH key in ISO 8601 format (`YYYY-MM-DDTHH:MM:SSZ`) +| Attribute | Type | Required | Description | +|--------------|---------|----------|--------------------------------------------------------------------------------| +| `id` | integer | yes | ID of specified user | +| `title` | string | yes | new SSH key's title | +| `key` | string | yes | new SSH key | +| `expires_at` | string | no | The expiration date of the SSH key in ISO 8601 format (`YYYY-MM-DDTHH:MM:SSZ`) | NOTE: This also adds an audit event, as described in [audit instance events](../administration/audit_events.md#instance-events). **(PREMIUM)** @@ -1014,7 +1028,9 @@ DELETE /user/keys/:key_id Parameters: -- `key_id` (required) - SSH key ID +| Attribute | Type | Required | Description | +|-----------|---------|----------|-------------| +| `key_id` | integer | yes | SSH key ID | ## Delete SSH key for given user @@ -1026,8 +1042,10 @@ DELETE /users/:id/keys/:key_id Parameters: -- `id` (required) - ID of specified user -- `key_id` (required) - SSH key ID +| Attribute | Type | Required | Description | +|-----------|---------|----------|----------------------| +| `id` | integer | yes | ID of specified user | +| `key_id` | integer | yes | SSH key ID | ## List all GPG keys @@ -1092,8 +1110,8 @@ POST /user/gpg_keys Parameters: | Attribute | Type | Required | Description | -| --------- | ------ | -------- | --------------- | -| key | string | yes | The new GPG key | +|-----------|--------|----------|-----------------| +| `key` | string | yes | The new GPG key | ```shell curl --data "key=-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFV..." \ @@ -1288,7 +1306,9 @@ GET /users/:id/emails Parameters: -- `id` (required) - ID of specified user +| Attribute | Type | Required | Description | +|-----------|---------|----------|----------------------| +| `id` | integer | yes | ID of specified user | ## Single email @@ -1300,7 +1320,9 @@ GET /user/emails/:email_id Parameters: -- `email_id` (required) - email ID +| Attribute | Type | Required | Description | +|------------|---------|----------|-------------| +| `email_id` | integer | yes | Email ID | ```json { @@ -1320,7 +1342,9 @@ POST /user/emails Parameters: -- `email` (required) - email address +| Attribute | Type | Required | Description | +|-----------|--------|----------|-------------| +| `email` | string | yes | Email address | ```json { @@ -1353,9 +1377,11 @@ POST /users/:id/emails Parameters: -- `id` (required) - ID of specified user -- `email` (required) - email address -- `skip_confirmation` (optional) - Skip confirmation and assume email is verified - true or false (default) +| Attribute | Type | Required | Description | +|---------------------|---------|----------|---------------------------------------------------------------------------| +| `id` | string | yes | ID of specified user | +| `email` | string | yes | Email address | +| `skip_confirmation` | boolean | no | Skip confirmation and assume email is verified - true or false (default) | ## Delete email for current user @@ -1368,7 +1394,9 @@ DELETE /user/emails/:email_id Parameters: -- `email_id` (required) - email ID +| Attribute | Type | Required | Description | +|------------|---------|----------|-------------| +| `email_id` | integer | yes | Email ID | ## Delete email for given user @@ -1380,8 +1408,10 @@ DELETE /users/:id/emails/:email_id Parameters: -- `id` (required) - ID of specified user -- `email_id` (required) - email ID +| Attribute | Type | Required | Description | +|------------|---------|----------|----------------------| +| `id` | integer | yes | ID of specified user | +| `email_id` | integer | yes | Email ID | ## Block user @@ -1393,7 +1423,9 @@ POST /users/:id/block Parameters: -- `id` (required) - ID of specified user +| Attribute | Type | Required | Description | +|------------|---------|----------|----------------------| +| `id` | integer | yes | ID of specified user | Returns: @@ -1413,7 +1445,9 @@ POST /users/:id/unblock Parameters: -- `id` (required) - ID of specified user +| Attribute | Type | Required | Description | +|------------|---------|----------|----------------------| +| `id` | integer | yes | ID of specified user | Returns `201 OK` on success, `404 User Not Found` is user cannot be found or `403 Forbidden` when trying to unblock a user blocked by LDAP synchronization. @@ -1430,7 +1464,9 @@ POST /users/:id/deactivate Parameters: -- `id` (required) - ID of specified user +| Attribute | Type | Required | Description | +|------------|---------|----------|----------------------| +| `id` | integer | yes | ID of specified user | Returns: @@ -1453,7 +1489,9 @@ POST /users/:id/activate Parameters: -- `id` (required) - ID of specified user +| Attribute | Type | Required | Description | +|------------|---------|----------|----------------------| +| `id` | integer | yes | ID of specified user | Returns: @@ -1572,7 +1610,9 @@ POST /users/:id/approve Parameters: -- `id` (required) - ID of specified user +| Attribute | Type | Required | Description | +|------------|---------|----------|----------------------| +| `id` | integer | yes | ID of specified user | ```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/users/42/approve" @@ -1731,10 +1771,6 @@ It revokes an impersonation token. DELETE /users/:user_id/impersonation_tokens/:impersonation_token_id ``` -```shell -curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/users/42/impersonation_tokens/1" -``` - Parameters: | Attribute | Type | Required | Description | @@ -1742,6 +1778,10 @@ Parameters: | `user_id` | integer | yes | The ID of the user | | `impersonation_token_id` | integer | yes | The ID of the impersonation token | +```shell +curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/users/42/impersonation_tokens/1" +``` + ## Create a personal access token **(FREE SELF)** > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/17176) in GitLab 13.6. diff --git a/doc/development/service_ping/index.md b/doc/development/service_ping/index.md index 6ddbe2f9646..c34f9976f97 100644 --- a/doc/development/service_ping/index.md +++ b/doc/development/service_ping/index.md @@ -521,6 +521,12 @@ To generate Service Ping, use [Teleport](https://goteleport.com/docs/) or a deta 1. Check the last payload in `raw_usage_data` table: `RawUsageData.last.payload` 1. Check the when the payload was sent: `RawUsageData.last.sent_at` +### Skip database write operations + +To skip database write operations, DevOps report creation, and storage of usage data payload, you can pass an optional argument `skip_db_write`: + +`ServicePing::SubmitService.new(skip_db_write: true).execute` + ## Troubleshooting ### Cannot disable Service Ping using the configuration file diff --git a/doc/user/project/import/github.md b/doc/user/project/import/github.md index e1a81ae1bba..72bf0841687 100644 --- a/doc/user/project/import/github.md +++ b/doc/user/project/import/github.md @@ -52,9 +52,12 @@ self-managed GitLab instance. - If you're importing to a self-managed GitLab instance, you can alternatively use the [GitHub Rake task](../../../administration/raketasks/github_import.md) to import projects without the constraints of a [Sidekiq](../../../development/sidekiq_style_guide.md) worker. -- If you're importing from GitHub Enterprise to your self-managed GitLab instance, you must first enable - [GitHub integration](../../../integration/github.md). +- If you're importing from GitHub Enterprise to your self-managed GitLab instance: + - You must first enable [GitHub integration](../../../integration/github.md). - To import projects from GitHub Enterprise to GitLab.com, use the [Import API](../../../api/import.md). + - If GitLab is behind a HTTP/HTTPS proxy you must populate the [allowlist for local requests](../../../security/webhooks.md#allowlist-for-local-requests) + with `github.com` and `api.github.com` to solve the hostname. For more information, read the issue + [Importing a GitHub project requires DNS resolution even when behind a proxy](https://gitlab.com/gitlab-org/gitlab/-/issues/37941) - If you're importing from GitHub.com to your self-managed GitLab instance, setting up GitHub integration is not required. You can use the [Import API](../../../api/import.md). diff --git a/lib/api/entities/changelog.rb b/lib/api/entities/changelog.rb new file mode 100644 index 00000000000..f8ca5826418 --- /dev/null +++ b/lib/api/entities/changelog.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module API + module Entities + class Changelog < Grape::Entity + expose :to_s, as: :notes + end + end +end diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 2dd0e40afba..e966c3dfd0a 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -10,6 +10,32 @@ module API helpers ::API::Helpers::HeadersHelpers + helpers do + params :release_params do + requires :version, + type: String, + regexp: Gitlab::Regex.unbounded_semver_regex, + desc: 'The version of the release, using the semantic versioning format' + + optional :from, + type: String, + desc: 'The first commit in the range of commits to use for the changelog' + + optional :to, + type: String, + desc: 'The last commit in the range of commits to use for the changelog' + + optional :date, + type: DateTime, + desc: 'The date and time of the release' + + optional :trailer, + type: String, + desc: 'The Git trailer to use for determining if commits are to be included in the changelog', + default: ::Repositories::ChangelogService::DEFAULT_TRAILER + end + end + before { authorize! :download_code, user_project } feature_category :source_code_management @@ -208,36 +234,33 @@ module API end end - desc 'Generates a changelog section for a release' do + desc 'Generates a changelog section for a release and returns it' do + detail 'This feature was introduced in GitLab 14.6' + end + params do + use :release_params + end + get ':id/repository/changelog' do + service = ::Repositories::ChangelogService.new( + user_project, + current_user, + **declared_params(include_missing: false) + ) + changelog = service.execute(commit_to_changelog: false) + + present changelog, with: Entities::Changelog + end + + desc 'Generates a changelog section for a release and commits it in a changelog file' do detail 'This feature was introduced in GitLab 13.9' end params do - requires :version, - type: String, - regexp: Gitlab::Regex.unbounded_semver_regex, - desc: 'The version of the release, using the semantic versioning format' - - optional :from, - type: String, - desc: 'The first commit in the range of commits to use for the changelog' - - optional :to, - type: String, - desc: 'The last commit in the range of commits to use for the changelog' - - optional :date, - type: DateTime, - desc: 'The date and time of the release' + use :release_params optional :branch, type: String, desc: 'The branch to commit the changelog changes to' - optional :trailer, - type: String, - desc: 'The Git trailer to use for determining if commits are to be included in the changelog', - default: ::Repositories::ChangelogService::DEFAULT_TRAILER - optional :file, type: String, desc: 'The file to commit the changelog changes to', @@ -261,7 +284,7 @@ module API **declared_params(include_missing: false) ) - service.execute + service.execute(commit_to_changelog: true) status(200) rescue Gitlab::Changelog::Error => ex render_api_error!("Failed to generate the changelog: #{ex.message}", 422) diff --git a/qa/qa/page/project/packages/index.rb b/qa/qa/page/project/packages/index.rb index 7794677b9b5..80a1e52e044 100644 --- a/qa/qa/page/project/packages/index.rb +++ b/qa/qa/page/project/packages/index.rb @@ -5,7 +5,7 @@ module QA module Project module Packages class Index < QA::Page::Base - view 'app/assets/javascripts/packages/shared/components/package_list_row.vue' do + view 'app/assets/javascripts/packages_and_registries/package_registry/components/list/package_list_row.vue' do element :package_row element :package_link end diff --git a/spec/frontend/packages_and_registries/infrastructure_registry/components/details/components/app_spec.js b/spec/frontend/packages_and_registries/infrastructure_registry/components/details/components/app_spec.js index c7c10cef504..0a2097f47c3 100644 --- a/spec/frontend/packages_and_registries/infrastructure_registry/components/details/components/app_spec.js +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/details/components/app_spec.js @@ -9,7 +9,7 @@ import PackagesApp from '~/packages_and_registries/infrastructure_registry/detai import PackageFiles from '~/packages_and_registries/infrastructure_registry/details/components/package_files.vue'; import PackageHistory from '~/packages_and_registries/infrastructure_registry/details/components/package_history.vue'; import * as getters from '~/packages_and_registries/infrastructure_registry/details/store/getters'; -import PackageListRow from '~/packages/shared/components/package_list_row.vue'; +import PackageListRow from '~/packages_and_registries/infrastructure_registry/shared/package_list_row.vue'; import PackagesListLoader from '~/packages/shared/components/packages_list_loader.vue'; import { TrackingActions } from '~/packages/shared/constants'; import * as SharedUtils from '~/packages/shared/utils'; diff --git a/spec/frontend/packages/list/components/__snapshots__/packages_list_app_spec.js.snap b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/__snapshots__/packages_list_app_spec.js.snap similarity index 100% rename from spec/frontend/packages/list/components/__snapshots__/packages_list_app_spec.js.snap rename to spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/__snapshots__/packages_list_app_spec.js.snap diff --git a/spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_search_spec.js b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/infrastructure_search_spec.js similarity index 98% rename from spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_search_spec.js rename to spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/infrastructure_search_spec.js index 119b678cc37..b519ab00d06 100644 --- a/spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_search_spec.js +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/infrastructure_search_spec.js @@ -1,6 +1,6 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; -import component from '~/packages_and_registries/infrastructure_registry/components/infrastructure_search.vue'; +import component from '~/packages_and_registries/infrastructure_registry/list/components/infrastructure_search.vue'; import RegistrySearch from '~/vue_shared/components/registry/registry_search.vue'; import UrlSync from '~/vue_shared/components/url_sync.vue'; diff --git a/spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_title_spec.js b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/infrastructure_title_spec.js similarity index 97% rename from spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_title_spec.js rename to spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/infrastructure_title_spec.js index db6e175b054..b0e586f189a 100644 --- a/spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_title_spec.js +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/infrastructure_title_spec.js @@ -1,5 +1,5 @@ import { shallowMount } from '@vue/test-utils'; -import component from '~/packages_and_registries/infrastructure_registry/components/infrastructure_title.vue'; +import component from '~/packages_and_registries/infrastructure_registry/list/components/infrastructure_title.vue'; import MetadataItem from '~/vue_shared/components/registry/metadata_item.vue'; import TitleArea from '~/vue_shared/components/registry/title_area.vue'; diff --git a/spec/frontend/packages/list/components/packages_list_app_spec.js b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/packages_list_app_spec.js similarity index 97% rename from spec/frontend/packages/list/components/packages_list_app_spec.js rename to spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/packages_list_app_spec.js index 5f7555a3a2b..60cb1b400f5 100644 --- a/spec/frontend/packages/list/components/packages_list_app_spec.js +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/packages_list_app_spec.js @@ -4,12 +4,12 @@ import Vuex from 'vuex'; import setWindowLocation from 'helpers/set_window_location_helper'; import createFlash from '~/flash'; import * as commonUtils from '~/lib/utils/common_utils'; -import PackageListApp from '~/packages/list/components/packages_list_app.vue'; +import PackageListApp from '~/packages_and_registries/infrastructure_registry/list/components/packages_list_app.vue'; import { DELETE_PACKAGE_SUCCESS_MESSAGE } from '~/packages/list/constants'; import { SHOW_DELETE_SUCCESS_ALERT } from '~/packages/shared/constants'; import { FILTERED_SEARCH_TERM } from '~/packages_and_registries/shared/constants'; import * as packageUtils from '~/packages_and_registries/shared/utils'; -import InfrastructureSearch from '~/packages_and_registries/infrastructure_registry/components/infrastructure_search.vue'; +import InfrastructureSearch from '~/packages_and_registries/infrastructure_registry/list/components/infrastructure_search.vue'; jest.mock('~/lib/utils/common_utils'); jest.mock('~/flash'); diff --git a/spec/frontend/packages/list/components/packages_list_spec.js b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/packages_list_spec.js similarity index 95% rename from spec/frontend/packages/list/components/packages_list_spec.js rename to spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/packages_list_spec.js index b1478a5e6dc..1d399938630 100644 --- a/spec/frontend/packages/list/components/packages_list_spec.js +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/packages_list_spec.js @@ -3,13 +3,13 @@ import { mount, createLocalVue } from '@vue/test-utils'; import { last } from 'lodash'; import Vuex from 'vuex'; import stubChildren from 'helpers/stub_children'; -import PackagesList from '~/packages/list/components/packages_list.vue'; -import PackagesListRow from '~/packages/shared/components/package_list_row.vue'; +import PackagesList from '~/packages_and_registries/infrastructure_registry/list/components/packages_list.vue'; +import PackagesListRow from '~/packages_and_registries/infrastructure_registry/shared/package_list_row.vue'; import PackagesListLoader from '~/packages/shared/components/packages_list_loader.vue'; import { TrackingActions } from '~/packages/shared/constants'; import * as SharedUtils from '~/packages/shared/utils'; import Tracking from '~/tracking'; -import { packageList } from '../../mock_data'; +import { packageList } from '../../../../../packages/mock_data'; const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/packages/shared/components/__snapshots__/package_list_row_spec.js.snap b/spec/frontend/packages_and_registries/infrastructure_registry/components/shared/__snapshots__/package_list_row_spec.js.snap similarity index 100% rename from spec/frontend/packages/shared/components/__snapshots__/package_list_row_spec.js.snap rename to spec/frontend/packages_and_registries/infrastructure_registry/components/shared/__snapshots__/package_list_row_spec.js.snap diff --git a/spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_icon_and_name_spec.js b/spec/frontend/packages_and_registries/infrastructure_registry/components/shared/infrastructure_icon_and_name_spec.js similarity index 90% rename from spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_icon_and_name_spec.js rename to spec/frontend/packages_and_registries/infrastructure_registry/components/shared/infrastructure_icon_and_name_spec.js index ef26c729691..abb0d23b6e4 100644 --- a/spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_icon_and_name_spec.js +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/shared/infrastructure_icon_and_name_spec.js @@ -1,6 +1,6 @@ import { GlIcon } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import InfrastructureIconAndName from '~/packages_and_registries/infrastructure_registry/components/infrastructure_icon_and_name.vue'; +import InfrastructureIconAndName from '~/packages_and_registries/infrastructure_registry/shared/infrastructure_icon_and_name.vue'; describe('InfrastructureIconAndName', () => { let wrapper; diff --git a/spec/frontend/packages/shared/components/package_list_row_spec.js b/spec/frontend/packages_and_registries/infrastructure_registry/components/shared/package_list_row_spec.js similarity index 84% rename from spec/frontend/packages/shared/components/package_list_row_spec.js rename to spec/frontend/packages_and_registries/infrastructure_registry/components/shared/package_list_row_spec.js index 5f2fc8ddfbd..8505a23f38e 100644 --- a/spec/frontend/packages/shared/components/package_list_row_spec.js +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/shared/package_list_row_spec.js @@ -2,13 +2,13 @@ import { GlLink } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; -import PackagesListRow from '~/packages/shared/components/package_list_row.vue'; +import PackagesListRow from '~/packages_and_registries/infrastructure_registry/shared/package_list_row.vue'; import PackagePath from '~/packages/shared/components/package_path.vue'; import PackageTags from '~/packages/shared/components/package_tags.vue'; import { PACKAGE_ERROR_STATUS } from '~/packages/shared/constants'; import ListItem from '~/vue_shared/components/registry/list_item.vue'; -import { packageList } from '../../mock_data'; +import { packageList } from '../../../../packages/mock_data'; describe('packages_list_row', () => { let wrapper; @@ -17,12 +17,10 @@ describe('packages_list_row', () => { const [packageWithoutTags, packageWithTags] = packageList; const InfrastructureIconAndName = { name: 'InfrastructureIconAndName', template: '
' }; - const PackageIconAndName = { name: 'PackageIconAndName', template: '
' }; const findPackageTags = () => wrapper.findComponent(PackageTags); const findPackagePath = () => wrapper.findComponent(PackagePath); const findDeleteButton = () => wrapper.findByTestId('action-delete'); - const findPackageIconAndName = () => wrapper.findComponent(PackageIconAndName); const findInfrastructureIconAndName = () => wrapper.findComponent(InfrastructureIconAndName); const findListItem = () => wrapper.findComponent(ListItem); const findPackageLink = () => wrapper.findComponent(GlLink); @@ -41,7 +39,6 @@ describe('packages_list_row', () => { stubs: { ListItem, InfrastructureIconAndName, - PackageIconAndName, }, propsData: { packageLink: 'foo', @@ -93,13 +90,13 @@ describe('packages_list_row', () => { it('shows the type when set', () => { mountComponent(); - expect(findPackageIconAndName().exists()).toBe(true); + expect(findInfrastructureIconAndName().exists()).toBe(true); }); it('does not show the type when not set', () => { mountComponent({ showPackageType: false }); - expect(findPackageIconAndName().exists()).toBe(false); + expect(findInfrastructureIconAndName().exists()).toBe(false); }); }); @@ -135,27 +132,6 @@ describe('packages_list_row', () => { }); }); - describe('Infrastructure config', () => { - it('defaults to package registry components', () => { - mountComponent(); - - expect(findPackageIconAndName().exists()).toBe(true); - expect(findInfrastructureIconAndName().exists()).toBe(false); - }); - - it('mounts different component based on the provided values', () => { - mountComponent({ - provide: { - iconComponent: 'InfrastructureIconAndName', - }, - }); - - expect(findPackageIconAndName().exists()).toBe(false); - - expect(findInfrastructureIconAndName().exists()).toBe(true); - }); - }); - describe(`when the package is in ${PACKAGE_ERROR_STATUS} status`, () => { beforeEach(() => { mountComponent({ packageEntity: { ...packageWithoutTags, status: PACKAGE_ERROR_STATUS } }); diff --git a/spec/frontend/packages_and_registries/package_registry/components/list/packages_list_spec.js b/spec/frontend/packages_and_registries/package_registry/components/list/packages_list_spec.js index de4e9c8ae5b..777c3b9ecc7 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/list/packages_list_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/list/packages_list_spec.js @@ -1,7 +1,7 @@ import { GlKeysetPagination, GlModal, GlSprintf } from '@gitlab/ui'; import { nextTick } from 'vue'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -import PackagesListRow from '~/packages/shared/components/package_list_row.vue'; +import PackagesListRow from '~/packages_and_registries/package_registry/components/list/package_list_row.vue'; import PackagesListLoader from '~/packages/shared/components/packages_list_loader.vue'; import { DELETE_PACKAGE_TRACKING_ACTION, diff --git a/spec/lib/api/entities/changelog_spec.rb b/spec/lib/api/entities/changelog_spec.rb new file mode 100644 index 00000000000..2cf585d4e0e --- /dev/null +++ b/spec/lib/api/entities/changelog_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe API::Entities::Changelog do + let(:changelog) { "This is a changelog" } + + subject { described_class.new(changelog).as_json } + + it 'exposes correct attributes' do + expect(subject).to include(:notes) + end + + it 'exposes correct notes' do + expect(subject[:notes]).to eq(changelog) + end +end diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb index f3146480be2..21a8622e08d 100644 --- a/spec/requests/api/repositories_spec.rb +++ b/spec/requests/api/repositories_spec.rb @@ -731,6 +731,71 @@ RSpec.describe API::Repositories do end end + describe 'GET /projects/:id/repository/changelog' do + it 'generates the changelog for a version' do + spy = instance_spy(Repositories::ChangelogService) + release_notes = 'Release notes' + + allow(Repositories::ChangelogService) + .to receive(:new) + .with( + project, + user, + version: '1.0.0', + from: 'foo', + to: 'bar', + date: DateTime.new(2020, 1, 1), + trailer: 'Foo' + ) + .and_return(spy) + + expect(spy).to receive(:execute).with(commit_to_changelog: false).and_return(release_notes) + + get( + api("/projects/#{project.id}/repository/changelog", user), + params: { + version: '1.0.0', + from: 'foo', + to: 'bar', + date: '2020-01-01', + trailer: 'Foo' + } + ) + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['notes']).to eq(release_notes) + end + + it 'supports leaving out the from and to attribute' do + spy = instance_spy(Repositories::ChangelogService) + + allow(Repositories::ChangelogService) + .to receive(:new) + .with( + project, + user, + version: '1.0.0', + date: DateTime.new(2020, 1, 1), + trailer: 'Foo' + ) + .and_return(spy) + + expect(spy).to receive(:execute).with(commit_to_changelog: false) + + get( + api("/projects/#{project.id}/repository/changelog", user), + params: { + version: '1.0.0', + date: '2020-01-01', + trailer: 'Foo' + } + ) + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['notes']).to be_present + end + end + describe 'POST /projects/:id/repository/changelog' do it 'generates the changelog for a version' do spy = instance_spy(Repositories::ChangelogService) @@ -751,7 +816,7 @@ RSpec.describe API::Repositories do ) .and_return(spy) - allow(spy).to receive(:execute) + allow(spy).to receive(:execute).with(commit_to_changelog: true) post( api("/projects/#{project.id}/repository/changelog", user), @@ -787,7 +852,7 @@ RSpec.describe API::Repositories do ) .and_return(spy) - expect(spy).to receive(:execute) + expect(spy).to receive(:execute).with(commit_to_changelog: true) post( api("/projects/#{project.id}/repository/changelog", user), diff --git a/spec/services/repositories/changelog_service_spec.rb b/spec/services/repositories/changelog_service_spec.rb index b547ae17317..ddb8e7e1182 100644 --- a/spec/services/repositories/changelog_service_spec.rb +++ b/spec/services/repositories/changelog_service_spec.rb @@ -61,6 +61,8 @@ RSpec.describe Repositories::ChangelogService do let!(:commit2) { project.commit(sha3) } let!(:commit3) { project.commit(sha4) } + let(:commit_to_changelog) { true } + it 'generates and commits a changelog section' do allow(MergeRequestDiffCommit) .to receive(:oldest_merge_request_id_per_commit) @@ -73,7 +75,7 @@ RSpec.describe Repositories::ChangelogService do service = described_class .new(project, creator, version: '1.0.0', from: sha1, to: sha3) - recorder = ActiveRecord::QueryRecorder.new { service.execute } + recorder = ActiveRecord::QueryRecorder.new { service.execute(commit_to_changelog: commit_to_changelog) } changelog = project.repository.blob_at('master', 'CHANGELOG.md')&.data expect(recorder.count).to eq(9) @@ -90,7 +92,7 @@ RSpec.describe Repositories::ChangelogService do described_class .new(project, creator, version: '1.0.0', from: sha1) - .execute + .execute(commit_to_changelog: commit_to_changelog) changelog = project.repository.blob_at('master', 'CHANGELOG.md')&.data @@ -108,7 +110,7 @@ RSpec.describe Repositories::ChangelogService do described_class .new(project, creator, version: '1.0.0', from: sha1) - .execute + .execute(commit_to_changelog: commit_to_changelog) changelog = project.repository.blob_at('master', 'CHANGELOG.md')&.data @@ -119,12 +121,33 @@ RSpec.describe Repositories::ChangelogService do it 'uses the target branch when "to" is unspecified' do described_class .new(project, creator, version: '1.0.0', from: sha1) - .execute + .execute(commit_to_changelog: commit_to_changelog) changelog = project.repository.blob_at('master', 'CHANGELOG.md')&.data expect(changelog).to include('Title 1', 'Title 2', 'Title 3') end + + describe 'with commit_to_changelog: false' do + let(:commit_to_changelog) { false } + + it 'generates changelog section' do + allow(MergeRequestDiffCommit) + .to receive(:oldest_merge_request_id_per_commit) + .with(project.id, [commit2.id, commit1.id]) + .and_return([ + { sha: sha2, merge_request_id: mr1.id }, + { sha: sha3, merge_request_id: mr2.id } + ]) + + service = described_class + .new(project, creator, version: '1.0.0', from: sha1, to: sha3) + + changelog = service.execute(commit_to_changelog: commit_to_changelog) + + expect(changelog).to include('Title 1', 'Title 2') + end + end end describe '#start_of_commit_range' do diff --git a/spec/services/service_ping/submit_service_ping_service_spec.rb b/spec/services/service_ping/submit_service_ping_service_spec.rb index d8672eec682..ca387690e83 100644 --- a/spec/services/service_ping/submit_service_ping_service_spec.rb +++ b/spec/services/service_ping/submit_service_ping_service_spec.rb @@ -322,6 +322,25 @@ RSpec.describe ServicePing::SubmitService do expect { subject.execute }.to raise_error(described_class::SubmissionError) end end + + context 'when skip_db_write passed to service' do + let(:subject) { ServicePing::SubmitService.new(skip_db_write: true) } + + before do + stub_response(body: with_dev_ops_score_params) + end + + it 'does not save RawUsageData' do + expect { subject.execute } + .not_to change { RawUsageData.count } + end + + it 'does not call DevOpsReport service' do + expect(ServicePing::DevopsReportService).not_to receive(:new) + + subject.execute + end + end end describe '#url' do