diff options
29 files changed, 158 insertions, 141 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 390675ab80b..8a0148d9faf 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -161,7 +161,7 @@ module Ci pipeline_includes_count = observations['pipeline_includes_count'] next false unless pipeline_includes_count - pipeline_includes_count.to_i > Gitlab::Ci::Config::External::Context::MAX_INCLUDES + pipeline_includes_count.to_i > Gitlab::Ci::Config::External::Context::TEMP_MAX_INCLUDES end end end diff --git a/config/feature_flags/development/ci_includes_count_duplicates.yml b/config/feature_flags/development/ci_includes_count_duplicates.yml deleted file mode 100644 index 5e33edddc03..00000000000 --- a/config/feature_flags/development/ci_includes_count_duplicates.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: ci_includes_count_duplicates -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111726 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/391517 -milestone: '15.9' -type: development -group: group::pipeline authoring -default_enabled: false diff --git a/data/whats_new/20230222001_15_09.yml b/data/whats_new/20230222001_15_09.yml index 7e7f9b808d6..217212297bb 100644 --- a/data/whats_new/20230222001_15_09.yml +++ b/data/whats_new/20230222001_15_09.yml @@ -69,7 +69,7 @@ self-managed: false gitlab-com: true available_in: [Ultimate] - documentation_link: https://release-15-9.about.gitlab-review.app/direction/modelops/ai_assisted/code_suggestions/ + documentation_link: https://about.gitlab.com/releases/2023/02/22/gitlab-15-9-released/#code-suggestions-available-in-closed-beta image_url: https://about.gitlab.com/images/15_9/DemoFastApi.gif published_at: 2023-02-02 # YYYY-MM-DD release: 15.9 diff --git a/doc/api/discussions.md b/doc/api/discussions.md index 262064befaa..925d3ae6c9b 100644 --- a/doc/api/discussions.md +++ b/doc/api/discussions.md @@ -65,6 +65,7 @@ GET /projects/:id/issues/:issue_iid/discussions "system": false, "noteable_id": 3, "noteable_type": "Issue", + "project_id": 5, "noteable_iid": null }, { @@ -85,6 +86,7 @@ GET /projects/:id/issues/:issue_iid/discussions "system": false, "noteable_id": 3, "noteable_type": "Issue", + "project_id": 5, "noteable_iid": null, "resolvable": false } @@ -112,6 +114,7 @@ GET /projects/:id/issues/:issue_iid/discussions "system": false, "noteable_id": 3, "noteable_type": "Issue", + "project_id": 5, "noteable_iid": null, "resolvable": false } @@ -279,6 +282,7 @@ GET /projects/:id/snippets/:snippet_id/discussions "system": false, "noteable_id": 3, "noteable_type": "Snippet", + "project_id": 5, "noteable_iid": null }, { @@ -299,6 +303,7 @@ GET /projects/:id/snippets/:snippet_id/discussions "system": false, "noteable_id": 3, "noteable_type": "Snippet", + "project_id": 5, "noteable_iid": null, "resolvable": false } @@ -326,6 +331,7 @@ GET /projects/:id/snippets/:snippet_id/discussions "system": false, "noteable_id": 3, "noteable_type": "Snippet", + "project_id": 5, "noteable_iid": null, "resolvable": false } @@ -491,6 +497,7 @@ GET /groups/:id/epics/:epic_id/discussions "system": false, "noteable_id": 3, "noteable_type": "Epic", + "project_id": 5, "noteable_iid": null, "resolvable": false }, @@ -512,6 +519,7 @@ GET /groups/:id/epics/:epic_id/discussions "system": false, "noteable_id": 3, "noteable_type": "Epic", + "project_id": 5, "noteable_iid": null, "resolvable": false } @@ -539,6 +547,7 @@ GET /groups/:id/epics/:epic_id/discussions "system": false, "noteable_id": 3, "noteable_type": "Epic", + "project_id": 5, "noteable_iid": null, "resolvable": false } @@ -705,6 +714,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/discussions "system": false, "noteable_id": 3, "noteable_type": "Merge request", + "project_id": 5, "noteable_iid": null, "resolved": false, "resolvable": true, @@ -729,6 +739,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/discussions "system": false, "noteable_id": 3, "noteable_type": "Merge request", + "project_id": 5, "noteable_iid": null, "resolved": false, "resolvable": true, @@ -758,6 +769,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/discussions "system": false, "noteable_id": 3, "noteable_type": "Merge request", + "project_id": 5, "noteable_iid": null, "resolved": false, "resolvable": true, @@ -794,6 +806,7 @@ Diff comments also contain position: "system": false, "noteable_id": 3, "noteable_type": "Merge request", + "project_id": 5, "noteable_iid": null, "commit_id": "4803c71e6b1833ca72b8b26ef2ecd5adc8a38031", "position": { @@ -1137,6 +1150,7 @@ GET /projects/:id/repository/commits/:commit_id/discussions "system": false, "noteable_id": 3, "noteable_type": "Commit", + "project_id": 5, "noteable_iid": null, "resolvable": false }, @@ -1158,6 +1172,7 @@ GET /projects/:id/repository/commits/:commit_id/discussions "system": false, "noteable_id": 3, "noteable_type": "Commit", + "project_id": 5, "noteable_iid": null, "resolvable": false } @@ -1185,6 +1200,7 @@ GET /projects/:id/repository/commits/:commit_id/discussions "system": false, "noteable_id": 3, "noteable_type": "Commit", + "project_id": 5, "noteable_iid": null, "resolvable": false } @@ -1219,6 +1235,7 @@ Diff comments contain also position: "system": false, "noteable_id": 3, "noteable_type": "Commit", + "project_id": 5, "noteable_iid": null, "position": { "base_sha": "b5d6e7b1613fca24d250fa8e5bc7bcc3dd6002ef", diff --git a/doc/api/notes.md b/doc/api/notes.md index 66ed6b52387..305bdd294c5 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -78,6 +78,7 @@ GET /projects/:id/issues/:issue_iid/notes?sort=asc&order_by=updated_at "system": true, "noteable_id": 377, "noteable_type": "Issue", + "project_id": 5, "noteable_iid": 377, "resolvable": false, "confidential": false, @@ -100,6 +101,7 @@ GET /projects/:id/issues/:issue_iid/notes?sort=asc&order_by=updated_at "system": true, "noteable_id": 121, "noteable_type": "Issue", + "project_id": 5, "noteable_iid": 121, "resolvable": false, "confidential": true, @@ -239,9 +241,9 @@ Parameters: ```json { - "id": 52, - "title": "Snippet", - "file_name": "snippet.rb", + "id": 302, + "body": "closed", + "attachment": null, "author": { "id": 1, "username": "pipin", @@ -250,9 +252,16 @@ Parameters: "state": "active", "created_at": "2013-09-30T13:46:01Z" }, - "expires_at": null, - "updated_at": "2013-10-02T07:34:20Z", - "created_at": "2013-10-02T07:34:20Z" + "created_at": "2013-10-02T09:22:45Z", + "updated_at": "2013-10-02T10:22:45Z", + "system": true, + "noteable_id": 377, + "noteable_type": "Issue", + "project_id": 5, + "noteable_iid": 377, + "resolvable": false, + "confidential": false, + "internal": false } ``` @@ -379,6 +388,7 @@ Parameters: "system": false, "noteable_id": 2, "noteable_type": "MergeRequest", + "project_id": 5, "noteable_iid": 2, "resolvable": false, "confidential": false, @@ -501,9 +511,9 @@ Parameters: ```json { - "id": 52, - "title": "Epic", - "file_name": "epic.rb", + "id": 302, + "body": "Epic note", + "attachment": null, "author": { "id": 1, "username": "pipin", @@ -512,9 +522,14 @@ Parameters: "state": "active", "created_at": "2013-09-30T13:46:01Z" }, - "expires_at": null, - "updated_at": "2013-10-02T07:34:20Z", - "created_at": "2013-10-02T07:34:20Z", + "created_at": "2013-10-02T09:22:45Z", + "updated_at": "2013-10-02T10:22:45Z", + "system": true, + "noteable_id": 11, + "noteable_type": "Epic", + "project_id": 5, + "noteable_iid": 11, + "resolvable": false, "confidential": false, "internal": false } diff --git a/doc/api/search.md b/doc/api/search.md index 3c3ad3f6ab9..8882897d2f2 100644 --- a/doc/api/search.md +++ b/doc/api/search.md @@ -407,6 +407,7 @@ Example response: "system": false, "noteable_id": 22, "noteable_type": "Issue", + "project_id": 6, "noteable_iid": 2 } ] @@ -796,6 +797,7 @@ Example response: "system": false, "noteable_id": 22, "noteable_type": "Issue", + "project_id": 6, "noteable_iid": 2 } ] @@ -1046,6 +1048,7 @@ Example response: "system": false, "noteable_id": 22, "noteable_type": "Issue", + "project_id": 6, "noteable_iid": 2 } ] diff --git a/doc/ci/pipelines/downstream_pipelines.md b/doc/ci/pipelines/downstream_pipelines.md index e4560cd882d..d49d382d250 100644 --- a/doc/ci/pipelines/downstream_pipelines.md +++ b/doc/ci/pipelines/downstream_pipelines.md @@ -281,7 +281,7 @@ Use: - The `project` keyword to specify the full path to the downstream project. In [GitLab 15.3 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/367660), you can use [variable expansion](../variables/where_variables_can_be_used.md#gitlab-ciyml-file). -- The `branch` keyword to specify the name of a branch or [tag](../../topics/git/tags.md) +- The `branch` keyword to specify the name of a branch or [tag](../../user/project/repository/tags/index.md) in the project specified by `project`. You can use variable expansion. ## Trigger a multi-project pipeline by using the API diff --git a/doc/topics/git/index.md b/doc/topics/git/index.md index 328ea7f8a1c..2d2a14568c6 100644 --- a/doc/topics/git/index.md +++ b/doc/topics/git/index.md @@ -43,7 +43,7 @@ The following resources can help you get started with Git: - [Git stash](stash.md) - [Git file blame](../../user/project/repository/git_blame.md) - [Git file history](../../user/project/repository/git_history.md) -- [Git tags](tags.md) +- [Git tags](../../user/project/repository/tags/index.md) ### Concepts diff --git a/doc/topics/git/tags.md b/doc/topics/git/tags.md index ab196f409f7..c66c97717f2 100644 --- a/doc/topics/git/tags.md +++ b/doc/topics/git/tags.md @@ -1,41 +1,11 @@ --- -stage: Create -group: Source Code -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments +redirect_to: '../../user/project/repository/tags/index.md' +remove_date: '2023-05-27' --- -# Tags **(FREE)** +This document was moved to [another location](../../user/project/repository/tags/index.md). -Tags help you mark certain deployments and releases for later -reference. Git supports two types of tags: - -- Annotated tags: An unchangeable part of Git history. -- Lightweight (soft) tags: Tags that can be set and removed as needed. - -Many projects combine an annotated release tag with a stable branch. Consider -setting deployment or release tags automatically. - -## Tags sample workflow - -1. Create a lightweight tag. -1. Create an annotated tag. -1. Push the tags to the remote repository. - -```shell -git checkout master - -# Lightweight tag -git tag my_lightweight_tag - -# Annotated tag -git tag -a v1.0 -m 'Version 1.0' - -# Show list of the existing tags -git tag - -git push origin --tags -``` - -## Related topics - -- [Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging) Git reference page +<!-- This redirect file can be deleted after <2023-05-27>. --> +<!-- 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/group/settings/group_access_tokens.md b/doc/user/group/settings/group_access_tokens.md index 29170af74f9..3a1ecb36b9f 100644 --- a/doc/user/group/settings/group_access_tokens.md +++ b/doc/user/group/settings/group_access_tokens.md @@ -84,8 +84,9 @@ or API. However, administrators can use a workaround: # Set the group group you want to create a token for. For example, group with ID 109. group = Group.find(109) - # Create the group bot user. For further group access tokens, the username should be group_#{group.id}_bot#{bot_count}. For example, group_109_bot2 and email address group_109_bot_{random_string}@example.com. - bot = Users::CreateService.new(admin, { name: 'group_token', username: "group_#{group.id}_bot", email: "group_#{group.id}_bot_4ffca233d8298ea1@example.com", user_type: :project_bot }).execute + # Create the group bot user. For further group access tokens, the username should be `group_{group_id}_bot_{random_string}` and email address `group_{group_id}_bot_{random_string}@noreply.{Gitlab.config.gitlab.host}`. + random_string = SecureRandom.hex(8) + bot = Users::CreateService.new(admin, { name: 'group_token', username: "group_#{group.id}_bot_#{random_string}", email: "group_#{group.id}_bot_#{random_string}@noreply.#{Gitlab.config.gitlab.host}", user_type: :project_bot }).execute # Confirm the group bot. bot.confirm @@ -169,8 +170,8 @@ to groups instead of projects. Bot users for groups: - Do not count as licensed seats. - Can have a maximum role of Owner for a group. For more information, see [Create a group access token](../../../api/group_access_tokens.md#create-a-group-access-token). -- Have a username set to `group_{group_id}_bot_{random_string}`. For example, `group_123_bot_4ffca233d8298ea1`. -- Have an email set to `group{group_id}_bot_{random_string}@noreply.{Gitlab.config.gitlab.host}`. For example, `group123_bot_4ffca233d8298ea1@noreply.example.com`. +- Have a username set to `group_{group_id}_bot_{random_string}`. For example, `group_123_bot_4ffca233d8298ea1`. +- Have an email set to `group_{group_id}_bot_{random_string}@noreply.{Gitlab.config.gitlab.host}`. For example, `group_123_bot_4ffca233d8298ea1@noreply.example.com`. All other properties are similar to [bot users for projects](../../project/settings/project_access_tokens.md#bot-users-for-projects). diff --git a/doc/user/project/protected_tags.md b/doc/user/project/protected_tags.md index 152a55d24b7..aa0852565fd 100644 --- a/doc/user/project/protected_tags.md +++ b/doc/user/project/protected_tags.md @@ -6,7 +6,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w # Protected tags **(FREE)** -Protected tags: +Protected [tags](repository/tags/index.md): - Allow control over who has permission to create tags. - Prevent accidental update or deletion once created. @@ -106,6 +106,11 @@ Protected tags can only be deleted by using GitLab either from the UI or API. These protections prevent you from accidentally deleting a tag through local Git commands or third-party Git clients. +## Related topics + +- [Protected Tags API](../../api/protected_tags.md) +- [Tags API](../../api/tags.md) + <!-- ## Troubleshooting Include any troubleshooting steps that you can foresee. If you know beforehand what issues diff --git a/doc/user/project/releases/index.md b/doc/user/project/releases/index.md index dca34af41b4..7de32dccea5 100644 --- a/doc/user/project/releases/index.md +++ b/doc/user/project/releases/index.md @@ -88,7 +88,7 @@ To create a release in the Releases page: - [Title](release_fields.md#title). - [Milestones](#associate-milestones-with-a-release). - [Release notes](release_fields.md#release-notes-description). - - Whether or not to include the [Tag message](../../../topics/git/tags.md). + - Whether or not to include the [Tag message](../repository/tags/index.md). - [Asset links](release_fields.md#links). 1. Select **Create release**. diff --git a/doc/user/project/repository/tags/index.md b/doc/user/project/repository/tags/index.md new file mode 100644 index 00000000000..d12a4e9f2e4 --- /dev/null +++ b/doc/user/project/repository/tags/index.md @@ -0,0 +1,43 @@ +--- +stage: Create +group: Source Code +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments +--- + +# Tags **(FREE)** + +Tags help you mark certain deployments and releases for later +reference. Git supports two types of tags: + +- Annotated tags: An unchangeable part of Git history. +- Lightweight (soft) tags: Tags that can be set and removed as needed. + +Many projects combine an annotated release tag with a stable branch. Consider +setting deployment or release tags automatically. + +## Tags sample workflow + +1. Create a lightweight tag. +1. Create an annotated tag. +1. Push the tags to the remote repository. + +```shell +git checkout master + +# Lightweight tag +git tag my_lightweight_tag + +# Annotated tag +git tag -a v1.0 -m 'Version 1.0' + +# Show list of the existing tags +git tag + +git push origin --tags +``` + +## Related topics + +- [Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging) Git reference page +- [Protected tags](../../protected_tags.md) +- [Tags API](../../../../api/tags.md) diff --git a/doc/user/project/repository/web_editor.md b/doc/user/project/repository/web_editor.md index 80b0ada6f7b..300c2bba9e1 100644 --- a/doc/user/project/repository/web_editor.md +++ b/doc/user/project/repository/web_editor.md @@ -115,7 +115,7 @@ To create a [branch](branches/index.md) in the Web Editor: ## Create a tag -You can create [tags](../../../topics/git/tags.md) to mark milestones such as +You can create [tags](tags/index.md) to mark milestones such as production releases and release candidates. To create a tag in the Web Editor: 1. On the top bar, select **Main menu > Projects** and find your project. diff --git a/doc/user/project/settings/project_access_tokens.md b/doc/user/project/settings/project_access_tokens.md index 4fba6e0d5b8..b4d48e52e46 100644 --- a/doc/user/project/settings/project_access_tokens.md +++ b/doc/user/project/settings/project_access_tokens.md @@ -119,7 +119,7 @@ selected role and [scope](#scopes-for-a-project-access-token) of the project acc - The name is set to the name of the token. - The username is set to `project_{project_id}_bot_{random_string}`. For example, `project_123_bot_4ffca233d8298ea1`. -- The email is set to `project{project_id}_bot_{random_string}@noreply.{Gitlab.config.gitlab.host}`. For example, `project123_bot_4ffca233d8298ea1@noreply.example.com`. +- The email is set to `project_{project_id}_bot_{random_string}@noreply.{Gitlab.config.gitlab.host}`. For example, `project_123_bot_4ffca233d8298ea1@noreply.example.com`. API calls made with a project access token are associated with the corresponding bot user. diff --git a/lib/api/entities/note.rb b/lib/api/entities/note.rb index a92f534bbdc..cac4a8280e3 100644 --- a/lib/api/entities/note.rb +++ b/lib/api/entities/note.rb @@ -14,6 +14,7 @@ module API expose :created_at, :updated_at expose :system?, as: :system expose :noteable_id, :noteable_type + expose :project_id expose :commit_id, if: ->(note, options) { note.noteable_type == "MergeRequest" && note.is_a?(DiffNote) } expose :position, if: ->(note, options) { note.is_a?(DiffNote) } do |note| diff --git a/lib/atlassian/jira_connect/serializers/build_entity.rb b/lib/atlassian/jira_connect/serializers/build_entity.rb index aa864cb268f..b595d0c2a92 100644 --- a/lib/atlassian/jira_connect/serializers/build_entity.rb +++ b/lib/atlassian/jira_connect/serializers/build_entity.rb @@ -22,9 +22,10 @@ module Atlassian expose :references def issue_keys - # extract Jira issue keys from either the source branch/ref or the - # merge request title. - @issue_keys ||= pipeline.all_merge_requests.flat_map do |mr| + commit_message_issue_keys = JiraIssueKeyExtractor.new(pipeline.git_commit_message).issue_keys + + # extract Jira issue keys from either the source branch/ref or the merge request title. + @issue_keys ||= commit_message_issue_keys + pipeline.all_merge_requests.flat_map do |mr| src = "#{mr.source_branch} #{mr.title} #{mr.description}" JiraIssueKeyExtractor.new(src).issue_keys end.uniq diff --git a/lib/gitlab/ci/config/external/context.rb b/lib/gitlab/ci/config/external/context.rb index ab0477e4d44..881b131c252 100644 --- a/lib/gitlab/ci/config/external/context.rb +++ b/lib/gitlab/ci/config/external/context.rb @@ -9,8 +9,8 @@ module Gitlab TimeoutError = Class.new(StandardError) - MAX_INCLUDES = 100 - NEW_MAX_INCLUDES = 150 # Update to MAX_INCLUDES when FF ci_includes_count_duplicates is removed + MAX_INCLUDES = 150 + TEMP_MAX_INCLUDES = 100 # For logging; to be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/367150 include ::Gitlab::Utils::StrongMemoize @@ -29,10 +29,10 @@ module Gitlab @parent_pipeline = parent_pipeline @variables = variables || Ci::Variables::Collection.new @pipeline_config = pipeline_config - @expandset = Feature.enabled?(:ci_includes_count_duplicates, project) ? [] : Set.new + @expandset = [] @execution_deadline = 0 @logger = logger || Gitlab::Ci::Pipeline::Logger.new(project: project) - @max_includes = Feature.enabled?(:ci_includes_count_duplicates, project) ? NEW_MAX_INCLUDES : MAX_INCLUDES + @max_includes = MAX_INCLUDES yield self if block_given? end diff --git a/lib/gitlab/ci/config/external/mapper/verifier.rb b/lib/gitlab/ci/config/external/mapper/verifier.rb index 2982b0efb6c..36cf091a532 100644 --- a/lib/gitlab/ci/config/external/mapper/verifier.rb +++ b/lib/gitlab/ci/config/external/mapper/verifier.rb @@ -28,11 +28,7 @@ module Gitlab file.validate_content! if file.valid? file.load_and_validate_expanded_hash! if file.valid? - if context.expandset.is_a?(Array) # To be removed when FF 'ci_includes_count_duplicates' is removed - context.expandset << file - else - context.expandset.add(file) - end + context.expandset << file end end diff --git a/spec/fixtures/api/schemas/entities/discussion.json b/spec/fixtures/api/schemas/entities/discussion.json index 45271926547..4af36b5814b 100644 --- a/spec/fixtures/api/schemas/entities/discussion.json +++ b/spec/fixtures/api/schemas/entities/discussion.json @@ -103,6 +103,9 @@ "noteable_type": { "type": "string" }, + "project_id": { + "type": "integer" + }, "resolved": { "type": "boolean" }, @@ -207,4 +210,4 @@ } } } -}
\ No newline at end of file +} diff --git a/spec/fixtures/api/schemas/public_api/v4/notes.json b/spec/fixtures/api/schemas/public_api/v4/notes.json index 1987a0f2f71..60d6bb90b79 100644 --- a/spec/fixtures/api/schemas/public_api/v4/notes.json +++ b/spec/fixtures/api/schemas/public_api/v4/notes.json @@ -78,6 +78,9 @@ "noteable_type": { "type": "string" }, + "project_id": { + "type": "integer" + }, "resolved": { "type": "boolean" }, @@ -122,4 +125,4 @@ ], "additionalProperties": false } -}
\ No newline at end of file +} diff --git a/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb b/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb index 48787f2a0d2..f05adb49651 100644 --- a/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb +++ b/spec/lib/atlassian/jira_connect/serializers/build_entity_spec.rb @@ -29,11 +29,11 @@ RSpec.describe Atlassian::JiraConnect::Serializers::BuildEntity, feature_categor end context 'when the pipeline does belong to a Jira issue' do - let(:pipeline) { create(:ci_pipeline, merge_request: merge_request) } + let(:pipeline) { create(:ci_pipeline, merge_request: merge_request, project: project) } %i[jira_branch jira_title jira_description].each do |trait| context "because it belongs to an MR with a #{trait}" do - let(:merge_request) { create(:merge_request, trait) } + let(:merge_request) { create(:merge_request, trait, source_project: project) } describe '#issue_keys' do it 'is not empty' do @@ -48,5 +48,22 @@ RSpec.describe Atlassian::JiraConnect::Serializers::BuildEntity, feature_categor end end end + + context 'in the pipeline\'s commit messsage' do + let_it_be(:pipeline) { create(:ci_pipeline, project: project) } + let(:commit_message) { "Merge branch 'staging' into 'master'\n\nFixes bug described in PROJ-1234" } + + before do + allow(pipeline).to receive(:git_commit_message).and_return(commit_message) + end + + describe '#issue_keys' do + it { expect(subject.issue_keys).to match_array(['PROJ-1234']) } + end + + describe '#to_json' do + it { expect(subject.to_json).to be_valid_json.and match_schema(Atlassian::Schemata.build_info) } + end + end end end diff --git a/spec/lib/gitlab/ci/config/external/context_spec.rb b/spec/lib/gitlab/ci/config/external/context_spec.rb index bae898e13eb..f1640822c6b 100644 --- a/spec/lib/gitlab/ci/config/external/context_spec.rb +++ b/spec/lib/gitlab/ci/config/external/context_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Gitlab::Ci::Config::External::Context, feature_category: :pipelin context 'with values' do it { is_expected.to have_attributes(**attributes) } it { expect(subject.expandset).to eq([]) } - it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::NEW_MAX_INCLUDES) } + it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) } it { expect(subject.execution_deadline).to eq(0) } it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } @@ -27,38 +27,11 @@ RSpec.describe Gitlab::Ci::Config::External::Context, feature_category: :pipelin it { is_expected.to have_attributes(**attributes) } it { expect(subject.expandset).to eq([]) } - it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::NEW_MAX_INCLUDES) } + it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) } it { expect(subject.execution_deadline).to eq(0) } it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } end - - context 'when FF ci_includes_count_duplicates is disabled' do - before do - stub_feature_flags(ci_includes_count_duplicates: false) - end - - context 'with values' do - it { is_expected.to have_attributes(**attributes) } - it { expect(subject.expandset).to eq(Set.new) } - it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) } - it { expect(subject.execution_deadline).to eq(0) } - it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } - it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } - it { expect(subject.variables_hash).to include('a' => 'b') } - end - - context 'without values' do - let(:attributes) { { project: nil, user: nil, sha: nil } } - - it { is_expected.to have_attributes(**attributes) } - it { expect(subject.expandset).to eq(Set.new) } - it { expect(subject.max_includes).to eq(Gitlab::Ci::Config::External::Context::MAX_INCLUDES) } - it { expect(subject.execution_deadline).to eq(0) } - it { expect(subject.variables).to be_instance_of(Gitlab::Ci::Variables::Collection) } - it { expect(subject.variables_hash).to be_instance_of(ActiveSupport::HashWithIndifferentAccess) } - end - end end describe '#set_deadline' do diff --git a/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb b/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb index 2930a05a8a2..b4576fb7a1d 100644 --- a/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb +++ b/spec/lib/gitlab/ci/config/external/mapper/verifier_spec.rb @@ -191,17 +191,6 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper::Verifier, feature_category: allow(context).to receive(:max_includes).and_return(2) expect { process }.to raise_error(Gitlab::Ci::Config::External::Mapper::TooManyIncludesError) end - - context 'when FF ci_includes_count_duplicates is disabled' do - before do - stub_feature_flags(ci_includes_count_duplicates: false) - end - - it 'does not raise error' do - allow(context).to receive(:max_includes).and_return(2) - expect { process }.not_to raise_error - end - end end end end diff --git a/spec/lib/gitlab/ci/config/external/mapper_spec.rb b/spec/lib/gitlab/ci/config/external/mapper_spec.rb index a731d0ddba3..56d1ddee4b8 100644 --- a/spec/lib/gitlab/ci/config/external/mapper_spec.rb +++ b/spec/lib/gitlab/ci/config/external/mapper_spec.rb @@ -234,17 +234,6 @@ RSpec.describe Gitlab::Ci::Config::External::Mapper, feature_category: :pipeline process expect(context.expandset.size).to eq(2) end - - context 'when FF ci_includes_count_duplicates is disabled' do - before do - stub_feature_flags(ci_includes_count_duplicates: false) - end - - it 'has expanset with one' do - process - expect(context.expandset.size).to eq(1) - end - end end context 'when passing max number of files' do diff --git a/spec/services/ci/create_pipeline_service/logger_spec.rb b/spec/services/ci/create_pipeline_service/logger_spec.rb index ecb24a61075..082a09db69e 100644 --- a/spec/services/ci/create_pipeline_service/logger_spec.rb +++ b/spec/services/ci/create_pipeline_service/logger_spec.rb @@ -142,7 +142,7 @@ RSpec.describe Ci::CreatePipelineService, # rubocop: disable RSpec/FilePath describe 'pipeline includes count' do before do - stub_const('Gitlab::Ci::Config::External::Context::MAX_INCLUDES', 2) + stub_const('Gitlab::Ci::Config::External::Context::TEMP_MAX_INCLUDES', 2) end context 'when the includes count exceeds the maximum' do diff --git a/spec/services/resource_access_tokens/create_service_spec.rb b/spec/services/resource_access_tokens/create_service_spec.rb index 3b6f2bc1368..f0eae9554dc 100644 --- a/spec/services/resource_access_tokens/create_service_spec.rb +++ b/spec/services/resource_access_tokens/create_service_spec.rb @@ -109,7 +109,6 @@ RSpec.describe ResourceAccessTokens::CreateService, feature_category: :system_ac end it 'email is the same as username' do - expect(SecureRandom).to receive(:hex).at_least(:once).and_return('randomhex') response = subject access_token = response.payload[:access_token] diff --git a/workhorse/go.mod b/workhorse/go.mod index 1dc549fa0d4..ddde9da5bb6 100644 --- a/workhorse/go.mod +++ b/workhorse/go.mod @@ -7,7 +7,7 @@ require ( github.com/BurntSushi/toml v1.2.1 github.com/FZambia/sentinel v1.1.1 github.com/alecthomas/chroma/v2 v2.5.0 - github.com/aws/aws-sdk-go v1.44.203 + github.com/aws/aws-sdk-go v1.44.204 github.com/disintegration/imaging v1.6.2 github.com/getsentry/raven-go v0.2.0 github.com/golang-jwt/jwt/v4 v4.5.0 diff --git a/workhorse/go.sum b/workhorse/go.sum index 1c0f897d636..657f50f3466 100644 --- a/workhorse/go.sum +++ b/workhorse/go.sum @@ -544,8 +544,8 @@ github.com/aws/aws-sdk-go v1.43.11/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4 github.com/aws/aws-sdk-go v1.43.31/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.44.128/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/aws/aws-sdk-go v1.44.151/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= -github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= -github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.204 h1:7/tPUXfNOHB390A63t6fJIwmlwVQAkAwcbzKsU2/6OQ= +github.com/aws/aws-sdk-go v1.44.204/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.17.1 h1:02c72fDJr87N8RAC2s3Qu0YuvMRZKNZJ9F+lAehCazk= github.com/aws/aws-sdk-go-v2 v1.17.1/go.mod h1:JLnGeGONAyi2lWXI1p0PCIOIy333JMVK1U7Hf0aRFLw= |