Commit 038fb5f1 authored by Stan Hu's avatar Stan Hu

Merge branch '216912-revert-jira-proxy-columns' into 'master'

Ignore Jira proxy settings columns

See merge request gitlab-org/gitlab!57260
parents 646dea63 cb83efb3
...@@ -32,7 +32,7 @@ class JiraService < IssueTrackerService ...@@ -32,7 +32,7 @@ class JiraService < IssueTrackerService
# TODO: we can probably just delegate as part of # TODO: we can probably just delegate as part of
# https://gitlab.com/gitlab-org/gitlab/issues/29404 # https://gitlab.com/gitlab-org/gitlab/issues/29404
data_field :username, :password, :url, :api_url, :jira_issue_transition_id, :project_key, :issues_enabled, data_field :username, :password, :url, :api_url, :jira_issue_transition_id, :project_key, :issues_enabled,
:vulnerabilities_enabled, :vulnerabilities_issuetype, :proxy_address, :proxy_port, :proxy_username, :proxy_password :vulnerabilities_enabled, :vulnerabilities_issuetype
before_update :reset_password before_update :reset_password
after_commit :update_deployment_type, on: [:create, :update], if: :update_deployment_type? after_commit :update_deployment_type, on: [:create, :update], if: :update_deployment_type?
......
...@@ -2,20 +2,23 @@ ...@@ -2,20 +2,23 @@
class JiraTrackerData < ApplicationRecord class JiraTrackerData < ApplicationRecord
include Services::DataFields include Services::DataFields
include IgnorableColumns
ignore_columns %i[
encrypted_proxy_address
encrypted_proxy_address_iv
encrypted_proxy_port
encrypted_proxy_port_iv
encrypted_proxy_username
encrypted_proxy_username_iv
encrypted_proxy_password
encrypted_proxy_password_iv
], remove_with: '14.0', remove_after: '2021-05-22'
attr_encrypted :url, encryption_options attr_encrypted :url, encryption_options
attr_encrypted :api_url, encryption_options attr_encrypted :api_url, encryption_options
attr_encrypted :username, encryption_options attr_encrypted :username, encryption_options
attr_encrypted :password, encryption_options attr_encrypted :password, encryption_options
attr_encrypted :proxy_address, encryption_options
attr_encrypted :proxy_port, encryption_options
attr_encrypted :proxy_username, encryption_options
attr_encrypted :proxy_password, encryption_options
validates :proxy_address, length: { maximum: 2048 }
validates :proxy_port, length: { maximum: 5 }
validates :proxy_username, length: { maximum: 255 }
validates :proxy_password, length: { maximum: 255 }
enum deployment_type: { unknown: 0, server: 1, cloud: 2 }, _prefix: :deployment enum deployment_type: { unknown: 0, server: 1, cloud: 2 }, _prefix: :deployment
end end
...@@ -11,20 +11,9 @@ RSpec.describe JiraTrackerData do ...@@ -11,20 +11,9 @@ RSpec.describe JiraTrackerData do
it { is_expected.to define_enum_for(:deployment_type).with_values([:unknown, :server, :cloud]).with_prefix(:deployment) } it { is_expected.to define_enum_for(:deployment_type).with_values([:unknown, :server, :cloud]).with_prefix(:deployment) }
end end
describe 'proxy settings' do
it { is_expected.to validate_length_of(:proxy_address).is_at_most(2048) }
it { is_expected.to validate_length_of(:proxy_port).is_at_most(5) }
it { is_expected.to validate_length_of(:proxy_username).is_at_most(255) }
it { is_expected.to validate_length_of(:proxy_password).is_at_most(255) }
end
describe 'encrypted attributes' do describe 'encrypted attributes' do
subject { described_class.encrypted_attributes.keys } subject { described_class.encrypted_attributes.keys }
it { it { is_expected.to contain_exactly(:api_url, :password, :url, :username) }
is_expected.to contain_exactly(
:api_url, :password, :proxy_address, :proxy_password, :proxy_port, :proxy_username, :url, :username
)
}
end end
end end
...@@ -30,7 +30,7 @@ RSpec.describe BulkCreateIntegrationService do ...@@ -30,7 +30,7 @@ RSpec.describe BulkCreateIntegrationService do
described_class.new(integration, batch, association).execute described_class.new(integration, batch, association).execute
expect(created_integration.reload.data_fields.attributes.except(*excluded_attributes)) expect(created_integration.reload.data_fields.attributes.except(*excluded_attributes))
.to eq(integration.data_fields.attributes.except(*excluded_attributes)) .to eq(integration.reload.data_fields.attributes.except(*excluded_attributes))
end end
end end
end end
......
...@@ -68,8 +68,8 @@ RSpec.describe BulkUpdateIntegrationService do ...@@ -68,8 +68,8 @@ RSpec.describe BulkUpdateIntegrationService do
it 'updates the data fields from the integration', :aggregate_failures do it 'updates the data fields from the integration', :aggregate_failures do
described_class.new(subgroup_integration, batch).execute described_class.new(subgroup_integration, batch).execute
expect(integration.data_fields.attributes.except(*excluded_attributes)) expect(integration.reload.data_fields.attributes.except(*excluded_attributes))
.to eq(subgroup_integration.data_fields.attributes.except(*excluded_attributes)) .to eq(subgroup_integration.reload.data_fields.attributes.except(*excluded_attributes))
expect(integration.data_fields.attributes.except(*excluded_attributes)) expect(integration.data_fields.attributes.except(*excluded_attributes))
.not_to eq(excluded_integration.data_fields.attributes.except(*excluded_attributes)) .not_to eq(excluded_integration.data_fields.attributes.except(*excluded_attributes))
......
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