Commit 153dcad8 authored by Paul Slaughter's avatar Paul Slaughter

Remove gitpod feature flag

- Also removed Gitpod module since we can simply
access CurrentSettings.gitpod now.
- Also updated docs to match other places such as
`doc/api/users.md`
parent fb207682
......@@ -82,7 +82,7 @@ module PreferencesHelper
def integration_views
[].tap do |views|
views << { name: 'gitpod', message: gitpod_enable_description, message_url: 'https://gitpod.io/', help_link: help_page_path('integration/gitpod.md') } if Gitlab::Gitpod.feature_and_settings_enabled?
views << { name: 'gitpod', message: gitpod_enable_description, message_url: 'https://gitpod.io/', help_link: help_page_path('integration/gitpod.md') } if Gitlab::CurrentSettings.gitpod_enabled
views << { name: 'sourcegraph', message: sourcegraph_url_message, message_url: Gitlab::CurrentSettings.sourcegraph_url, help_link: help_page_path('user/profile/preferences.md', anchor: 'sourcegraph') } if Gitlab::Sourcegraph.feature_available? && Gitlab::CurrentSettings.sourcegraph_enabled
end
end
......
......@@ -26,7 +26,7 @@ module WebIdeButtonHelper
end
def show_gitpod_button?
show_web_ide_button? && Gitlab::Gitpod.feature_and_settings_enabled?(@project)
show_web_ide_button? && Gitlab::CurrentSettings.gitpod_enabled
end
def can_push_code?
......@@ -54,7 +54,7 @@ module WebIdeButtonHelper
end
def gitpod_url
return "" unless Gitlab::Gitpod.feature_and_settings_enabled?(@project)
return "" unless Gitlab::CurrentSettings.gitpod_enabled
"#{Gitlab::CurrentSettings.gitpod_url}##{project_tree_url(@project, tree_join(@ref, @path || ''))}"
end
......
- return unless Gitlab::Gitpod.feature_available?
- expanded = integration_expanded?('gitpod_')
%section.settings.no-animate#js-gitpod-settings{ class: ('expanded' if expanded) }
......
---
title: Add configurable Gitpod button within projcet repository page
merge_request: 51197
author:
type: added
---
name: gitpod
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37985
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/258206
milestone: '13.4'
type: development
group: group::editor
default_enabled: true
......@@ -8,10 +8,7 @@ info: "To determine the technical writer assigned to the Stage/Group associated
# Gitpod Integration
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/228893) in GitLab 13.4.
> - It was [deployed behind a feature flag](#enable-or-disable-the-gitpod-integration), disabled by default.
> - [Became enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/258206) in GitLab 13.5.
> - It's enabled on GitLab.com.
> - It's recommended for production use.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/258206) in GitLab 13.8
> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#configure-your-gitlab-instance-with-gitpod). **(CORE ONLY)**
WARNING:
......@@ -55,21 +52,3 @@ and get your instance up and running.
1. Expand the **Gitpod** configuration section.
1. Check **Enable Gitpod**.
1. Add your Gitpod instance URL (for example, `https://gitpod.example.com`).
## Enable or disable the Gitpod integration **(CORE ONLY)**
The Gitpod integration is deployed behind a feature flag that is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../administration/feature_flags.md)
can enable or disable it.
To disable it:
```ruby
Feature.disable(:gitpod)
```
To enable it:
```ruby
Feature.enable(:gitpod)
```
# frozen_string_literal: true
module Gitlab
class Gitpod
class << self
def feature_available?
# The gitpod_bundle feature could be conditionally applied, so check if `!off?`
!feature.off? || feature_enabled?
end
def feature_enabled?(actor = nil)
Feature.enabled?(:gitpod, actor, default_enabled: true)
end
def feature_and_settings_enabled?(actor = nil)
feature_enabled?(actor) && Gitlab::CurrentSettings.gitpod_enabled
end
private
def feature
Feature.get(:gitpod) # rubocop:disable Gitlab/AvoidFeatureGet
end
end
end
end
......@@ -17,10 +17,7 @@ RSpec.describe 'Admin updates settings' do
end
context 'General page' do
let(:gitpod_feature_enabled) { true }
before do
stub_feature_flags(gitpod: gitpod_feature_enabled)
visit general_admin_application_settings_path
end
......@@ -224,28 +221,16 @@ RSpec.describe 'Admin updates settings' do
end
context 'Configure Gitpod' do
context 'with feature disabled' do
let(:gitpod_feature_enabled) { false }
it 'do not show settings' do
expect(page).not_to have_selector('#js-gitpod-settings')
it 'changes gitpod settings' do
page.within('#js-gitpod-settings') do
check 'Enable Gitpod integration'
fill_in 'Gitpod URL', with: 'https://gitpod.test/'
click_button 'Save changes'
end
end
context 'with feature enabled' do
let(:gitpod_feature_enabled) { true }
it 'changes gitpod settings' do
page.within('#js-gitpod-settings') do
check 'Enable Gitpod integration'
fill_in 'Gitpod URL', with: 'https://gitpod.test/'
click_button 'Save changes'
end
expect(page).to have_content 'Application settings saved successfully'
expect(current_settings.gitpod_url).to eq('https://gitpod.test/')
expect(current_settings.gitpod_enabled).to be(true)
end
expect(page).to have_content 'Application settings saved successfully'
expect(current_settings.gitpod_url).to eq('https://gitpod.test/')
expect(current_settings.gitpod_enabled).to be(true)
end
end
end
......
......@@ -330,9 +330,8 @@ RSpec.describe TreeHelper do
end
end
context 'gitpod feature is enabled' do
context 'gitpod settings is enabled' do
before do
stub_feature_flags(gitpod: true)
allow(Gitlab::CurrentSettings)
.to receive(:gitpod_enabled)
.and_return(true)
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Gitpod do
let_it_be(:user) { create(:user) }
before do
stub_feature_flags(gitpod: feature_scope)
end
describe '.feature_available?' do
subject { described_class.feature_available? }
context 'when feature has not been set' do
let(:feature_scope) { nil }
it { is_expected.to be_truthy }
end
context 'when feature is disabled' do
let(:feature_scope) { false }
it { is_expected.to be_falsey }
end
context 'when feature is enabled globally' do
let(:feature_scope) { true }
it { is_expected.to be_truthy }
end
context 'when feature is enabled only to a resource' do
let(:feature_scope) { user }
it { is_expected.to be_truthy }
end
end
describe '.feature_enabled?' do
let(:current_user) { nil }
subject { described_class.feature_enabled?(current_user) }
context 'when feature has not been set' do
let(:feature_scope) { nil }
it { is_expected.to be_truthy }
end
context 'when feature is enabled globally' do
let(:feature_scope) { true }
it { is_expected.to be_truthy }
end
context 'when feature is enabled only to a resource' do
let(:feature_scope) { user }
context 'for the same resource' do
let(:current_user) { user }
it { is_expected.to be_truthy }
end
context 'for a different resource' do
let(:current_user) { create(:user) }
it { is_expected.to be_falsey }
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