Hard coded customers.gitlab.com URL
- The subscription IRL is initialized (in GDK) too to the production - it could create create potential problems. Should this be the staging or anything else?
SUBSCRIPTIONS_URL = ENV.fetch('CUSTOMER_PORTAL_URL', 'https://customers.gitlab.com').freeze
-
customers.gitlab.com
URL is hard coded in some code and specs. When someone sets up a local customers and gdk setup, one is able to modify the URL, and that may create issues.
Code locations
e/app/views/admin/licenses/_info.html.haml: = link_to _('Customer Portal'), 'https://customers.gitlab.com', class: 'btn btn-info btn-inverted', data: { track_event: 'click_text', track_label: 'license_dashboard', track_property: 'customer_portal' }, target: '_blank', rel: 'noopener noreferrer'
ee/app/views/layouts/header/_ee_subscribable_banner.html.haml: = link_to 'Upgrade your plan', 'https://customers.gitlab.com/subscriptions/my_renewal', class: 'btn btn-primary', data: { track_event: 'click_text', track_label: 'subscribable_action', track_property: 'upgrade' }
ee/app/views/layouts/header/_ee_subscribable_banner.html.haml: = link_to 'Renew subscription', 'https://customers.gitlab.com/subscriptions/my_renewal', class: 'btn btn-primary', data: { track_event: 'click_text', track_label: 'subscribable_action', track_property: 'renew' }
ee/lib/ee.rb: SUBSCRIPTIONS_URL = ENV.fetch('CUSTOMER_PORTAL_URL', 'https://customers.gitlab.com').freeze
ee/spec/fixtures/gitlab_com_plans.json: "href": "http://customers.gitlab.com/subscriptions/new?plan_id=2c92a0ff5a840412015aa3cde86f2ba6"
ee/spec/fixtures/gitlab_com_plans.json: "href": "http://customers.gitlab.com/subscriptions/new?plan_id=2c92a0fd5a840403015aa6d9ea2c46d6"
ee/spec/fixtures/gitlab_com_plans.json: "href": "http://customers.gitlab.com/subscriptions/new?plan_id=2c92a0fc5a83f01d015aa6db83c45aac"
ee/spec/controllers/profiles/billings_controller_spec.rb: it 'fetch subscription plans data from customers.gitlab.com' do
ee/spec/controllers/groups/billings_controller_spec.rb: it 'fetches subscription plans data from customers.gitlab.com' do
ee/spec/frontend/jobs/shared_runner_limit_block_spec.js: const subscriptionsMoreMinutesUrl = 'https://customers.gitlab.com/buy_pipeline_minutes';
ee/spec/frontend/storage_counter/components/app_spec.js: createComponent({ purchaseStorageUrl: 'customers.gitlab.com' });
ee/spec/frontend/storage_counter/components/app_spec.js: expect(link.attributes('href')).toBe('customers.gitlab.com');
ee/spec/frontend/billings/components/subscription_table_spec.js:const CUSTOMER_PORTAL_URL = 'https://customers.gitlab.com/subscriptions';
ee/spec/frontend/billings/components/__snapshots__/app_spec.js.snap: customerportalurl="https://customers.gitlab.com/subscriptions"
ee/spec/frontend/billings/components/__snapshots__/subscription_table_spec.js.snap: "href": "https://customers.gitlab.com/subscriptions",
ee/spec/frontend/billings/components/__snapshots__/subscription_table_spec.js.snap: "href": "https://customers.gitlab.com/subscriptions",
ee/spec/frontend/billings/components/__snapshots__/subscription_table_spec.js.snap: "href": "https://customers.gitlab.com/subscriptions",
ee/spec/frontend/billings/components/__snapshots__/subscription_table_spec.js.snap: "href": "https://customers.gitlab.com/subscriptions",
ee/spec/frontend/billings/components/app_spec.js: customerPortalUrl: 'https://customers.gitlab.com/subscriptions',
Solution Approach
- GDK we may default to staging; that's what I have observed @rhardarson was doing.
ee/lib/ee.rb: SUBSCRIPTIONS_URL = ENV.fetch('CUSTOMER_PORTAL_URL', 'https://customers.gitlab.com').freeze
- For the hardcoded values we may update all the URLs with the constant.
Edited by Alper Akgun