diff --git a/doc/development/testing_guide/contract/index.md b/doc/development/testing_guide/contract/index.md
index 31d68bb9f4f4ec43e923eae61eeecb5c006cef43..cf23792e239c5c988c0dccb2cf3473981dde3f36 100644
--- a/doc/development/testing_guide/contract/index.md
+++ b/doc/development/testing_guide/contract/index.md
@@ -42,11 +42,11 @@ rake contracts:merge_requests:test:merge_requests[contract_merge_requests]
 
 #### Verify the contracts in Pact Broker
 
-By default, the Rake tasks will verify the locally stored contracts. In order to verify the contracts published in the Pact Broker, we need to set the `PACT_BROKER` environment variable to `true`. It is important to point out here that the file path and file name of the provider test is what is used to find the contract in the Pact Broker which is why it is important to make sure the [provider test naming conventions](#provider-naming) are followed.
+By default, the Rake tasks will verify the locally stored contracts. In order to verify the contracts published in the Pact Broker, we need to set the `PACT_BROKER` environment variable to `true` and the `QA_PACT_BROKER_HOST` to the URL of the Pact Broker. It is important to point out here that the file path and file name of the provider test is what is used to find the contract in the Pact Broker which is why it is important to make sure the [provider test naming conventions](#provider-naming) are followed.
 
 ## Publish contracts to Pact Broker
 
-The contracts generated by the consumer test can be published to a hosted Pact Broker by going to `spec/contracts` and running the `publish-contracts.sh` script.
+The contracts generated by the consumer test can be published to a hosted Pact Broker by setting the `QA_PACT_BROKER_HOST` environment variable and running the [`publish-contracts.sh`](https://gitlab.com/gitlab-org/gitlab/-/tree/master/spec/contracts/publish-contracts.sh) script.
 
 ## Test suite folder structure and naming conventions
 
diff --git a/lib/tasks/contracts/merge_requests.rake b/lib/tasks/contracts/merge_requests.rake
index 5a6186d393dfb5a2a0b76fd23da2a9146bbcae95..049e4e41092dc79c8cf592e72f0b0362f3fc763a 100644
--- a/lib/tasks/contracts/merge_requests.rake
+++ b/lib/tasks/contracts/merge_requests.rake
@@ -38,7 +38,7 @@ namespace :contracts do
     end
 
     desc 'Run all merge request contract tests'
-    task 'test:merge_requests', :contract_merge_requests do |_t, arg|
+    task 'test:merge_requests', :contract_merge_requests do |_t|
       errors = %w[get_diffs_batch get_diffs_metadata get_discussions].each_with_object([]) do |task, err|
         Rake::Task["contracts:merge_requests:pact:verify:#{task}"].execute
       rescue StandardError, SystemExit
diff --git a/lib/tasks/contracts/pipeline_schedules.rake b/lib/tasks/contracts/pipeline_schedules.rake
index f3e65b9494069a014352c185c152b6f894a9e857..2733ad41de649b035a29ed0e88db5539df5d4d58 100644
--- a/lib/tasks/contracts/pipeline_schedules.rake
+++ b/lib/tasks/contracts/pipeline_schedules.rake
@@ -20,7 +20,7 @@ namespace :contracts do
     end
 
     desc 'Run all pipeline schedule contract tests'
-    task 'test:pipeline_schedules', :contract_pipeline_schedules do |_t, arg|
+    task 'test:pipeline_schedules', :contract_pipeline_schedules do |_t|
       errors = %w[
         update_pipeline_schedule
       ].each_with_object([]) do |task, err|
diff --git a/lib/tasks/contracts/pipelines.rake b/lib/tasks/contracts/pipelines.rake
index 13c973f1358c07bd4c5102568b0ccdd4d7f419d4..08e0a8b0319f3da551fe1f2d6057d9dd12d83cd9 100644
--- a/lib/tasks/contracts/pipelines.rake
+++ b/lib/tasks/contracts/pipelines.rake
@@ -47,7 +47,7 @@ namespace :contracts do
     end
 
     desc 'Run all pipeline contract tests'
-    task 'test:pipelines', :contract_pipelines do |_t, arg|
+    task 'test:pipelines', :contract_pipelines do |_t|
       errors = %w[
         create_a_new_pipeline
         get_list_project_pipelines
diff --git a/spec/contracts/provider/helpers/contract_source_helper.rb b/spec/contracts/provider/helpers/contract_source_helper.rb
index f59f228722db23a1938ad8de2cf98be470efe9ea..e1891b316f307fbffc345218f1a30a1b3c520f65 100644
--- a/spec/contracts/provider/helpers/contract_source_helper.rb
+++ b/spec/contracts/provider/helpers/contract_source_helper.rb
@@ -2,7 +2,6 @@
 
 module Provider
   module ContractSourceHelper
-    QA_PACT_BROKER_HOST = "http://localhost:9292/pacts"
     PREFIX_PATHS = {
       rake: {
         ce: "../../contracts/project",
@@ -10,7 +9,7 @@ module ContractSourceHelper
       },
       spec: "../contracts/project"
     }.freeze
-    SUB_PATH_REGEX = %r{project/(?<file_path>.*?)_helper.rb}.freeze
+    SUB_PATH_REGEX = %r{project/(?<file_path>.*?)_helper.rb}
 
     class << self
       def contract_location(requester:, file_path:, edition: :ce)
@@ -26,7 +25,7 @@ def pact_broker_url(file_path)
         provider_url = "provider/#{construct_provider_url_path(file_path)}"
         consumer_url = "consumer/#{construct_consumer_url_path(file_path)}"
 
-        "#{QA_PACT_BROKER_HOST}/#{provider_url}/#{consumer_url}/latest"
+        "#{ENV['QA_PACT_BROKER_HOST']}/pacts/#{provider_url}/#{consumer_url}/latest"
       end
 
       def construct_provider_url_path(file_path)
diff --git a/spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb b/spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb
index 27a455adeb2e3698bab7245a8c142321c1727464..18da71e06017d21a7e76283adf1d795538021ef0 100644
--- a/spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb
+++ b/spec/contracts/provider_specs/helpers/provider/contract_source_helper_spec.rb
@@ -54,8 +54,12 @@
   end
 
   describe '#pact_broker_url' do
+    before do
+      stub_env('QA_PACT_BROKER_HOST', 'http://localhost')
+    end
+
     it 'returns the full url to the contract that the provider test is verifying' do
-      contract_url_path = "http://localhost:9292/pacts/provider/" \
+      contract_url_path = "http://localhost/pacts/provider/" \
                           "#{provider_url_path}/consumer/#{consumer_url_path}/latest"
 
       expect(subject.pact_broker_url(split_pact_helper_path)).to eq(contract_url_path)
diff --git a/spec/contracts/publish-contracts.sh b/spec/contracts/publish-contracts.sh
index 8b9d4b6ecc6d691438733a2a2e586e012360d507..b50ba9afae8989bf707624a294dc62c918c5d77e 100644
--- a/spec/contracts/publish-contracts.sh
+++ b/spec/contracts/publish-contracts.sh
@@ -1,6 +1,5 @@
 LATEST_SHA=$(git rev-parse HEAD)
 GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
-BROKER_BASE_URL="http://localhost:9292"
 
 cd "${0%/*}" || exit 1
 
@@ -18,7 +17,7 @@ function publish_contract () {
     for contract in $CONTRACTS
     do
         printf "\e[32mPublishing %s...\033[0m\n" "$contract"
-        pact-broker publish "$contract" --consumer-app-version "$LATEST_SHA" --branch "$GIT_BRANCH" --broker-base-url "$BROKER_BASE_URL" --output json
+        pact-broker publish "$contract" --consumer-app-version "$LATEST_SHA" --branch "$GIT_BRANCH" --broker-base-url "$QA_PACT_BROKER_HOST" --output json
     done
 
     if [ ${ERROR} = 1 ]; then