Module: PactBroker

Includes:
Logging
Defined in:
lib/pact_broker/matrix/row.rb,
lib/pact_broker/db.rb,
lib/pact_broker/api.rb,
lib/pact_broker/app.rb,
lib/pact_broker/json.rb,
lib/pact_broker/error.rb,
lib/pact_broker/ui/app.rb,
lib/pact_broker/logging.rb,
lib/pact_broker/version.rb,
lib/pact_broker/db/clean.rb,
lib/pact_broker/messages.rb,
lib/pact_broker/policies.rb,
lib/pact_broker/services.rb,
lib/pact_broker/api/paths.rb,
lib/pact_broker/constants.rb,
lib/pact_broker/db/models.rb,
lib/pact_broker/db/migrate.rb,
lib/pact_broker/db/version.rb,
lib/pact_broker/domain/tag.rb,
lib/pact_broker/index/page.rb,
lib/pact_broker/pacts/diff.rb,
lib/pact_broker/config/load.rb,
lib/pact_broker/config/save.rb,
lib/pact_broker/date_helper.rb,
lib/pact_broker/domain/pact.rb,
lib/pact_broker/pacts/parse.rb,
lib/pact_broker/domain/group.rb,
lib/pact_broker/domain/label.rb,
lib/pact_broker/pacts/merger.rb,
lib/pact_broker/project_root.rb,
lib/pact_broker/repositories.rb,
lib/pact_broker/tags/service.rb,
lib/pact_broker/webhooks/job.rb,
lib/pact_broker/configuration.rb,
lib/pact_broker/index/service.rb,
lib/pact_broker/matrix/reason.rb,
lib/pact_broker/pacts/content.rb,
lib/pact_broker/pacts/service.rb,
lib/pact_broker/badges/service.rb,
lib/pact_broker/config/setting.rb,
lib/pact_broker/diagnostic/app.rb,
lib/pact_broker/domain/version.rb,
lib/pact_broker/domain/webhook.rb,
lib/pact_broker/feature_toggle.rb,
lib/pact_broker/groups/service.rb,
lib/pact_broker/labels/service.rb,
lib/pact_broker/matrix/service.rb,
lib/pact_broker/pacts/metadata.rb,
lib/pact_broker/pacts/selector.rb,
lib/pact_broker/db/migrate_data.rb,
lib/pact_broker/matrix/head_row.rb,
lib/pact_broker/metrics/service.rb,
lib/pact_broker/pacts/head_pact.rb,
lib/pact_broker/pacts/selectors.rb,
lib/pact_broker/tags/repository.rb,
lib/pact_broker/webhooks/render.rb,
lib/pact_broker/webhooks/status.rb,
lib/pact_broker/db/log_quietener.rb,
lib/pact_broker/hash_refinements.rb,
lib/pact_broker/matrix/every_row.rb,
lib/pact_broker/matrix/query_ids.rb,
lib/pact_broker/matrix/quick_row.rb,
lib/pact_broker/pacts/repository.rb,
lib/pact_broker/tasks/clean_task.rb,
lib/pact_broker/versions/service.rb,
lib/pact_broker/webhooks/service.rb,
lib/pact_broker/webhooks/webhook.rb,
lib/pact_broker/api/resources/tag.rb,
lib/pact_broker/config/repository.rb,
lib/pact_broker/domain/index_item.rb,
lib/pact_broker/labels/repository.rb,
lib/pact_broker/matrix/repository.rb,
lib/pact_broker/pacts/pact_params.rb,
lib/pact_broker/versions/sequence.rb,
lib/pact_broker/api/resources/pact.rb,
lib/pact_broker/build_http_options.rb,
lib/pact_broker/domain/pacticipant.rb,
lib/pact_broker/matrix/integration.rb,
lib/pact_broker/matrix/parse_query.rb,
lib/pact_broker/pacts/generate_sha.rb,
lib/pact_broker/pacts/pact_version.rb,
lib/pact_broker/pacts/sort_content.rb,
lib/pact_broker/string_refinements.rb,
lib/pact_broker/tasks/version_task.rb,
lib/pact_broker/webhooks/execution.rb,
lib/pact_broker/api/resources/badge.rb,
lib/pact_broker/api/resources/group.rb,
lib/pact_broker/api/resources/index.rb,
lib/pact_broker/api/resources/label.rb,
lib/pact_broker/doc/controllers/app.rb,
lib/pact_broker/domain/verification.rb,
lib/pact_broker/pacts/selected_pact.rb,
lib/pact_broker/tags/head_pact_tags.rb,
lib/pact_broker/versions/repository.rb,
lib/pact_broker/webhooks/repository.rb,
lib/pact_broker/api/pact_broker_urls.rb,
lib/pact_broker/api/resources/matrix.rb,
lib/pact_broker/certificates/service.rb,
lib/pact_broker/db/seed_example_data.rb,
lib/pact_broker/db/validate_encoding.rb,
lib/pact_broker/integrations/service.rb,
lib/pact_broker/matrix/query_builder.rb,
lib/pact_broker/matrix/query_results.rb,
lib/pact_broker/pacticipants/service.rb,
lib/pact_broker/repositories/helpers.rb,
lib/pact_broker/tasks/migration_task.rb,
lib/pact_broker/ui/controllers/index.rb,
lib/pact_broker/webhooks/redact_logs.rb,
lib/pact_broker/api/resources/metrics.rb,
lib/pact_broker/api/resources/version.rb,
lib/pact_broker/api/resources/webhook.rb,
lib/pact_broker/domain/order_versions.rb,
lib/pact_broker/matrix/aggregated_row.rb,
lib/pact_broker/pacts/order_hash_keys.rb,
lib/pact_broker/pacts/verifiable_pact.rb,
lib/pact_broker/ui/controllers/groups.rb,
lib/pact_broker/ui/controllers/matrix.rb,
lib/pact_broker/ui/helpers/url_helper.rb,
lib/pact_broker/verifications/service.rb,
lib/pact_broker/api/resources/versions.rb,
lib/pact_broker/api/resources/webhooks.rb,
lib/pact_broker/domain/webhook_request.rb,
lib/pact_broker/pacts/pact_publication.rb,
lib/pact_broker/pacts/placeholder_pact.rb,
lib/pact_broker/relationships/groupify.rb,
lib/pact_broker/test/test_data_builder.rb,
lib/pact_broker/verifications/sequence.rb,
lib/pact_broker/webhooks/webhook_event.rb,
lib/pact_broker/api/resources/dashboard.rb,
lib/pact_broker/pacticipants/repository.rb,
lib/pact_broker/ui/controllers/clusters.rb,
lib/pact_broker/versions/latest_version.rb,
lib/pact_broker/api/resources/error_test.rb,
lib/pact_broker/certificates/certificate.rb,
lib/pact_broker/integrations/integration.rb,
lib/pact_broker/matrix/resolved_selector.rb,
lib/pact_broker/verifications/repository.rb,
lib/pact_broker/webhooks/trigger_service.rb,
lib/pact_broker/api/decorators/timestamps.rb,
lib/pact_broker/api/resources/integration.rb,
lib/pact_broker/api/resources/latest_pact.rb,
lib/pact_broker/api/resources/pacticipant.rb,
lib/pact_broker/logging/default_formatter.rb,
lib/pact_broker/tags/tag_with_latest_flag.rb,
lib/pact_broker/tasks/data_migration_task.rb,
lib/pact_broker/ui/controllers/error_test.rb,
lib/pact_broker/ui/view_models/index_item.rb,
lib/pact_broker/ui/view_models/matrix_tag.rb,
lib/pact_broker/api/resources/all_webhooks.rb,
lib/pact_broker/api/resources/can_i_deploy.rb,
lib/pact_broker/api/resources/integrations.rb,
lib/pact_broker/api/resources/latest_pacts.rb,
lib/pact_broker/api/resources/matrix_badge.rb,
lib/pact_broker/api/resources/pact_version.rb,
lib/pact_broker/api/resources/pacticipants.rb,
lib/pact_broker/api/resources/verification.rb,
lib/pact_broker/db/data_migrations/helpers.rb,
lib/pact_broker/db/delete_overwritten_data.rb,
lib/pact_broker/matrix/unresolved_selector.rb,
lib/pact_broker/ui/view_models/index_items.rb,
lib/pact_broker/ui/view_models/matrix_line.rb,
lib/pact_broker/versions/abbreviate_number.rb,
lib/pact_broker/webhooks/triggered_webhook.rb,
lib/pact_broker/api/contracts/base_contract.rb,
lib/pact_broker/api/resources/base_resource.rb,
lib/pact_broker/api/resources/error_handler.rb,
lib/pact_broker/api/resources/pact_versions.rb,
lib/pact_broker/api/resources/pact_webhooks.rb,
lib/pact_broker/api/resources/relationships.rb,
lib/pact_broker/api/resources/verifications.rb,
lib/pact_broker/pacts/all_pact_publications.rb,
lib/pact_broker/pacts/create_formatted_diff.rb,
lib/pact_broker/ui/view_models/matrix_lines.rb,
lib/pact_broker/api/decorators/tag_decorator.rb,
lib/pact_broker/api/resources/authentication.rb,
lib/pact_broker/api/resources/provider_pacts.rb,
lib/pact_broker/api/decorators/base_decorator.rb,
lib/pact_broker/api/decorators/pact_decorator.rb,
lib/pact_broker/domain/webhook_request_header.rb,
lib/pact_broker/webhooks/check_host_whitelist.rb,
lib/pact_broker/api/contracts/webhook_contract.rb,
lib/pact_broker/api/decorators/label_decorator.rb,
lib/pact_broker/diagnostic/resources/heartbeat.rb,
lib/pact_broker/pacts/generate_interaction_sha.rb,
lib/pact_broker/pacts/latest_pact_publications.rb,
lib/pact_broker/pacts/verifiable_pact_messages.rb,
lib/pact_broker/ui/controllers/base_controller.rb,
lib/pact_broker/api/decorators/format_date_time.rb,
lib/pact_broker/api/decorators/matrix_decorator.rb,
lib/pact_broker/api/decorators/reason_decorator.rb,
lib/pact_broker/api/resources/pact_content_diff.rb,
lib/pact_broker/api/resources/webhook_execution.rb,
lib/pact_broker/matrix/parse_can_i_deploy_query.rb,
lib/pact_broker/versions/parse_semantic_version.rb,
lib/pact_broker/webhooks/webhook_request_logger.rb,
lib/pact_broker/api/decorators/decorator_context.rb,
lib/pact_broker/api/decorators/version_decorator.rb,
lib/pact_broker/api/decorators/webhook_decorator.rb,
lib/pact_broker/api/renderers/html_pact_renderer.rb,
lib/pact_broker/matrix/can_i_deploy_query_schema.rb,
lib/pact_broker/matrix/deployment_status_summary.rb,
lib/pact_broker/webhooks/execution_configuration.rb,
lib/pact_broker/api/contracts/request_validations.rb,
lib/pact_broker/api/decorators/representable_pact.rb,
lib/pact_broker/api/decorators/versions_decorator.rb,
lib/pact_broker/api/decorators/webhooks_decorator.rb,
lib/pact_broker/diagnostic/resources/dependencies.rb,
lib/pact_broker/webhooks/latest_triggered_webhook.rb,
lib/pact_broker/webhooks/webhook_execution_result.rb,
lib/pact_broker/webhooks/webhook_request_template.rb,
lib/pact_broker/api/decorators/dashboard_decorator.rb,
lib/pact_broker/api/resources/pact_webhooks_status.rb,
lib/pact_broker/api/resources/tagged_pact_versions.rb,
lib/pact_broker/config/space_delimited_string_list.rb,
lib/pact_broker/diagnostic/resources/base_resource.rb,
lib/pact_broker/tasks/delete_overwritten_data_task.rb,
lib/pact_broker/verifications/pseudo_branch_status.rb,
lib/pact_broker/api/contracts/verification_contract.rb,
lib/pact_broker/api/resources/default_base_resource.rb,
lib/pact_broker/api/resources/latest_provider_pacts.rb,
lib/pact_broker/pacts/build_verifiable_pact_notices.rb,
lib/pact_broker/pacts/squash_pacts_for_verification.rb,
lib/pact_broker/api/decorators/integration_decorator.rb,
lib/pact_broker/api/decorators/latest_pact_decorator.rb,
lib/pact_broker/api/decorators/matrix_text_decorator.rb,
lib/pact_broker/api/decorators/pacticipant_decorator.rb,
lib/pact_broker/api/resources/pacticipants_for_label.rb,
lib/pact_broker/api/resources/triggered_webhook_logs.rb,
lib/pact_broker/api/decorators/embedded_tag_decorator.rb,
lib/pact_broker/api/decorators/integrations_decorator.rb,
lib/pact_broker/api/decorators/pact_details_decorator.rb,
lib/pact_broker/api/decorators/pact_version_decorator.rb,
lib/pact_broker/api/decorators/verification_decorator.rb,
lib/pact_broker/api/resources/pact_triggered_webhooks.rb,
lib/pact_broker/pacts/latest_tagged_pact_publications.rb,
lib/pact_broker/api/contracts/put_pact_params_contract.rb,
lib/pact_broker/api/decorators/extended_pact_decorator.rb,
lib/pact_broker/api/decorators/pact_versions_decorator.rb,
lib/pact_broker/api/resources/webhook_resource_methods.rb,
lib/pact_broker/verifications/placeholder_verification.rb,
lib/pact_broker/api/contracts/dry_validation_predicates.rb,
lib/pact_broker/api/contracts/pacticipant_name_contract.rb,
lib/pact_broker/api/decorators/dashboard_text_decorator.rb,
lib/pact_broker/api/decorators/embedded_label_decorator.rb,
lib/pact_broker/api/decorators/provider_pacts_decorator.rb,
lib/pact_broker/api/renderers/integrations_dot_renderer.rb,
lib/pact_broker/api/resources/webhook_execution_methods.rb,
lib/pact_broker/db/data_migrations/set_webhooks_enabled.rb,
lib/pact_broker/api/contracts/dry_validation_workarounds.rb,
lib/pact_broker/api/decorators/pact_collection_decorator.rb,
lib/pact_broker/api/decorators/verifiable_pact_decorator.rb,
lib/pact_broker/api/contracts/pacticipant_name_validation.rb,
lib/pact_broker/api/decorators/embedded_version_decorator.rb,
lib/pact_broker/api/decorators/pact_pacticipant_decorator.rb,
lib/pact_broker/api/decorators/verifiable_pacts_decorator.rb,
lib/pact_broker/webhooks/pact_and_verification_parameters.rb,
lib/pact_broker/api/decorators/basic_pacticipant_decorator.rb,
lib/pact_broker/api/decorators/relationships_csv_decorator.rb,
lib/pact_broker/api/decorators/triggered_webhook_decorator.rb,
lib/pact_broker/api/resources/latest_verification_for_pact.rb,
lib/pact_broker/api/resources/pacticipant_resource_methods.rb,
lib/pact_broker/db/data_migrations/migrate_webhook_headers.rb,
lib/pact_broker/verifications/summary_for_consumer_version.rb,
lib/pact_broker/api/contracts/verifiable_pacts_query_schema.rb,
lib/pact_broker/api/decorators/triggered_webhooks_decorator.rb,
lib/pact_broker/webhooks/http_request_with_redacted_headers.rb,
lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb,
lib/pact_broker/api/resources/previous_distinct_pact_version.rb,
lib/pact_broker/api/decorators/pact_webhooks_status_decorator.rb,
lib/pact_broker/api/decorators/tagged_pact_versions_decorator.rb,
lib/pact_broker/api/decorators/verification_summary_decorator.rb,
lib/pact_broker/api/resources/provider_pacts_for_verification.rb,
lib/pact_broker/api/resources/verification_triggered_webhooks.rb,
lib/pact_broker/api/decorators/extended_verification_decorator.rb,
lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb,
lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb,
lib/pact_broker/api/decorators/verifiable_pacts_query_decorator.rb,
lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema.rb,
lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb,
lib/pact_broker/api/decorators/webhook_request_template_decorator.rb,
lib/pact_broker/api/resources/latest_verification_for_latest_pact.rb,
lib/pact_broker/pacts/latest_pact_publications_by_consumer_version.rb,
lib/pact_broker/verifications/latest_verification_for_pact_version.rb,
lib/pact_broker/matrix/query_results_with_deployment_status_summary.rb,
lib/pact_broker/db/data_migrations/set_latest_version_sequence_value.rb,
lib/pact_broker/pacts/latest_pact_publication_id_for_consumer_version.rb,
lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb,
lib/pact_broker/db/data_migrations/delete_deprecated_webhook_executions.rb,
lib/pact_broker/pacticipants/find_potential_duplicate_pacticipant_names.rb,
lib/pact_broker/db/data_migrations/set_pacticipant_ids_for_verifications.rb,
lib/pact_broker/db/data_migrations/set_consumer_ids_for_pact_publications.rb,
lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb,
lib/pact_broker/verifications/latest_verification_for_consumer_version_tag.rb,
lib/pact_broker/verifications/latest_verification_for_consumer_and_provider.rb,
lib/pact_broker/db/data_migrations/set_created_at_for_latest_pact_publications.rb,
lib/pact_broker/verifications/latest_verification_id_for_pact_version_and_provider_version.rb

