Commit b23e2a8a authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '296990-enable-jira-ff-sync' into 'master'

Enable synchronization of feature flags to Jira

See merge request gitlab-org/gitlab!51796
parents 0df9f800 348a6b91
......@@ -41,7 +41,6 @@ module FeatureFlags
def sync_to_jira(feature_flag)
return unless feature_flag.present?
return unless Feature.enabled?(:jira_sync_feature_flags, feature_flag.project)
seq_id = ::Atlassian::JiraConnect::Client.generate_update_sequence_id
feature_flag.run_after_commit do
......
......@@ -14,7 +14,6 @@ module JiraConnect
feature_flag = ::Operations::FeatureFlag.find_by_id(feature_flag_id)
return unless feature_flag
return unless Feature.enabled?(:jira_sync_feature_flags, feature_flag.project)
::JiraConnect::SyncService
.new(feature_flag.project)
......
---
title: Enable synchronization of feature flags to Jira
merge_request: 51796
author:
type: added
---
name: jira_sync_feature_flags
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50390
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/296990
milestone: '13.8'
type: development
group: group::ecosystem
default_enabled: false
......@@ -20,7 +20,13 @@ Features include:
- **Mention that a commit or MR resolves or closes a specific Jira issue** and when it's merged to the default branch:
- The GitLab MR displays a note that it closed the Jira issue. Prior to the merge, MRs indicate which issue they close.
- The Jira issue shows the activity and is closed or otherwise transitioned as specified in your GitLab settings.
- **View a list of Jira issues directly in GitLab** **(PREMIUM)**
- **Run a pipeline** on an MR linked to a Jira issue:
- The Jira issue shows the current pipeline status (in the sidebar as "builds").
- **Deploy to an environment** from an MR linked to a Jira issue:
- The Jira issue shows the status of the deployment (in the sidebar as "deployments").
- **Create or modify a feature flag** that mentions a Jira issue in its description:
- The Jira issue shows the details of the feature-flag (in the sidebar as "feature flags").
- **View a list of Jira issues** directly in GitLab **(PREMIUM)**
For additional features, you can install the
[Jira Development Panel integration](../../../integration/jira_development_panel.md).
......@@ -29,6 +35,9 @@ This enables you to:
- In a Jira issue, display relevant GitLab information in the [development panel](https://support.atlassian.com/jira-software-cloud/docs/view-development-information-for-an-issue/), including related branches, commits, and merge requests.
- Use Jira [Smart Commits](https://confluence.atlassian.com/fisheye/using-smart-commits-960155400.html) in GitLab to add Jira comments, log time spent on the issue, or apply any issue transition.
Some features (such as showing pipeline, deployment, and feature flags in Jira
issues) are only available when using the [Jira Development Panel integration](../../../integration/jira_development_panel.md).
See the [feature comparison](jira_integrations.md#feature-comparison) for more details.
## Configuration
......
......@@ -33,8 +33,6 @@ module Atlassian
private
def store_ff_info(project:, feature_flags:, **opts)
return unless Feature.enabled?(:jira_sync_feature_flags, project)
items = feature_flags.map { |flag| ::Atlassian::JiraConnect::Serializers::FeatureFlagEntity.represent(flag, opts) }
items.reject! { |item| item.issue_keys.empty? }
......
......@@ -303,24 +303,6 @@ RSpec.describe Atlassian::JiraConnect::Client do
expect(response['errorMessages']).to eq(['a: X', 'a: Y', 'b: Z'])
end
end
it 'does not call the API if the feature flag is not enabled' do
stub_feature_flags(jira_sync_feature_flags: false)
expect(subject).not_to receive(:post)
subject.send(:store_ff_info, project: project, feature_flags: feature_flags)
end
it 'does call the API if the feature flag enabled for the project' do
stub_feature_flags(jira_sync_feature_flags: project)
expect(subject).to receive(:post).with('/rest/featureflags/0.1/bulk', {
flags: Array, properties: Hash
}).and_call_original
subject.send(:store_ff_info, project: project, feature_flags: feature_flags)
end
end
describe '#store_build_info' do
......
......@@ -66,18 +66,6 @@ RSpec.describe FeatureFlags::CreateService do
subject
end
context 'the feature flag is disabled' do
before do
stub_feature_flags(jira_sync_feature_flags: false)
end
it 'does not sync the feature flag to Jira' do
expect(::JiraConnect::SyncFeatureFlagsWorker).not_to receive(:perform_async)
subject
end
end
it 'creates audit event' do
expected_message = 'Created feature flag <strong>feature_flag</strong> '\
'with description <strong>"description"</strong>. '\
......
......@@ -26,18 +26,6 @@ RSpec.describe FeatureFlags::UpdateService do
expect(subject[:status]).to eq(:success)
end
context 'the feature flag is disabled' do
before do
stub_feature_flags(jira_sync_feature_flags: false)
end
it 'does not sync the feature flag to Jira' do
expect(::JiraConnect::SyncFeatureFlagsWorker).not_to receive(:perform_async)
subject
end
end
it 'syncs the feature flag to Jira' do
expect(::JiraConnect::SyncFeatureFlagsWorker).to receive(:perform_async).with(Integer, Integer)
......
......@@ -32,29 +32,5 @@ RSpec.describe ::JiraConnect::SyncFeatureFlagsWorker do
subject
end
end
context 'when the feature flag is disabled' do
before do
stub_feature_flags(jira_sync_feature_flags: false)
end
it 'does not call the sync service' do
expect_next(::JiraConnect::SyncService).not_to receive(:execute)
subject
end
end
context 'when the feature flag is enabled for this project' do
before do
stub_feature_flags(jira_sync_feature_flags: feature_flag.project)
end
it 'calls the sync service' do
expect_next(::JiraConnect::SyncService).to receive(:execute)
subject
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment