diff options
-rw-r--r-- | .gitlab/ci/graphql.gitlab-ci.yml | 2 | ||||
-rw-r--r-- | .gitlab/ci/rails.gitlab-ci.yml | 3 | ||||
-rw-r--r-- | .gitlab/ci/review-apps/qa.gitlab-ci.yml | 1 | ||||
-rw-r--r-- | app/assets/javascripts/graphql_shared/possibleTypes.json | 1 | ||||
-rw-r--r-- | app/assets/javascripts/graphql_shared/possible_types.json | 129 | ||||
-rw-r--r-- | app/assets/javascripts/lib/graphql.js | 2 | ||||
-rw-r--r-- | app/helpers/clusters_helper.rb | 25 | ||||
-rw-r--r-- | app/views/clusters/clusters/index.html.haml | 6 | ||||
-rw-r--r-- | doc/administration/file_hooks.md | 6 | ||||
-rw-r--r-- | doc/administration/index.md | 2 | ||||
-rw-r--r-- | doc/administration/system_hooks.md | 771 | ||||
-rw-r--r-- | doc/api/system_hooks.md | 2 | ||||
-rw-r--r-- | doc/integration/jenkins.md | 2 | ||||
-rw-r--r-- | doc/system_hooks/system_hooks.md | 774 | ||||
-rw-r--r-- | doc/user/admin_area/index.md | 2 | ||||
-rw-r--r-- | qa/qa/runtime/env.rb | 4 | ||||
-rw-r--r-- | qa/qa/specs/runner.rb | 3 | ||||
-rwxr-xr-x | scripts/frontend/graphql_possible_types_extraction.js | 69 | ||||
-rw-r--r-- | spec/frontend/__helpers__/mock_apollo_helper.js | 2 | ||||
-rw-r--r-- | spec/helpers/clusters_helper_spec.rb | 87 |
20 files changed, 1068 insertions, 825 deletions
diff --git a/.gitlab/ci/graphql.gitlab-ci.yml b/.gitlab/ci/graphql.gitlab-ci.yml index 1a05f68b178..c4c4d500fb5 100644 --- a/.gitlab/ci/graphql.gitlab-ci.yml +++ b/.gitlab/ci/graphql.gitlab-ci.yml @@ -11,3 +11,5 @@ graphql-verify: script: - bundle exec rake gitlab:graphql:validate - bundle exec rake gitlab:graphql:check_docs + - bundle exec rake gitlab:graphql:schema:dump + - node scripts/frontend/graphql_possible_types_extraction.js --check diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 5cf61bbc53f..1c745e6d986 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -373,9 +373,6 @@ db:migrate:reset: extends: .db-job-base script: - bundle exec rake db:migrate:reset - variables: - # FIXME: make this job work with `GITLAB_USE_MODEL_LOAD_BALANCING: true`, see https://gitlab.com/gitlab-org/gitlab/-/issues/355573 - GITLAB_USE_MODEL_LOAD_BALANCING: "false" db:migrate:reset single-db: extends: diff --git a/.gitlab/ci/review-apps/qa.gitlab-ci.yml b/.gitlab/ci/review-apps/qa.gitlab-ci.yml index d0234367e26..a955096992f 100644 --- a/.gitlab/ci/review-apps/qa.gitlab-ci.yml +++ b/.gitlab/ci/review-apps/qa.gitlab-ci.yml @@ -93,6 +93,7 @@ review-qa-all: variables: QA_RUN_TYPE: review-qa-all QA_SCENARIO: Test::Instance::All + QA_SKIP_SMOKE_RELIABLE: "true" review-performance: extends: diff --git a/app/assets/javascripts/graphql_shared/possibleTypes.json b/app/assets/javascripts/graphql_shared/possibleTypes.json deleted file mode 100644 index 01116067887..00000000000 --- a/app/assets/javascripts/graphql_shared/possibleTypes.json +++ /dev/null @@ -1 +0,0 @@ -{"AlertManagementIntegration":["AlertManagementHttpIntegration","AlertManagementPrometheusIntegration"],"CurrentUserTodos":["BoardEpic","Design","Epic","EpicIssue","Issue","MergeRequest"],"DependencyLinkMetadata":["NugetDependencyLinkMetadata"],"DesignFields":["Design","DesignAtVersion"],"Entry":["Blob","Submodule","TreeEntry"],"Eventable":["BoardEpic","Epic"],"Issuable":["Epic","Issue","MergeRequest","WorkItem"],"JobNeedUnion":["CiBuildNeed","CiJob"],"MemberInterface":["GroupMember","ProjectMember"],"NoteableInterface":["AlertManagementAlert","BoardEpic","Design","Epic","EpicIssue","Issue","MergeRequest","Snippet","Vulnerability"],"NoteableType":["Design","Issue","MergeRequest"],"OrchestrationPolicy":["ScanExecutionPolicy","ScanResultPolicy"],"PackageFileMetadata":["ConanFileMetadata","HelmFileMetadata"],"PackageMetadata":["ComposerMetadata","ConanMetadata","MavenMetadata","NugetMetadata","PypiMetadata"],"ResolvableInterface":["Discussion","Note"],"Service":["BaseService","JiraService"],"TimeboxReportInterface":["Iteration","Milestone"],"Todoable":["AlertManagementAlert","BoardEpic","Commit","Design","Epic","EpicIssue","Issue","MergeRequest"],"User":["MergeRequestAssignee","MergeRequestAuthor","MergeRequestParticipant","MergeRequestReviewer","UserCore"],"VulnerabilityDetail":["VulnerabilityDetailBase","VulnerabilityDetailBoolean","VulnerabilityDetailCode","VulnerabilityDetailCommit","VulnerabilityDetailDiff","VulnerabilityDetailFileLocation","VulnerabilityDetailInt","VulnerabilityDetailList","VulnerabilityDetailMarkdown","VulnerabilityDetailModuleLocation","VulnerabilityDetailTable","VulnerabilityDetailText","VulnerabilityDetailUrl"],"VulnerabilityLocation":["VulnerabilityLocationClusterImageScanning","VulnerabilityLocationContainerScanning","VulnerabilityLocationCoverageFuzzing","VulnerabilityLocationDast","VulnerabilityLocationDependencyScanning","VulnerabilityLocationGeneric","VulnerabilityLocationSast","VulnerabilityLocationSecretDetection"]}
\ No newline at end of file diff --git a/app/assets/javascripts/graphql_shared/possible_types.json b/app/assets/javascripts/graphql_shared/possible_types.json new file mode 100644 index 00000000000..3d6360fc4f8 --- /dev/null +++ b/app/assets/javascripts/graphql_shared/possible_types.json @@ -0,0 +1,129 @@ +{ + "AlertManagementIntegration": [ + "AlertManagementHttpIntegration", + "AlertManagementPrometheusIntegration" + ], + "CurrentUserTodos": [ + "BoardEpic", + "Design", + "Epic", + "EpicIssue", + "Issue", + "MergeRequest" + ], + "DependencyLinkMetadata": [ + "NugetDependencyLinkMetadata" + ], + "DesignFields": [ + "Design", + "DesignAtVersion" + ], + "Entry": [ + "Blob", + "Submodule", + "TreeEntry" + ], + "Eventable": [ + "BoardEpic", + "Epic" + ], + "Issuable": [ + "Epic", + "Issue", + "MergeRequest", + "WorkItem" + ], + "JobNeedUnion": [ + "CiBuildNeed", + "CiJob" + ], + "MemberInterface": [ + "GroupMember", + "ProjectMember" + ], + "NoteableInterface": [ + "AlertManagementAlert", + "BoardEpic", + "Design", + "Epic", + "EpicIssue", + "Issue", + "MergeRequest", + "Snippet", + "Vulnerability" + ], + "NoteableType": [ + "Design", + "Issue", + "MergeRequest" + ], + "OrchestrationPolicy": [ + "ScanExecutionPolicy", + "ScanResultPolicy" + ], + "PackageFileMetadata": [ + "ConanFileMetadata", + "HelmFileMetadata" + ], + "PackageMetadata": [ + "ComposerMetadata", + "ConanMetadata", + "MavenMetadata", + "NugetMetadata", + "PypiMetadata" + ], + "ResolvableInterface": [ + "Discussion", + "Note" + ], + "Service": [ + "BaseService", + "JiraService" + ], + "TimeboxReportInterface": [ + "Iteration", + "Milestone" + ], + "Todoable": [ + "AlertManagementAlert", + "BoardEpic", + "Commit", + "Design", + "Epic", + "EpicIssue", + "Issue", + "MergeRequest" + ], + "User": [ + "MergeRequestAssignee", + "MergeRequestAuthor", + "MergeRequestParticipant", + "MergeRequestReviewer", + "UserCore" + ], + "VulnerabilityDetail": [ + "VulnerabilityDetailBase", + "VulnerabilityDetailBoolean", + "VulnerabilityDetailCode", + "VulnerabilityDetailCommit", + "VulnerabilityDetailDiff", + "VulnerabilityDetailFileLocation", + "VulnerabilityDetailInt", + "VulnerabilityDetailList", + "VulnerabilityDetailMarkdown", + "VulnerabilityDetailModuleLocation", + "VulnerabilityDetailTable", + "VulnerabilityDetailText", + "VulnerabilityDetailUrl" + ], + "VulnerabilityLocation": [ + "VulnerabilityLocationClusterImageScanning", + "VulnerabilityLocationContainerScanning", + "VulnerabilityLocationCoverageFuzzing", + "VulnerabilityLocationDast", + "VulnerabilityLocationDependencyScanning", + "VulnerabilityLocationGeneric", + "VulnerabilityLocationSast", + "VulnerabilityLocationSecretDetection" + ] +} diff --git a/app/assets/javascripts/lib/graphql.js b/app/assets/javascripts/lib/graphql.js index f533ba3671c..b0eafc2668e 100644 --- a/app/assets/javascripts/lib/graphql.js +++ b/app/assets/javascripts/lib/graphql.js @@ -3,7 +3,7 @@ import { BatchHttpLink } from '@apollo/client/link/batch-http'; import { createUploadLink } from 'apollo-upload-client'; import ActionCableLink from '~/actioncable_link'; import { apolloCaptchaLink } from '~/captcha/apollo_captcha_link'; -import possibleTypes from '~/graphql_shared/possibleTypes.json'; +import possibleTypes from '~/graphql_shared/possible_types.json'; import { StartupJSLink } from '~/lib/utils/apollo_startup_js_link'; import csrf from '~/lib/utils/csrf'; import { objectToQuery, queryToObject } from '~/lib/utils/url_utility'; diff --git a/app/helpers/clusters_helper.rb b/app/helpers/clusters_helper.rb index 5d0dbcb1217..959dac1254e 100644 --- a/app/helpers/clusters_helper.rb +++ b/app/helpers/clusters_helper.rb @@ -15,24 +15,19 @@ module ClustersHelper gcp: { path: image_path('illustrations/logos/google_gke.svg'), text: s_('ClusterIntegration|Google GKE') } }, clusters_empty_state_image: image_path('illustrations/empty-state/empty-state-clusters.svg'), + empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg'), empty_state_help_text: clusterable.empty_state_help_text, new_cluster_path: clusterable.new_path, add_cluster_path: clusterable.connect_path, can_add_cluster: clusterable.can_add_cluster?.to_s, can_admin_cluster: clusterable.can_admin_cluster?.to_s, display_cluster_agents: display_cluster_agents?(clusterable).to_s, - certificate_based_clusters_enabled: Feature.enabled?(:certificate_based_clusters, clusterable, default_enabled: :yaml, type: :ops).to_s - } - end - - def js_clusters_data(clusterable) - { - default_branch_name: clusterable.default_branch, - empty_state_image: image_path('illustrations/empty-state/empty-state-agents.svg'), - project_path: clusterable.full_path, + certificate_based_clusters_enabled: Feature.enabled?(:certificate_based_clusters, clusterable, default_enabled: :yaml, type: :ops).to_s, + default_branch_name: default_branch_name(clusterable), + project_path: clusterable_project_path(clusterable), kas_address: Gitlab::Kas.external_url, gitlab_version: Gitlab.version_info - }.merge(js_clusters_list_data(clusterable)) + } end def js_cluster_form_data(cluster, can_edit) @@ -113,4 +108,14 @@ module ClustersHelper def can_admin_cluster?(user, cluster) can?(user, :admin_cluster, cluster) end + + private + + def default_branch_name(clusterable) + clusterable.default_branch if clusterable.is_a?(Project) + end + + def clusterable_project_path(clusterable) + clusterable.full_path if clusterable.is_a?(Project) + end end diff --git a/app/views/clusters/clusters/index.html.haml b/app/views/clusters/clusters/index.html.haml index eec44945a77..abe9cc9f27d 100644 --- a/app/views/clusters/clusters/index.html.haml +++ b/app/views/clusters/clusters/index.html.haml @@ -4,9 +4,5 @@ = render_gcp_signup_offer .clusters-container - - if display_cluster_agents?(clusterable) - .gl-my-6 - .js-clusters-main-view{ data: js_clusters_data(clusterable) } - - - else + .gl-my-6 .js-clusters-main-view{ data: js_clusters_list_data(clusterable) } diff --git a/doc/administration/file_hooks.md b/doc/administration/file_hooks.md index e041f1e11c6..4ddca58c774 100644 --- a/doc/administration/file_hooks.md +++ b/doc/administration/file_hooks.md @@ -15,12 +15,12 @@ without modifying the GitLab source code. A file hook runs on each event. You can filter events or projects in a file hook's code, and create many file hooks as you need. Each file hook is triggered by GitLab asynchronously in case of an event. For a list of events -see the [system hooks](../system_hooks/system_hooks.md) documentation. +see the [system hooks](system_hooks.md) documentation. NOTE: File hooks must be configured on the file system of the GitLab server. Only GitLab server administrators can complete these tasks. Explore -[system hooks](../system_hooks/system_hooks.md) or [webhooks](../user/project/integrations/webhooks.md) +[system hooks](system_hooks.md) or [webhooks](../user/project/integrations/webhooks.md) as an option if you do not have file system access. Instead of writing and supporting your own file hook, you can also make changes @@ -52,7 +52,7 @@ Follow the steps below to set up a custom hook: language type. For example, if the script is in Ruby the shebang will probably be `#!/usr/bin/env ruby`. 1. The data to the file hook is provided as JSON on STDIN. It is exactly the - same as for [system hooks](../system_hooks/system_hooks.md). + same as for [system hooks](system_hooks.md). That's it! Assuming the file hook code is properly implemented, the hook fires as appropriate. The file hooks file list is updated for each event, there is no diff --git a/doc/administration/index.md b/doc/administration/index.md index 50dc2bc905a..5b8de40e490 100644 --- a/doc/administration/index.md +++ b/doc/administration/index.md @@ -40,7 +40,7 @@ Learn how to install, configure, update, and maintain your GitLab instance. ### Configuring GitLab - [Adjust your instance's time zone](timezone.md): Customize the default time zone of GitLab. -- [System hooks](../system_hooks/system_hooks.md): Notifications when users, projects and keys are changed. +- [System hooks](system_hooks.md): Notifications when users, projects and keys are changed. - [Security](../security/index.md): Learn what you can do to further secure your GitLab instance. - [Usage statistics, version check, and Service Ping](../user/admin_area/settings/usage_statistics.md): Enable or disable information about your instance to be sent to GitLab, Inc. - [Global user settings](user_settings.md): Configure instance-wide user permissions. diff --git a/doc/administration/system_hooks.md b/doc/administration/system_hooks.md new file mode 100644 index 00000000000..71d7e7f1426 --- /dev/null +++ b/doc/administration/system_hooks.md @@ -0,0 +1,771 @@ +--- +stage: Ecosystem +group: Integrations +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments +type: reference +--- + +# System hooks **(FREE SELF)** + +Your GitLab instance can perform HTTP POST requests on the following events: + +- `group_create` +- `group_destroy` +- `group_rename` +- `key_create` +- `key_destroy` +- `project_create` +- `project_destroy` +- `project_rename` +- `project_transfer` +- `project_update` +- `repository_update` +- `user_add_to_group` +- `user_add_to_team` +- `user_create` +- `user_destroy` +- `user_failed_login` +- `user_remove_from_group` +- `user_remove_from_team` +- `user_rename` +- `user_update_for_group` +- `user_update_for_team` + +The triggers for most of these are self-explanatory, but `project_update` and +`project_rename` deserve some clarification: `project_update` is fired any time +an attribute of a project is changed (including name, description, and tags) +_unless_ the `path` attribute is also changed. In that case, a `project_rename` +is triggered instead (so that, for instance, if all you care about is the +repository URL, you can just listen for `project_rename`). + +`user_failed_login` is sent whenever a _blocked_ user attempts to sign in and is +denied access. + +System hooks can be used, for example, for logging or changing information in an +LDAP server. + +In addition to these default events, you can enable triggers for other events, +such as push events, and disable the `repository_update` event +when you create a system hook. + +NOTE: +We follow the same structure and deprecations as [Webhooks](../user/project/integrations/webhooks.md) +for Push and Tag events, but we never display commits. + +## Create a system hook + +To create a system hook: + +1. On the top bar, select **Menu > Admin**. +1. On the left sidebar, select **System Hooks**. +1. Provide the **URL** and **Secret Token**. +1. Select the checkbox next to each optional **Trigger** you want to enable. +1. Select **Enable SSL verification**, if desired. +1. Click **Add system hook**. + +## Hooks request example + +**Request header**: + +```plaintext +X-Gitlab-Event: System Hook +``` + +**Project created:** + +```json +{ + "created_at": "2012-07-21T07:30:54Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "project_create", + "name": "StoreCloud", + "owner_email": "johnsmith@example.com", + "owner_name": "John Smith", + "owners": [{ + "name": "John", + "email": "user1@example.com" + }], + "path": "storecloud", + "path_with_namespace": "jsmith/storecloud", + "project_id": 74, + "project_visibility": "private" +} +``` + +**Project destroyed:** + +```json +{ + "created_at": "2012-07-21T07:30:58Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "project_destroy", + "name": "Underscore", + "owner_email": "johnsmith@example.com", + "owner_name": "John Smith", + "owners": [{ + "name": "John", + "email": "user1@example.com" + }], + "path": "underscore", + "path_with_namespace": "jsmith/underscore", + "project_id": 73, + "project_visibility": "internal" +} +``` + +**Project renamed:** + +```json +{ + "created_at": "2012-07-21T07:30:58Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "project_rename", + "name": "Underscore", + "path": "underscore", + "path_with_namespace": "jsmith/underscore", + "project_id": 73, + "owner_name": "John Smith", + "owner_email": "johnsmith@example.com", + "owners": [{ + "name": "John", + "email": "user1@example.com" + }], + "project_visibility": "internal", + "old_path_with_namespace": "jsmith/overscore" +} +``` + +Note that `project_rename` is not triggered if the namespace changes. +Please refer to `group_rename` and `user_rename` for that case. + +**Project transferred:** + +```json +{ + "created_at": "2012-07-21T07:30:58Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "project_transfer", + "name": "Underscore", + "path": "underscore", + "path_with_namespace": "scores/underscore", + "project_id": 73, + "owner_name": "John Smith", + "owner_email": "johnsmith@example.com", + "owners": [{ + "name": "John", + "email": "user1@example.com" + }], + "project_visibility": "internal", + "old_path_with_namespace": "jsmith/overscore" +} +``` + +**Project updated:** + +```json +{ + "created_at": "2012-07-21T07:30:54Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "project_update", + "name": "StoreCloud", + "owner_email": "johnsmith@example.com", + "owner_name": "John Smith", + "owners": [{ + "name": "John", + "email": "user1@example.com" + }], + "path": "storecloud", + "path_with_namespace": "jsmith/storecloud", + "project_id": 74, + "project_visibility": "private" +} +``` + +**New Team Member:** + +```json +{ + "created_at": "2012-07-21T07:30:56Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "user_add_to_team", + "access_level": "Maintainer", + "project_id": 74, + "project_name": "StoreCloud", + "project_path": "storecloud", + "project_path_with_namespace": "jsmith/storecloud", + "user_email": "johnsmith@example.com", + "user_name": "John Smith", + "user_username": "johnsmith", + "user_id": 41, + "project_visibility": "private" +} +``` + +**Team Member Removed:** + +```json +{ + "created_at": "2012-07-21T07:30:56Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "user_remove_from_team", + "access_level": "Maintainer", + "project_id": 74, + "project_name": "StoreCloud", + "project_path": "storecloud", + "project_path_with_namespace": "jsmith/storecloud", + "user_email": "johnsmith@example.com", + "user_name": "John Smith", + "user_username": "johnsmith", + "user_id": 41, + "project_visibility": "private" +} +``` + +**Team Member Updated:** + +```json +{ + "created_at": "2012-07-21T07:30:56Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "user_update_for_team", + "access_level": "Maintainer", + "project_id": 74, + "project_name": "StoreCloud", + "project_path": "storecloud", + "project_path_with_namespace": "jsmith/storecloud", + "user_email": "johnsmith@example.com", + "user_name": "John Smith", + "user_username": "johnsmith", + "user_id": 41, + "project_visibility": "private" +} +``` + +**User created:** + +```json +{ + "created_at": "2012-07-21T07:44:07Z", + "updated_at": "2012-07-21T07:38:22Z", + "email": "js@gitlabhq.com", + "event_name": "user_create", + "name": "John Smith", + "username": "js", + "user_id": 41 +} +``` + +**User removed:** + +```json +{ + "created_at": "2012-07-21T07:44:07Z", + "updated_at": "2012-07-21T07:38:22Z", + "email": "js@gitlabhq.com", + "event_name": "user_destroy", + "name": "John Smith", + "username": "js", + "user_id": 41 +} +``` + +**User failed login:** + +```json +{ + "event_name": "user_failed_login", + "created_at": "2017-10-03T06:08:48Z", + "updated_at": "2018-01-15T04:52:06Z", + "name": "John Smith", + "email": "user4@example.com", + "user_id": 26, + "username": "user4", + "state": "blocked" +} +``` + +If the user is blocked via LDAP, `state` is `ldap_blocked`. + +**User renamed:** + +```json +{ + "event_name": "user_rename", + "created_at": "2017-11-01T11:21:04Z", + "updated_at": "2017-11-01T14:04:47Z", + "name": "new-name", + "email": "best-email@example.tld", + "user_id": 58, + "username": "new-exciting-name", + "old_username": "old-boring-name" +} +``` + +**Key added** + +```json +{ + "event_name": "key_create", + "created_at": "2014-08-18 18:45:16 UTC", + "updated_at": "2012-07-21T07:38:22Z", + "username": "root", + "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC58FwqHUbebw2SdT7SP4FxZ0w+lAO/erhy2ylhlcW/tZ3GY3mBu9VeeiSGoGz8hCx80Zrz+aQv28xfFfKlC8XQFpCWwsnWnQqO2Lv9bS8V1fIHgMxOHIt5Vs+9CAWGCCvUOAurjsUDoE2ALIXLDMKnJxcxD13XjWdK54j6ZXDB4syLF0C2PnAQSVY9X7MfCYwtuFmhQhKaBussAXpaVMRHltie3UYSBUUuZaB3J4cg/7TxlmxcNd+ppPRIpSZAB0NI6aOnqoBCpimscO/VpQRJMVLr3XiSYeT6HBiDXWHnIVPfQc03OGcaFqOit6p8lYKMaP/iUQLm+pgpZqrXZ9vB john@localhost", + "id": 4 +} +``` + +**Key removed** + +```json +{ + "event_name": "key_destroy", + "created_at": "2014-08-18 18:45:16 UTC", + "updated_at": "2012-07-21T07:38:22Z", + "username": "root", + "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC58FwqHUbebw2SdT7SP4FxZ0w+lAO/erhy2ylhlcW/tZ3GY3mBu9VeeiSGoGz8hCx80Zrz+aQv28xfFfKlC8XQFpCWwsnWnQqO2Lv9bS8V1fIHgMxOHIt5Vs+9CAWGCCvUOAurjsUDoE2ALIXLDMKnJxcxD13XjWdK54j6ZXDB4syLF0C2PnAQSVY9X7MfCYwtuFmhQhKaBussAXpaVMRHltie3UYSBUUuZaB3J4cg/7TxlmxcNd+ppPRIpSZAB0NI6aOnqoBCpimscO/VpQRJMVLr3XiSYeT6HBiDXWHnIVPfQc03OGcaFqOit6p8lYKMaP/iUQLm+pgpZqrXZ9vB john@localhost", + "id": 4 +} +``` + +**Group created:** + +```json +{ + "created_at": "2012-07-21T07:30:54Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "group_create", + "name": "StoreCloud", + "path": "storecloud", + "group_id": 78 +} +``` + +**Group removed:** + +```json +{ + "created_at": "2012-07-21T07:30:54Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "group_destroy", + "name": "StoreCloud", + "path": "storecloud", + "group_id": 78 +} +``` + +**Group renamed:** + +```json +{ + "event_name": "group_rename", + "created_at": "2017-10-30T15:09:00Z", + "updated_at": "2017-11-01T10:23:52Z", + "name": "Better Name", + "path": "better-name", + "full_path": "parent-group/better-name", + "group_id": 64, + "old_path": "old-name", + "old_full_path": "parent-group/old-name" +} +``` + +**New Group Member:** + +```json +{ + "created_at": "2012-07-21T07:30:56Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "user_add_to_group", + "group_access": "Maintainer", + "group_id": 78, + "group_name": "StoreCloud", + "group_path": "storecloud", + "user_email": "johnsmith@example.com", + "user_name": "John Smith", + "user_username": "johnsmith", + "user_id": 41 +} +``` + +**Group Member Removed:** + +```json +{ + "created_at": "2012-07-21T07:30:56Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "user_remove_from_group", + "group_access": "Maintainer", + "group_id": 78, + "group_name": "StoreCloud", + "group_path": "storecloud", + "user_email": "johnsmith@example.com", + "user_name": "John Smith", + "user_username": "johnsmith", + "user_id": 41 +} +``` + +**Group Member Updated:** + +```json +{ + "created_at": "2012-07-21T07:30:56Z", + "updated_at": "2012-07-21T07:38:22Z", + "event_name": "user_update_for_group", + "group_access": "Maintainer", + "group_id": 78, + "group_name": "StoreCloud", + "group_path": "storecloud", + "user_email": "johnsmith@example.com", + "user_name": "John Smith", + "user_username": "johnsmith", + "user_id": 41 +} +``` + +## Push events + +Triggered when you push to the repository, except when pushing tags. +It generates one event per modified branch. + +**Request header**: + +```plaintext +X-Gitlab-Event: System Hook +``` + +**Request body:** + +```json +{ + "event_name": "push", + "before": "95790bf891e76fee5e1747ab589903a6a1f80f22", + "after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "ref": "refs/heads/master", + "checkout_sha": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "user_id": 4, + "user_name": "John Smith", + "user_email": "john@example.com", + "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", + "project_id": 15, + "project":{ + "name":"Diaspora", + "description":"", + "web_url":"http://example.com/mike/diaspora", + "avatar_url":null, + "git_ssh_url":"git@example.com:mike/diaspora.git", + "git_http_url":"http://example.com/mike/diaspora.git", + "namespace":"Mike", + "visibility_level":0, + "path_with_namespace":"mike/diaspora", + "default_branch":"master", + "homepage":"http://example.com/mike/diaspora", + "url":"git@example.com:mike/diaspora.git", + "ssh_url":"git@example.com:mike/diaspora.git", + "http_url":"http://example.com/mike/diaspora.git" + }, + "repository":{ + "name": "Diaspora", + "url": "git@example.com:mike/diaspora.git", + "description": "", + "homepage": "http://example.com/mike/diaspora", + "git_http_url":"http://example.com/mike/diaspora.git", + "git_ssh_url":"git@example.com:mike/diaspora.git", + "visibility_level":0 + }, + "commits": [ + { + "id": "c5feabde2d8cd023215af4d2ceeb7a64839fc428", + "message": "Add simple search to projects in public area", + "timestamp": "2013-05-13T18:18:08+00:00", + "url": "https://dev.gitlab.org/gitlab/gitlabhq/commit/c5feabde2d8cd023215af4d2ceeb7a64839fc428", + "author": { + "name": "Example User", + "email": "user@example.com" + } + } + ], + "total_commits_count": 1 +} +``` + +## Tag events + +Triggered when you create (or delete) tags to the repository. +It generates one event per modified tag. + +**Request header**: + +```plaintext +X-Gitlab-Event: System Hook +``` + +**Request body:** + +```json +{ + "event_name": "tag_push", + "before": "0000000000000000000000000000000000000000", + "after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7", + "ref": "refs/tags/v1.0.0", + "checkout_sha": "5937ac0a7beb003549fc5fd26fc247adbce4a52e", + "user_id": 1, + "user_name": "John Smith", + "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", + "project_id": 1, + "project":{ + "name":"Example", + "description":"", + "web_url":"http://example.com/jsmith/example", + "avatar_url":null, + "git_ssh_url":"git@example.com:jsmith/example.git", + "git_http_url":"http://example.com/jsmith/example.git", + "namespace":"Jsmith", + "visibility_level":0, + "path_with_namespace":"jsmith/example", + "default_branch":"master", + "homepage":"http://example.com/jsmith/example", + "url":"git@example.com:jsmith/example.git", + "ssh_url":"git@example.com:jsmith/example.git", + "http_url":"http://example.com/jsmith/example.git" + }, + "repository":{ + "name": "Example", + "url": "ssh://git@example.com/jsmith/example.git", + "description": "", + "homepage": "http://example.com/jsmith/example", + "git_http_url":"http://example.com/jsmith/example.git", + "git_ssh_url":"git@example.com:jsmith/example.git", + "visibility_level":0 + }, + "commits": [], + "total_commits_count": 0 +} +``` + +## Merge request events + +Triggered when a new merge request is created, an existing merge request was +updated/merged/closed or a commit is added in the source branch. + +**Request header**: + +```plaintext +X-Gitlab-Event: System Hook +``` + +```json +{ + "object_kind": "merge_request", + "event_type": "merge_request", + "user": { + "id": 1, + "name": "Administrator", + "username": "root", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", + "email": "admin@example.com" + }, + "project": { + "id": 1, + "name":"Gitlab Test", + "description":"Aut reprehenderit ut est.", + "web_url":"http://example.com/gitlabhq/gitlab-test", + "avatar_url":null, + "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", + "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", + "namespace":"GitlabHQ", + "visibility_level":20, + "path_with_namespace":"gitlabhq/gitlab-test", + "default_branch":"master", + "homepage":"http://example.com/gitlabhq/gitlab-test", + "url":"http://example.com/gitlabhq/gitlab-test.git", + "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", + "http_url":"http://example.com/gitlabhq/gitlab-test.git" + }, + "repository": { + "name": "Gitlab Test", + "url": "http://example.com/gitlabhq/gitlab-test.git", + "description": "Aut reprehenderit ut est.", + "homepage": "http://example.com/gitlabhq/gitlab-test" + }, + "object_attributes": { + "id": 99, + "target_branch": "master", + "source_branch": "ms-viewport", + "source_project_id": 14, + "author_id": 51, + "assignee_id": 6, + "title": "MS-Viewport", + "created_at": "2013-12-03T17:23:34Z", + "updated_at": "2013-12-03T17:23:34Z", + "milestone_id": null, + "state": "opened", + "merge_status": "unchecked", + "target_project_id": 14, + "iid": 1, + "description": "", + "source": { + "name":"Awesome Project", + "description":"Aut reprehenderit ut est.", + "web_url":"http://example.com/awesome_space/awesome_project", + "avatar_url":null, + "git_ssh_url":"git@example.com:awesome_space/awesome_project.git", + "git_http_url":"http://example.com/awesome_space/awesome_project.git", + "namespace":"Awesome Space", + "visibility_level":20, + "path_with_namespace":"awesome_space/awesome_project", + "default_branch":"master", + "homepage":"http://example.com/awesome_space/awesome_project", + "url":"http://example.com/awesome_space/awesome_project.git", + "ssh_url":"git@example.com:awesome_space/awesome_project.git", + "http_url":"http://example.com/awesome_space/awesome_project.git" + }, + "target": { + "name":"Awesome Project", + "description":"Aut reprehenderit ut est.", + "web_url":"http://example.com/awesome_space/awesome_project", + "avatar_url":null, + "git_ssh_url":"git@example.com:awesome_space/awesome_project.git", + "git_http_url":"http://example.com/awesome_space/awesome_project.git", + "namespace":"Awesome Space", + "visibility_level":20, + "path_with_namespace":"awesome_space/awesome_project", + "default_branch":"master", + "homepage":"http://example.com/awesome_space/awesome_project", + "url":"http://example.com/awesome_space/awesome_project.git", + "ssh_url":"git@example.com:awesome_space/awesome_project.git", + "http_url":"http://example.com/awesome_space/awesome_project.git" + }, + "last_commit": { + "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "message": "fixed readme", + "timestamp": "2012-01-03T23:36:29+02:00", + "url": "http://example.com/awesome_space/awesome_project/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "author": { + "name": "GitLab dev user", + "email": "gitlabdev@dv6700.(none)" + } + }, + "work_in_progress": false, + "url": "http://example.com/diaspora/merge_requests/1", + "action": "open", + "assignee": { + "name": "User1", + "username": "user1", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" + } + }, + "labels": [{ + "id": 206, + "title": "API", + "color": "#ffffff", + "project_id": 14, + "created_at": "2013-12-03T17:15:43Z", + "updated_at": "2013-12-03T17:15:43Z", + "template": false, + "description": "API related issues", + "type": "ProjectLabel", + "group_id": 41 + }], + "changes": { + "updated_by_id": { + "previous": null, + "current": 1 + }, + "updated_at": { + "previous": "2017-09-15 16:50:55 UTC", + "current":"2017-09-15 16:52:00 UTC" + }, + "labels": { + "previous": [{ + "id": 206, + "title": "API", + "color": "#ffffff", + "project_id": 14, + "created_at": "2013-12-03T17:15:43Z", + "updated_at": "2013-12-03T17:15:43Z", + "template": false, + "description": "API related issues", + "type": "ProjectLabel", + "group_id": 41 + }], + "current": [{ + "id": 205, + "title": "Platform", + "color": "#123123", + "project_id": 14, + "created_at": "2013-12-03T17:15:43Z", + "updated_at": "2013-12-03T17:15:43Z", + "template": false, + "description": "Platform related issues", + "type": "ProjectLabel", + "group_id": 41 + }] + } + } +} +``` + +## Repository Update events + +Triggered only once when you push to the repository (including tags). + +**Request header**: + +```plaintext +X-Gitlab-Event: System Hook +``` + +**Request body:** + +```json +{ + "event_name": "repository_update", + "user_id": 1, + "user_name": "John Smith", + "user_email": "admin@example.com", + "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", + "project_id": 1, + "project": { + "name":"Example", + "description":"", + "web_url":"http://example.com/jsmith/example", + "avatar_url":null, + "git_ssh_url":"git@example.com:jsmith/example.git", + "git_http_url":"http://example.com/jsmith/example.git", + "namespace":"Jsmith", + "visibility_level":0, + "path_with_namespace":"jsmith/example", + "default_branch":"master", + "homepage":"http://example.com/jsmith/example", + "url":"git@example.com:jsmith/example.git", + "ssh_url":"git@example.com:jsmith/example.git", + "http_url":"http://example.com/jsmith/example.git" + }, + "changes": [ + { + "before":"8205ea8d81ce0c6b90fbe8280d118cc9fdad6130", + "after":"4045ea7a3df38697b3730a20fb73c8bed8a3e69e", + "ref":"refs/heads/master" + } + ], + "refs":["refs/heads/master"] +} +``` + +## Local requests in system hooks + +[Requests to local network by system hooks](../security/webhooks.md) can be allowed +or blocked by an administrator. + +<!-- ## Troubleshooting + +Include any troubleshooting steps that you can foresee. If you know beforehand what issues +one might have when setting this up, or when something is changed, or on upgrading, it's +important to describe those, too. Think of things that may go wrong and include them here. +This is important to minimize requests for support, and to avoid doc comments with +questions that you know someone might ask. + +Each scenario can be a third-level heading, e.g. `### Getting error message X`. +If you have none to add when creating a doc, leave this section in place +but commented out to help encourage others to add to it in the future. --> diff --git a/doc/api/system_hooks.md b/doc/api/system_hooks.md index f14f1322184..a883c3c1613 100644 --- a/doc/api/system_hooks.md +++ b/doc/api/system_hooks.md @@ -13,7 +13,7 @@ You can configure the URL endpoint of the system hooks from the GitLab user inte 1. On the top bar, select **Menu > Admin**. 1. Select **System Hooks** (`/admin/hooks`). -Read more about [system hooks](../system_hooks/system_hooks.md). +Read more about [system hooks](../administration/system_hooks.md). ## List system hooks diff --git a/doc/integration/jenkins.md b/doc/integration/jenkins.md index 8b0850ebc4d..54d235b5357 100644 --- a/doc/integration/jenkins.md +++ b/doc/integration/jenkins.md @@ -242,7 +242,7 @@ To enable job logs in Jenkins: 1. Go to **Dashboard > Manage Jenkins > System Log**. 1. Select **Add new log recorder**. 1. Enter a name for the log recorder. -1. On the next screen, select **Add** and enter `org.jenkinsci.plugins.workflow.job`. +1. On the next screen, select **Add** and enter `com.dabsquared.gitlabjenkins`. 1. Make sure that the Log Level is **All** and select **Save**. To view your logs: diff --git a/doc/system_hooks/system_hooks.md b/doc/system_hooks/system_hooks.md index 71d7e7f1426..c30e2703a29 100644 --- a/doc/system_hooks/system_hooks.md +++ b/doc/system_hooks/system_hooks.md @@ -1,771 +1,11 @@ --- -stage: Ecosystem -group: Integrations -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments -type: reference +redirect_to: '../administration/system_hooks.md' +remove_date: '2022-06-18' --- -# System hooks **(FREE SELF)** +This document was moved to [another location](../administration/system_hooks.md). -Your GitLab instance can perform HTTP POST requests on the following events: - -- `group_create` -- `group_destroy` -- `group_rename` -- `key_create` -- `key_destroy` -- `project_create` -- `project_destroy` -- `project_rename` -- `project_transfer` -- `project_update` -- `repository_update` -- `user_add_to_group` -- `user_add_to_team` -- `user_create` -- `user_destroy` -- `user_failed_login` -- `user_remove_from_group` -- `user_remove_from_team` -- `user_rename` -- `user_update_for_group` -- `user_update_for_team` - -The triggers for most of these are self-explanatory, but `project_update` and -`project_rename` deserve some clarification: `project_update` is fired any time -an attribute of a project is changed (including name, description, and tags) -_unless_ the `path` attribute is also changed. In that case, a `project_rename` -is triggered instead (so that, for instance, if all you care about is the -repository URL, you can just listen for `project_rename`). - -`user_failed_login` is sent whenever a _blocked_ user attempts to sign in and is -denied access. - -System hooks can be used, for example, for logging or changing information in an -LDAP server. - -In addition to these default events, you can enable triggers for other events, -such as push events, and disable the `repository_update` event -when you create a system hook. - -NOTE: -We follow the same structure and deprecations as [Webhooks](../user/project/integrations/webhooks.md) -for Push and Tag events, but we never display commits. - -## Create a system hook - -To create a system hook: - -1. On the top bar, select **Menu > Admin**. -1. On the left sidebar, select **System Hooks**. -1. Provide the **URL** and **Secret Token**. -1. Select the checkbox next to each optional **Trigger** you want to enable. -1. Select **Enable SSL verification**, if desired. -1. Click **Add system hook**. - -## Hooks request example - -**Request header**: - -```plaintext -X-Gitlab-Event: System Hook -``` - -**Project created:** - -```json -{ - "created_at": "2012-07-21T07:30:54Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "project_create", - "name": "StoreCloud", - "owner_email": "johnsmith@example.com", - "owner_name": "John Smith", - "owners": [{ - "name": "John", - "email": "user1@example.com" - }], - "path": "storecloud", - "path_with_namespace": "jsmith/storecloud", - "project_id": 74, - "project_visibility": "private" -} -``` - -**Project destroyed:** - -```json -{ - "created_at": "2012-07-21T07:30:58Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "project_destroy", - "name": "Underscore", - "owner_email": "johnsmith@example.com", - "owner_name": "John Smith", - "owners": [{ - "name": "John", - "email": "user1@example.com" - }], - "path": "underscore", - "path_with_namespace": "jsmith/underscore", - "project_id": 73, - "project_visibility": "internal" -} -``` - -**Project renamed:** - -```json -{ - "created_at": "2012-07-21T07:30:58Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "project_rename", - "name": "Underscore", - "path": "underscore", - "path_with_namespace": "jsmith/underscore", - "project_id": 73, - "owner_name": "John Smith", - "owner_email": "johnsmith@example.com", - "owners": [{ - "name": "John", - "email": "user1@example.com" - }], - "project_visibility": "internal", - "old_path_with_namespace": "jsmith/overscore" -} -``` - -Note that `project_rename` is not triggered if the namespace changes. -Please refer to `group_rename` and `user_rename` for that case. - -**Project transferred:** - -```json -{ - "created_at": "2012-07-21T07:30:58Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "project_transfer", - "name": "Underscore", - "path": "underscore", - "path_with_namespace": "scores/underscore", - "project_id": 73, - "owner_name": "John Smith", - "owner_email": "johnsmith@example.com", - "owners": [{ - "name": "John", - "email": "user1@example.com" - }], - "project_visibility": "internal", - "old_path_with_namespace": "jsmith/overscore" -} -``` - -**Project updated:** - -```json -{ - "created_at": "2012-07-21T07:30:54Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "project_update", - "name": "StoreCloud", - "owner_email": "johnsmith@example.com", - "owner_name": "John Smith", - "owners": [{ - "name": "John", - "email": "user1@example.com" - }], - "path": "storecloud", - "path_with_namespace": "jsmith/storecloud", - "project_id": 74, - "project_visibility": "private" -} -``` - -**New Team Member:** - -```json -{ - "created_at": "2012-07-21T07:30:56Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "user_add_to_team", - "access_level": "Maintainer", - "project_id": 74, - "project_name": "StoreCloud", - "project_path": "storecloud", - "project_path_with_namespace": "jsmith/storecloud", - "user_email": "johnsmith@example.com", - "user_name": "John Smith", - "user_username": "johnsmith", - "user_id": 41, - "project_visibility": "private" -} -``` - -**Team Member Removed:** - -```json -{ - "created_at": "2012-07-21T07:30:56Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "user_remove_from_team", - "access_level": "Maintainer", - "project_id": 74, - "project_name": "StoreCloud", - "project_path": "storecloud", - "project_path_with_namespace": "jsmith/storecloud", - "user_email": "johnsmith@example.com", - "user_name": "John Smith", - "user_username": "johnsmith", - "user_id": 41, - "project_visibility": "private" -} -``` - -**Team Member Updated:** - -```json -{ - "created_at": "2012-07-21T07:30:56Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "user_update_for_team", - "access_level": "Maintainer", - "project_id": 74, - "project_name": "StoreCloud", - "project_path": "storecloud", - "project_path_with_namespace": "jsmith/storecloud", - "user_email": "johnsmith@example.com", - "user_name": "John Smith", - "user_username": "johnsmith", - "user_id": 41, - "project_visibility": "private" -} -``` - -**User created:** - -```json -{ - "created_at": "2012-07-21T07:44:07Z", - "updated_at": "2012-07-21T07:38:22Z", - "email": "js@gitlabhq.com", - "event_name": "user_create", - "name": "John Smith", - "username": "js", - "user_id": 41 -} -``` - -**User removed:** - -```json -{ - "created_at": "2012-07-21T07:44:07Z", - "updated_at": "2012-07-21T07:38:22Z", - "email": "js@gitlabhq.com", - "event_name": "user_destroy", - "name": "John Smith", - "username": "js", - "user_id": 41 -} -``` - -**User failed login:** - -```json -{ - "event_name": "user_failed_login", - "created_at": "2017-10-03T06:08:48Z", - "updated_at": "2018-01-15T04:52:06Z", - "name": "John Smith", - "email": "user4@example.com", - "user_id": 26, - "username": "user4", - "state": "blocked" -} -``` - -If the user is blocked via LDAP, `state` is `ldap_blocked`. - -**User renamed:** - -```json -{ - "event_name": "user_rename", - "created_at": "2017-11-01T11:21:04Z", - "updated_at": "2017-11-01T14:04:47Z", - "name": "new-name", - "email": "best-email@example.tld", - "user_id": 58, - "username": "new-exciting-name", - "old_username": "old-boring-name" -} -``` - -**Key added** - -```json -{ - "event_name": "key_create", - "created_at": "2014-08-18 18:45:16 UTC", - "updated_at": "2012-07-21T07:38:22Z", - "username": "root", - "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC58FwqHUbebw2SdT7SP4FxZ0w+lAO/erhy2ylhlcW/tZ3GY3mBu9VeeiSGoGz8hCx80Zrz+aQv28xfFfKlC8XQFpCWwsnWnQqO2Lv9bS8V1fIHgMxOHIt5Vs+9CAWGCCvUOAurjsUDoE2ALIXLDMKnJxcxD13XjWdK54j6ZXDB4syLF0C2PnAQSVY9X7MfCYwtuFmhQhKaBussAXpaVMRHltie3UYSBUUuZaB3J4cg/7TxlmxcNd+ppPRIpSZAB0NI6aOnqoBCpimscO/VpQRJMVLr3XiSYeT6HBiDXWHnIVPfQc03OGcaFqOit6p8lYKMaP/iUQLm+pgpZqrXZ9vB john@localhost", - "id": 4 -} -``` - -**Key removed** - -```json -{ - "event_name": "key_destroy", - "created_at": "2014-08-18 18:45:16 UTC", - "updated_at": "2012-07-21T07:38:22Z", - "username": "root", - "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC58FwqHUbebw2SdT7SP4FxZ0w+lAO/erhy2ylhlcW/tZ3GY3mBu9VeeiSGoGz8hCx80Zrz+aQv28xfFfKlC8XQFpCWwsnWnQqO2Lv9bS8V1fIHgMxOHIt5Vs+9CAWGCCvUOAurjsUDoE2ALIXLDMKnJxcxD13XjWdK54j6ZXDB4syLF0C2PnAQSVY9X7MfCYwtuFmhQhKaBussAXpaVMRHltie3UYSBUUuZaB3J4cg/7TxlmxcNd+ppPRIpSZAB0NI6aOnqoBCpimscO/VpQRJMVLr3XiSYeT6HBiDXWHnIVPfQc03OGcaFqOit6p8lYKMaP/iUQLm+pgpZqrXZ9vB john@localhost", - "id": 4 -} -``` - -**Group created:** - -```json -{ - "created_at": "2012-07-21T07:30:54Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "group_create", - "name": "StoreCloud", - "path": "storecloud", - "group_id": 78 -} -``` - -**Group removed:** - -```json -{ - "created_at": "2012-07-21T07:30:54Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "group_destroy", - "name": "StoreCloud", - "path": "storecloud", - "group_id": 78 -} -``` - -**Group renamed:** - -```json -{ - "event_name": "group_rename", - "created_at": "2017-10-30T15:09:00Z", - "updated_at": "2017-11-01T10:23:52Z", - "name": "Better Name", - "path": "better-name", - "full_path": "parent-group/better-name", - "group_id": 64, - "old_path": "old-name", - "old_full_path": "parent-group/old-name" -} -``` - -**New Group Member:** - -```json -{ - "created_at": "2012-07-21T07:30:56Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "user_add_to_group", - "group_access": "Maintainer", - "group_id": 78, - "group_name": "StoreCloud", - "group_path": "storecloud", - "user_email": "johnsmith@example.com", - "user_name": "John Smith", - "user_username": "johnsmith", - "user_id": 41 -} -``` - -**Group Member Removed:** - -```json -{ - "created_at": "2012-07-21T07:30:56Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "user_remove_from_group", - "group_access": "Maintainer", - "group_id": 78, - "group_name": "StoreCloud", - "group_path": "storecloud", - "user_email": "johnsmith@example.com", - "user_name": "John Smith", - "user_username": "johnsmith", - "user_id": 41 -} -``` - -**Group Member Updated:** - -```json -{ - "created_at": "2012-07-21T07:30:56Z", - "updated_at": "2012-07-21T07:38:22Z", - "event_name": "user_update_for_group", - "group_access": "Maintainer", - "group_id": 78, - "group_name": "StoreCloud", - "group_path": "storecloud", - "user_email": "johnsmith@example.com", - "user_name": "John Smith", - "user_username": "johnsmith", - "user_id": 41 -} -``` - -## Push events - -Triggered when you push to the repository, except when pushing tags. -It generates one event per modified branch. - -**Request header**: - -```plaintext -X-Gitlab-Event: System Hook -``` - -**Request body:** - -```json -{ - "event_name": "push", - "before": "95790bf891e76fee5e1747ab589903a6a1f80f22", - "after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", - "ref": "refs/heads/master", - "checkout_sha": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", - "user_id": 4, - "user_name": "John Smith", - "user_email": "john@example.com", - "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", - "project_id": 15, - "project":{ - "name":"Diaspora", - "description":"", - "web_url":"http://example.com/mike/diaspora", - "avatar_url":null, - "git_ssh_url":"git@example.com:mike/diaspora.git", - "git_http_url":"http://example.com/mike/diaspora.git", - "namespace":"Mike", - "visibility_level":0, - "path_with_namespace":"mike/diaspora", - "default_branch":"master", - "homepage":"http://example.com/mike/diaspora", - "url":"git@example.com:mike/diaspora.git", - "ssh_url":"git@example.com:mike/diaspora.git", - "http_url":"http://example.com/mike/diaspora.git" - }, - "repository":{ - "name": "Diaspora", - "url": "git@example.com:mike/diaspora.git", - "description": "", - "homepage": "http://example.com/mike/diaspora", - "git_http_url":"http://example.com/mike/diaspora.git", - "git_ssh_url":"git@example.com:mike/diaspora.git", - "visibility_level":0 - }, - "commits": [ - { - "id": "c5feabde2d8cd023215af4d2ceeb7a64839fc428", - "message": "Add simple search to projects in public area", - "timestamp": "2013-05-13T18:18:08+00:00", - "url": "https://dev.gitlab.org/gitlab/gitlabhq/commit/c5feabde2d8cd023215af4d2ceeb7a64839fc428", - "author": { - "name": "Example User", - "email": "user@example.com" - } - } - ], - "total_commits_count": 1 -} -``` - -## Tag events - -Triggered when you create (or delete) tags to the repository. -It generates one event per modified tag. - -**Request header**: - -```plaintext -X-Gitlab-Event: System Hook -``` - -**Request body:** - -```json -{ - "event_name": "tag_push", - "before": "0000000000000000000000000000000000000000", - "after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7", - "ref": "refs/tags/v1.0.0", - "checkout_sha": "5937ac0a7beb003549fc5fd26fc247adbce4a52e", - "user_id": 1, - "user_name": "John Smith", - "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", - "project_id": 1, - "project":{ - "name":"Example", - "description":"", - "web_url":"http://example.com/jsmith/example", - "avatar_url":null, - "git_ssh_url":"git@example.com:jsmith/example.git", - "git_http_url":"http://example.com/jsmith/example.git", - "namespace":"Jsmith", - "visibility_level":0, - "path_with_namespace":"jsmith/example", - "default_branch":"master", - "homepage":"http://example.com/jsmith/example", - "url":"git@example.com:jsmith/example.git", - "ssh_url":"git@example.com:jsmith/example.git", - "http_url":"http://example.com/jsmith/example.git" - }, - "repository":{ - "name": "Example", - "url": "ssh://git@example.com/jsmith/example.git", - "description": "", - "homepage": "http://example.com/jsmith/example", - "git_http_url":"http://example.com/jsmith/example.git", - "git_ssh_url":"git@example.com:jsmith/example.git", - "visibility_level":0 - }, - "commits": [], - "total_commits_count": 0 -} -``` - -## Merge request events - -Triggered when a new merge request is created, an existing merge request was -updated/merged/closed or a commit is added in the source branch. - -**Request header**: - -```plaintext -X-Gitlab-Event: System Hook -``` - -```json -{ - "object_kind": "merge_request", - "event_type": "merge_request", - "user": { - "id": 1, - "name": "Administrator", - "username": "root", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon", - "email": "admin@example.com" - }, - "project": { - "id": 1, - "name":"Gitlab Test", - "description":"Aut reprehenderit ut est.", - "web_url":"http://example.com/gitlabhq/gitlab-test", - "avatar_url":null, - "git_ssh_url":"git@example.com:gitlabhq/gitlab-test.git", - "git_http_url":"http://example.com/gitlabhq/gitlab-test.git", - "namespace":"GitlabHQ", - "visibility_level":20, - "path_with_namespace":"gitlabhq/gitlab-test", - "default_branch":"master", - "homepage":"http://example.com/gitlabhq/gitlab-test", - "url":"http://example.com/gitlabhq/gitlab-test.git", - "ssh_url":"git@example.com:gitlabhq/gitlab-test.git", - "http_url":"http://example.com/gitlabhq/gitlab-test.git" - }, - "repository": { - "name": "Gitlab Test", - "url": "http://example.com/gitlabhq/gitlab-test.git", - "description": "Aut reprehenderit ut est.", - "homepage": "http://example.com/gitlabhq/gitlab-test" - }, - "object_attributes": { - "id": 99, - "target_branch": "master", - "source_branch": "ms-viewport", - "source_project_id": 14, - "author_id": 51, - "assignee_id": 6, - "title": "MS-Viewport", - "created_at": "2013-12-03T17:23:34Z", - "updated_at": "2013-12-03T17:23:34Z", - "milestone_id": null, - "state": "opened", - "merge_status": "unchecked", - "target_project_id": 14, - "iid": 1, - "description": "", - "source": { - "name":"Awesome Project", - "description":"Aut reprehenderit ut est.", - "web_url":"http://example.com/awesome_space/awesome_project", - "avatar_url":null, - "git_ssh_url":"git@example.com:awesome_space/awesome_project.git", - "git_http_url":"http://example.com/awesome_space/awesome_project.git", - "namespace":"Awesome Space", - "visibility_level":20, - "path_with_namespace":"awesome_space/awesome_project", - "default_branch":"master", - "homepage":"http://example.com/awesome_space/awesome_project", - "url":"http://example.com/awesome_space/awesome_project.git", - "ssh_url":"git@example.com:awesome_space/awesome_project.git", - "http_url":"http://example.com/awesome_space/awesome_project.git" - }, - "target": { - "name":"Awesome Project", - "description":"Aut reprehenderit ut est.", - "web_url":"http://example.com/awesome_space/awesome_project", - "avatar_url":null, - "git_ssh_url":"git@example.com:awesome_space/awesome_project.git", - "git_http_url":"http://example.com/awesome_space/awesome_project.git", - "namespace":"Awesome Space", - "visibility_level":20, - "path_with_namespace":"awesome_space/awesome_project", - "default_branch":"master", - "homepage":"http://example.com/awesome_space/awesome_project", - "url":"http://example.com/awesome_space/awesome_project.git", - "ssh_url":"git@example.com:awesome_space/awesome_project.git", - "http_url":"http://example.com/awesome_space/awesome_project.git" - }, - "last_commit": { - "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", - "message": "fixed readme", - "timestamp": "2012-01-03T23:36:29+02:00", - "url": "http://example.com/awesome_space/awesome_project/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", - "author": { - "name": "GitLab dev user", - "email": "gitlabdev@dv6700.(none)" - } - }, - "work_in_progress": false, - "url": "http://example.com/diaspora/merge_requests/1", - "action": "open", - "assignee": { - "name": "User1", - "username": "user1", - "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=40\u0026d=identicon" - } - }, - "labels": [{ - "id": 206, - "title": "API", - "color": "#ffffff", - "project_id": 14, - "created_at": "2013-12-03T17:15:43Z", - "updated_at": "2013-12-03T17:15:43Z", - "template": false, - "description": "API related issues", - "type": "ProjectLabel", - "group_id": 41 - }], - "changes": { - "updated_by_id": { - "previous": null, - "current": 1 - }, - "updated_at": { - "previous": "2017-09-15 16:50:55 UTC", - "current":"2017-09-15 16:52:00 UTC" - }, - "labels": { - "previous": [{ - "id": 206, - "title": "API", - "color": "#ffffff", - "project_id": 14, - "created_at": "2013-12-03T17:15:43Z", - "updated_at": "2013-12-03T17:15:43Z", - "template": false, - "description": "API related issues", - "type": "ProjectLabel", - "group_id": 41 - }], - "current": [{ - "id": 205, - "title": "Platform", - "color": "#123123", - "project_id": 14, - "created_at": "2013-12-03T17:15:43Z", - "updated_at": "2013-12-03T17:15:43Z", - "template": false, - "description": "Platform related issues", - "type": "ProjectLabel", - "group_id": 41 - }] - } - } -} -``` - -## Repository Update events - -Triggered only once when you push to the repository (including tags). - -**Request header**: - -```plaintext -X-Gitlab-Event: System Hook -``` - -**Request body:** - -```json -{ - "event_name": "repository_update", - "user_id": 1, - "user_name": "John Smith", - "user_email": "admin@example.com", - "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80", - "project_id": 1, - "project": { - "name":"Example", - "description":"", - "web_url":"http://example.com/jsmith/example", - "avatar_url":null, - "git_ssh_url":"git@example.com:jsmith/example.git", - "git_http_url":"http://example.com/jsmith/example.git", - "namespace":"Jsmith", - "visibility_level":0, - "path_with_namespace":"jsmith/example", - "default_branch":"master", - "homepage":"http://example.com/jsmith/example", - "url":"git@example.com:jsmith/example.git", - "ssh_url":"git@example.com:jsmith/example.git", - "http_url":"http://example.com/jsmith/example.git" - }, - "changes": [ - { - "before":"8205ea8d81ce0c6b90fbe8280d118cc9fdad6130", - "after":"4045ea7a3df38697b3730a20fb73c8bed8a3e69e", - "ref":"refs/heads/master" - } - ], - "refs":["refs/heads/master"] -} -``` - -## Local requests in system hooks - -[Requests to local network by system hooks](../security/webhooks.md) can be allowed -or blocked by an administrator. - -<!-- ## Troubleshooting - -Include any troubleshooting steps that you can foresee. If you know beforehand what issues -one might have when setting this up, or when something is changed, or on upgrading, it's -important to describe those, too. Think of things that may go wrong and include them here. -This is important to minimize requests for support, and to avoid doc comments with -questions that you know someone might ask. - -Each scenario can be a third-level heading, e.g. `### Getting error message X`. -If you have none to add when creating a doc, leave this section in place -but commented out to help encourage others to add to it in the future. --> +<!-- This redirect file can be deleted after <2022-06-18>. --> +<!-- Redirects that point to other docs in the same project expire in three months. --> +<!-- Redirects that point to docs in a different project or site (for example, link is not relative and starts with `https:`) expire in one year. --> +<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html --> diff --git a/doc/user/admin_area/index.md b/doc/user/admin_area/index.md index 4a334c28496..08fb756e79f 100644 --- a/doc/user/admin_area/index.md +++ b/doc/user/admin_area/index.md @@ -27,7 +27,7 @@ The Admin Area is made up of the following sections: | **{overview}** [Overview](#overview-section) | View your GitLab [Dashboard](#admin-area-dashboard), and administer [projects](#administering-projects), [users](#administering-users), [groups](#administering-groups), [topics](#administering-topics), [jobs](#administering-jobs), [runners](#administering-runners), and [Gitaly servers](#administering-gitaly-servers). | | **{monitor}** Monitoring | View GitLab [system information](#system-information), and information on [background jobs](#background-jobs), [logs](#logs), [health checks](monitoring/health_check.md), [requests profiles](#requests-profiles), and [audit events](#audit-events). | | **{messages}** Messages | Send and manage [broadcast messages](broadcast_messages.md) for your users. | -| **{hook}** System Hooks | Configure [system hooks](../../system_hooks/system_hooks.md) for many events. | +| **{hook}** System Hooks | Configure [system hooks](../../administration/system_hooks.md) for many events. | | **{applications}** Applications | Create system [OAuth applications](../../integration/oauth_provider.md) for integrations with other services. | | **{slight-frown}** Abuse Reports | Manage [abuse reports](review_abuse_reports.md) submitted by your users. | | **{license}** License | Add, display, and remove [licenses](license.md). | diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index fe874b36d0e..63207751c78 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -461,6 +461,10 @@ module QA enabled?(ENV['QA_VALIDATE_RESOURCE_REUSE'], default: false) end + def skip_smoke_reliable? + enabled?(ENV['QA_SKIP_SMOKE_RELIABLE'], default: false) + end + private def remote_grid_credentials diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb index 026b0ddcd04..2b9adf0e870 100644 --- a/qa/qa/specs/runner.rb +++ b/qa/qa/specs/runner.rb @@ -41,9 +41,8 @@ module QA end tags_for_rspec.push(%w[--tag ~geo]) unless QA::Runtime::Env.geo_environment? - tags_for_rspec.push(%w[--tag ~skip_signup_disabled]) if QA::Runtime::Env.signup_disabled? - + tags_for_rspec.push(%w[--tag ~smoke --tag ~reliable]) if QA::Runtime::Env.skip_smoke_reliable? tags_for_rspec.push(%w[--tag ~skip_live_env]) if QA::Specs::Helpers::ContextSelector.dot_com? QA::Runtime::Env.supported_features.each_key do |key| diff --git a/scripts/frontend/graphql_possible_types_extraction.js b/scripts/frontend/graphql_possible_types_extraction.js new file mode 100755 index 00000000000..61f783086e7 --- /dev/null +++ b/scripts/frontend/graphql_possible_types_extraction.js @@ -0,0 +1,69 @@ +#!/usr/bin/env node + +const fs = require('fs/promises'); +const path = require('path'); +const assert = require('assert'); + +const ROOT_DIR = path.join(__dirname, '../../'); +const GRAPHQL_SCHEMA = path.join(ROOT_DIR, 'tmp/tests/graphql/gitlab_schema.json'); +const POSSIBLE_TYPES_REL = 'app/assets/javascripts/graphql_shared/possible_types.json'; +const POSSIBLE_TYPES = path.join(ROOT_DIR, POSSIBLE_TYPES_REL); + +function extractTypes(schema) { + return Object.fromEntries( + // eslint-disable-next-line no-underscore-dangle + schema.data.__schema.types + .filter((type) => type.possibleTypes) + .map(({ name, possibleTypes }) => [name, possibleTypes.map((subtype) => subtype.name)]), + ); +} + +async function main() { + let schema; + try { + schema = JSON.parse(await fs.readFile(GRAPHQL_SCHEMA, 'utf-8')); + } catch (e) { + console.error( + 'Could not read the GraphQL Schema, make sure to run: bundle exec rake gitlab:graphql:schema:dump', + ); + throw e; + } + + const possibleTypes = extractTypes(schema); + + if (process.argv.includes('--check')) { + const previousTypes = JSON.parse(await fs.readFile(POSSIBLE_TYPES, 'utf-8')); + + assert.deepStrictEqual( + previousTypes, + possibleTypes, + ` +${POSSIBLE_TYPES_REL} needs to be regenerated, please run: + node scripts/frontend/graphql_possible_types_extraction.js --write +and commit the changes! + `, + ); + return; + } + + if (process.argv.includes('--write')) { + const stringifiedPossibleTypes = JSON.stringify(possibleTypes, null, 2); + await fs.writeFile(POSSIBLE_TYPES, `${stringifiedPossibleTypes}\n`); + console.log(`Successfully updated ${POSSIBLE_TYPES_REL}`); + return; + } + + throw new Error(` +ERROR: Please use the script correctly: +Usage: graphql_possible_types_extraction [options] + +Options: + --check Check whether there are new Interface or Union types + --write Generate new possible types + `); +} + +main().catch((error) => { + console.warn(error.message); + process.exitCode = 1; +}); diff --git a/spec/frontend/__helpers__/mock_apollo_helper.js b/spec/frontend/__helpers__/mock_apollo_helper.js index c07a6d8ef85..bae9f33be87 100644 --- a/spec/frontend/__helpers__/mock_apollo_helper.js +++ b/spec/frontend/__helpers__/mock_apollo_helper.js @@ -1,7 +1,7 @@ import { InMemoryCache } from '@apollo/client/core'; import { createMockClient as createMockApolloClient } from 'mock-apollo-client'; import VueApollo from 'vue-apollo'; -import possibleTypes from '~/graphql_shared/possibleTypes.json'; +import possibleTypes from '~/graphql_shared/possible_types.json'; import { typePolicies } from '~/lib/graphql'; export function createMockClient(handlers = [], resolvers = {}, cacheOptions = {}) { diff --git a/spec/helpers/clusters_helper_spec.rb b/spec/helpers/clusters_helper_spec.rb index 7dce2b6dad3..53d33f2875f 100644 --- a/spec/helpers/clusters_helper_spec.rb +++ b/spec/helpers/clusters_helper_spec.rb @@ -38,6 +38,11 @@ RSpec.describe ClustersHelper do subject { helper.js_clusters_list_data(clusterable) } + before do + helper.send(:default_branch_name, clusterable) + helper.send(:clusterable_project_path, clusterable) + end + it 'displays endpoint path' do expect(subject[:endpoint]).to eq("#{project_path(project)}/-/clusters.json") end @@ -58,6 +63,7 @@ RSpec.describe ClustersHelper do it 'displays empty image path' do expect(subject[:clusters_empty_state_image]).to match(%r(/illustrations/empty-state/empty-state-clusters|svg)) + expect(subject[:empty_state_image]).to match(%r(/illustrations/empty-state/empty-state-agents|svg)) end it 'displays create cluster using certificate path' do @@ -68,6 +74,22 @@ RSpec.describe ClustersHelper do expect(subject[:add_cluster_path]).to eq("#{project_path(project)}/-/clusters/connect") end + it 'displays project default branch' do + expect(subject[:default_branch_name]).to eq(project.default_branch) + end + + it 'displays project path' do + expect(subject[:project_path]).to eq(project.full_path) + end + + it 'displays kas address' do + expect(subject[:kas_address]).to eq(Gitlab::Kas.external_url) + end + + it 'displays GitLab version' do + expect(subject[:gitlab_version]).to eq(Gitlab.version_info) + end + context 'user has no permissions to create a cluster' do it 'displays that user can\'t add cluster' do expect(subject[:can_add_cluster]).to eq("false") @@ -107,6 +129,14 @@ RSpec.describe ClustersHelper do it 'displays display_cluster_agents as false' do expect(subject[:display_cluster_agents]).to eq("false") end + + it 'does not include a default branch' do + expect(subject[:default_branch_name]).to be_nil + end + + it 'does not include a project path' do + expect(subject[:project_path]).to be_nil + end end describe 'certificate based clusters enabled' do @@ -132,34 +162,6 @@ RSpec.describe ClustersHelper do end end - describe '#js_clusters_data' do - let_it_be(:current_user) { create(:user) } - let_it_be(:project) { build(:project) } - let_it_be(:clusterable) { ClusterablePresenter.fabricate(project, current_user: current_user) } - - subject { helper.js_clusters_data(clusterable) } - - it 'displays project default branch' do - expect(subject[:default_branch_name]).to eq(project.default_branch) - end - - it 'displays image path' do - expect(subject[:empty_state_image]).to match(%r(/illustrations/empty-state/empty-state-agents|svg)) - end - - it 'displays project path' do - expect(subject[:project_path]).to eq(project.full_path) - end - - it 'displays kas address' do - expect(subject[:kas_address]).to eq(Gitlab::Kas.external_url) - end - - it 'displays GitLab version' do - expect(subject[:gitlab_version]).to eq(Gitlab.version_info) - end - end - describe '#js_cluster_new' do subject { helper.js_cluster_new } @@ -222,4 +224,33 @@ RSpec.describe ClustersHelper do end end end + + describe '#default_branch_name' do + subject { default_branch_name(clusterable) } + + context 'when clusterable is a project without a repository' do + let(:clusterable) { build(:project) } + + it 'allows default branch name to display default name from settings' do + expect(subject).to eq(Gitlab::CurrentSettings.default_branch_name) + end + end + + context 'when clusterable is a project with a repository' do + let(:clusterable) { build(:project, :repository) } + let(:repository) { clusterable.repository } + + it 'allows default branch name to display repository root branch' do + expect(subject).to eq(repository.root_ref) + end + end + + context 'when clusterable is a group' do + let(:clusterable) { build(:group) } + + it 'does not allow default branch name to display' do + expect(subject).to be_nil + end + end + end end |