Overview

All of these pacts have the same underlying pact_version_sha (content) No point verifying them multiple times, so squash all the relevant info into one “verifiable pact”

Defined Under Namespace

Modules: Api, Badges, Certificates, Config, DB, DateHelper, Diagnostic, Doc, Domain, Groups, HashRefinements, Index, Integrations, Labels, Logging, Matrix, Messages, Metrics, Pacticipants, Pacts, Relationships, Repositories, Services, StringRefinements, Tags, Test, UI, Verifications, Versions, Webhooks Classes: App, BuildHttpOptions, Configuration, ConfigurationError, DefaultPolicy, Error, FeatureToggle, TestError, UnsetAttribute, UnsetAttributeError

Constant Summary collapse

PACT_PARSING_OPTIONS =
{ max_nesting: 50 }
VERSION =
'2.59.2'
CONSUMER_VERSION_HEADER =
'X-Pact-Consumer-Version'.freeze
DO_NOT_ROLLBACK =
'X-Pact-Broker-Do-Not-Rollback'.freeze
INTEGRATIONS_TABLES =
[
  PactBroker::Webhooks::Execution,
  PactBroker::Webhooks::TriggeredWebhook,
  PactBroker::Webhooks::Webhook,
  PactBroker::Pacts::LatestPactPublicationIdForConsumerVersion,
  PactBroker::Verifications::LatestVerificationIdForPactVersionAndProviderVersion,
  PactBroker::Domain::Verification,
  PactBroker::Pacts::PactPublication,
  PactBroker::Pacts::PactVersion,
  PactBroker::Domain::Tag,
  PactBroker::Domain::Version,
  PactBroker::Domain::Label,
  PactBroker::Domain::Pacticipant
]

Class Method Summary collapse

Methods included from Logging

included, #log_error

Class Method Details

.configurationObject



9
10
11
# File 'lib/pact_broker/configuration.rb', line 9

def self.configuration
  @@configuration ||= Configuration.default_configuration
end

.feature_enabled?(feature) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/pact_broker/feature_toggle.rb', line 20

def self.feature_enabled?(feature)
  FeatureToggle.enabled?(feature)
end

.policy!(*args) ⇒ Object



46
47
48
# File 'lib/pact_broker/policies.rb', line 46

def self.policy!(*args)
  PactBroker.configuration.policy_builder.call(*args)
end

.policy_scope!(*args) ⇒ Object



50
51
52
# File 'lib/pact_broker/policies.rb', line 50

def self.policy_scope!(*args)
  PactBroker.configuration.policy_scope_builder.call(*args)
end

.project_rootObject



4
5
6
# File 'lib/pact_broker/project_root.rb', line 4

def self.project_root
  @project_root ||= Pathname.new(File.expand_path('../../../',__FILE__)).freeze
end

.reset_configurationObject

@private, for testing only



14
15
16
# File 'lib/pact_broker/configuration.rb', line 14

def self.reset_configuration
  @@configuration = Configuration.default_configuration
end