From 84a59c10c8e71eff5db96cfa12c673c2cbec6ecc Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Sat, 17 Jul 2021 12:22:02 +1000 Subject: [PATCH] feat: enable environments, deployed versions and released versions endpoints without a feature toggle required --- lib/pact_broker/api.rb | 18 ++++++++---------- lib/pact_broker/api/resources/index.rb | 22 ++++++++++------------ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/lib/pact_broker/api.rb b/lib/pact_broker/api.rb index 701a75d6c..9c4c3c2e9 100644 --- a/lib/pact_broker/api.rb +++ b/lib/pact_broker/api.rb @@ -117,16 +117,14 @@ def self.build_api(application_context = PactBroker::ApplicationContext.default_ add ["contracts", "publish"], Api::Resources::PublishContracts, { resource_name: "publish_contracts" } - if PactBroker.feature_enabled?(:environments) - add ["environments"], Api::Resources::Environments, { resource_name: "environments" } - add ["environments", :environment_uuid], Api::Resources::Environment, { resource_name: "environment" } - add ["environments", :environment_uuid, "deployed-versions", "currently-deployed"], Api::Resources::CurrentlyDeployedVersionsForEnvironment, { resource_name: "environment_currently_deployed_deployed_versions" } - add ["environments", :environment_uuid, "released-versions", "currently-supported"], Api::Resources::CurrentlySupportedVersionsForEnvironment, { resource_name: "environment_currently_supported_released_versions" } - add ["pacticipants", :pacticipant_name, "versions", :pacticipant_version_number, "deployed-versions", "environment", :environment_uuid], Api::Resources::DeployedVersionsForVersionAndEnvironment, { resource_name: "deployed_versions_for_version_and_environment" } - add ["pacticipants", :pacticipant_name, "versions", :pacticipant_version_number, "released-versions", "environment", :environment_uuid], Api::Resources::ReleasedVersionsForVersionAndEnvironment, { resource_name: "released_versions_for_version_and_environment" } - add ["released-versions", :uuid], Api::Resources::ReleasedVersion, { resource_name: "released_version" } - add ["deployed-versions", :uuid], Api::Resources::DeployedVersion, { resource_name: "deployed_version" } - end + add ["environments"], Api::Resources::Environments, { resource_name: "environments" } + add ["environments", :environment_uuid], Api::Resources::Environment, { resource_name: "environment" } + add ["environments", :environment_uuid, "deployed-versions", "currently-deployed"], Api::Resources::CurrentlyDeployedVersionsForEnvironment, { resource_name: "environment_currently_deployed_deployed_versions" } + add ["environments", :environment_uuid, "released-versions", "currently-supported"], Api::Resources::CurrentlySupportedVersionsForEnvironment, { resource_name: "environment_currently_supported_released_versions" } + add ["pacticipants", :pacticipant_name, "versions", :pacticipant_version_number, "deployed-versions", "environment", :environment_uuid], Api::Resources::DeployedVersionsForVersionAndEnvironment, { resource_name: "deployed_versions_for_version_and_environment" } + add ["pacticipants", :pacticipant_name, "versions", :pacticipant_version_number, "released-versions", "environment", :environment_uuid], Api::Resources::ReleasedVersionsForVersionAndEnvironment, { resource_name: "released_versions_for_version_and_environment" } + add ["released-versions", :uuid], Api::Resources::ReleasedVersion, { resource_name: "released_version" } + add ["deployed-versions", :uuid], Api::Resources::DeployedVersion, { resource_name: "deployed_version" } add ["integrations"], Api::Resources::Integrations, {resource_name: "integrations"} add ["integrations", "provider", :provider_name, "consumer", :consumer_name], Api::Resources::Integration, {resource_name: "integration"} diff --git a/lib/pact_broker/api/resources/index.rb b/lib/pact_broker/api/resources/index.rb index 5a48401ca..4957e4989 100644 --- a/lib/pact_broker/api/resources/index.rb +++ b/lib/pact_broker/api/resources/index.rb @@ -156,19 +156,17 @@ def links }] } - if PactBroker.feature_enabled?(:environments) - links_hash["pb:environments"] = { - title: "Environments", - href: environments_url(base_url), - templated: false - } + links_hash["pb:environments"] = { + title: "Environments", + href: environments_url(base_url), + templated: false + } - links_hash["pb:environment"] = { - title: "Environment", - href: environments_url(base_url) + "/{uuid}", - templated: true - } - end + links_hash["pb:environment"] = { + title: "Environment", + href: environments_url(base_url) + "/{uuid}", + templated: true + } if PactBroker.feature_enabled?("disable_pacts_for_verification", true) links_hash.delete("pb:provider-pacts-for-verification")