qontract-reconcile 0.10.2.dev349__py3-none-any.whl → 0.10.2.dev414__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qontract_reconcile-0.10.2.dev349.dist-info → qontract_reconcile-0.10.2.dev414.dist-info}/METADATA +12 -11
- {qontract_reconcile-0.10.2.dev349.dist-info → qontract_reconcile-0.10.2.dev414.dist-info}/RECORD +356 -350
- reconcile/acs_rbac.py +2 -2
- reconcile/aus/advanced_upgrade_service.py +15 -12
- reconcile/aus/base.py +26 -27
- reconcile/aus/cluster_version_data.py +15 -5
- reconcile/aus/models.py +1 -1
- reconcile/automated_actions/config/integration.py +15 -3
- reconcile/aws_account_manager/integration.py +8 -8
- reconcile/aws_account_manager/reconciler.py +3 -3
- reconcile/aws_ami_cleanup/integration.py +8 -12
- reconcile/aws_ami_share.py +69 -62
- reconcile/aws_cloudwatch_log_retention/integration.py +155 -126
- reconcile/aws_ecr_image_pull_secrets.py +2 -2
- reconcile/aws_iam_keys.py +7 -41
- reconcile/aws_saml_idp/integration.py +12 -4
- reconcile/aws_saml_roles/integration.py +32 -25
- reconcile/aws_version_sync/integration.py +6 -12
- reconcile/change_owners/bundle.py +3 -3
- reconcile/change_owners/change_log_tracking.py +3 -2
- reconcile/change_owners/change_owners.py +1 -1
- reconcile/change_owners/diff.py +2 -4
- reconcile/checkpoint.py +11 -3
- reconcile/cli.py +33 -8
- reconcile/dashdotdb_dora.py +5 -12
- reconcile/dashdotdb_slo.py +1 -1
- reconcile/database_access_manager.py +123 -117
- reconcile/dynatrace_token_provider/integration.py +1 -1
- reconcile/endpoints_discovery/integration.py +4 -1
- reconcile/endpoints_discovery/merge_request.py +1 -1
- reconcile/endpoints_discovery/merge_request_manager.py +9 -11
- reconcile/external_resources/factories.py +5 -12
- reconcile/external_resources/integration.py +1 -1
- reconcile/external_resources/manager.py +24 -10
- reconcile/external_resources/meta.py +0 -1
- reconcile/external_resources/metrics.py +1 -1
- reconcile/external_resources/model.py +13 -13
- reconcile/external_resources/reconciler.py +7 -4
- reconcile/external_resources/secrets_sync.py +6 -8
- reconcile/external_resources/state.py +60 -17
- reconcile/fleet_labeler/integration.py +1 -1
- reconcile/gabi_authorized_users.py +8 -5
- reconcile/gcp_image_mirror.py +2 -2
- reconcile/github_org.py +1 -1
- reconcile/github_owners.py +4 -0
- reconcile/gitlab_housekeeping.py +13 -15
- reconcile/gitlab_members.py +6 -12
- reconcile/gitlab_mr_sqs_consumer.py +2 -2
- reconcile/gitlab_owners.py +15 -11
- reconcile/gitlab_permissions.py +8 -12
- reconcile/glitchtip_project_alerts/integration.py +3 -1
- reconcile/gql_definitions/acs/acs_instances.py +5 -5
- reconcile/gql_definitions/acs/acs_policies.py +5 -5
- reconcile/gql_definitions/acs/acs_rbac.py +5 -5
- reconcile/gql_definitions/advanced_upgrade_service/aus_clusters.py +5 -5
- reconcile/gql_definitions/advanced_upgrade_service/aus_organization.py +5 -5
- reconcile/gql_definitions/app_interface_metrics_exporter/onboarding_status.py +5 -5
- reconcile/gql_definitions/app_sre_tekton_access_revalidation/roles.py +5 -5
- reconcile/gql_definitions/app_sre_tekton_access_revalidation/users.py +5 -5
- reconcile/gql_definitions/automated_actions/instance.py +46 -7
- reconcile/gql_definitions/aws_account_manager/aws_accounts.py +5 -5
- reconcile/gql_definitions/aws_ami_cleanup/aws_accounts.py +15 -5
- reconcile/gql_definitions/aws_cloudwatch_log_retention/aws_accounts.py +27 -66
- reconcile/gql_definitions/aws_saml_idp/aws_accounts.py +15 -5
- reconcile/gql_definitions/aws_saml_roles/aws_accounts.py +15 -5
- reconcile/gql_definitions/aws_saml_roles/roles.py +5 -5
- reconcile/gql_definitions/aws_version_sync/clusters.py +5 -5
- reconcile/gql_definitions/aws_version_sync/namespaces.py +5 -5
- reconcile/gql_definitions/change_owners/queries/change_types.py +5 -5
- reconcile/gql_definitions/change_owners/queries/self_service_roles.py +5 -5
- reconcile/gql_definitions/cluster_auth_rhidp/clusters.py +5 -5
- reconcile/gql_definitions/common/alerting_services_settings.py +5 -5
- reconcile/gql_definitions/common/app_code_component_repos.py +5 -5
- reconcile/gql_definitions/common/app_interface_custom_messages.py +5 -5
- reconcile/gql_definitions/common/app_interface_dms_settings.py +5 -5
- reconcile/gql_definitions/common/app_interface_repo_settings.py +5 -5
- reconcile/gql_definitions/common/app_interface_roles.py +5 -5
- reconcile/gql_definitions/common/app_interface_state_settings.py +5 -5
- reconcile/gql_definitions/common/app_interface_vault_settings.py +5 -5
- reconcile/gql_definitions/common/app_quay_repos_escalation_policies.py +5 -5
- reconcile/gql_definitions/common/apps.py +5 -5
- reconcile/gql_definitions/common/aws_vpc_requests.py +15 -5
- reconcile/gql_definitions/common/aws_vpcs.py +5 -5
- reconcile/gql_definitions/common/clusters.py +7 -5
- reconcile/gql_definitions/common/clusters_minimal.py +5 -5
- reconcile/gql_definitions/common/clusters_with_dms.py +5 -5
- reconcile/gql_definitions/common/clusters_with_peering.py +5 -5
- reconcile/gql_definitions/common/github_orgs.py +5 -5
- reconcile/gql_definitions/common/jira_settings.py +5 -5
- reconcile/gql_definitions/common/jiralert_settings.py +5 -5
- reconcile/gql_definitions/common/ldap_settings.py +5 -5
- reconcile/gql_definitions/common/namespaces.py +5 -5
- reconcile/gql_definitions/common/namespaces_minimal.py +7 -5
- reconcile/gql_definitions/common/ocm_env_telemeter.py +5 -5
- reconcile/gql_definitions/common/ocm_environments.py +5 -5
- reconcile/gql_definitions/common/pagerduty_instances.py +5 -5
- reconcile/gql_definitions/common/pgp_reencryption_settings.py +5 -5
- reconcile/gql_definitions/common/pipeline_providers.py +5 -5
- reconcile/gql_definitions/common/quay_instances.py +5 -5
- reconcile/gql_definitions/common/quay_orgs.py +5 -5
- reconcile/gql_definitions/common/reserved_networks.py +5 -5
- reconcile/gql_definitions/common/rhcs_provider_settings.py +5 -5
- reconcile/gql_definitions/common/saas_files.py +5 -5
- reconcile/gql_definitions/common/saas_target_namespaces.py +5 -5
- reconcile/gql_definitions/common/saasherder_settings.py +5 -5
- reconcile/gql_definitions/common/slack_workspaces.py +5 -5
- reconcile/gql_definitions/common/smtp_client_settings.py +5 -5
- reconcile/gql_definitions/common/state_aws_account.py +5 -5
- reconcile/gql_definitions/common/users.py +5 -5
- reconcile/gql_definitions/common/users_with_paths.py +5 -5
- reconcile/gql_definitions/cost_report/app_names.py +5 -5
- reconcile/gql_definitions/cost_report/cost_namespaces.py +5 -5
- reconcile/gql_definitions/cost_report/settings.py +5 -5
- reconcile/gql_definitions/dashdotdb_slo/slo_documents_query.py +5 -5
- reconcile/gql_definitions/dynatrace_token_provider/dynatrace_bootstrap_tokens.py +5 -5
- reconcile/gql_definitions/dynatrace_token_provider/token_specs.py +5 -5
- reconcile/gql_definitions/email_sender/apps.py +5 -5
- reconcile/gql_definitions/email_sender/emails.py +5 -5
- reconcile/gql_definitions/email_sender/users.py +5 -5
- reconcile/gql_definitions/endpoints_discovery/apps.py +5 -5
- reconcile/gql_definitions/external_resources/aws_accounts.py +5 -5
- reconcile/gql_definitions/external_resources/external_resources_modules.py +5 -5
- reconcile/gql_definitions/external_resources/external_resources_namespaces.py +89 -6
- reconcile/gql_definitions/external_resources/external_resources_settings.py +7 -5
- reconcile/gql_definitions/external_resources/fragments/external_resources_module_overrides.py +5 -5
- reconcile/gql_definitions/fleet_labeler/fleet_labels.py +5 -5
- reconcile/gql_definitions/fragments/aus_organization.py +5 -5
- reconcile/gql_definitions/fragments/aws_account_common.py +7 -5
- reconcile/gql_definitions/fragments/aws_account_managed.py +5 -5
- reconcile/gql_definitions/fragments/aws_account_sso.py +5 -5
- reconcile/gql_definitions/fragments/aws_infra_management_account.py +5 -5
- reconcile/gql_definitions/fragments/aws_organization.py +33 -0
- reconcile/gql_definitions/fragments/aws_vpc.py +5 -5
- reconcile/gql_definitions/fragments/aws_vpc_request.py +7 -5
- reconcile/gql_definitions/fragments/container_image_mirror.py +5 -5
- reconcile/gql_definitions/fragments/deploy_resources.py +5 -5
- reconcile/gql_definitions/fragments/disable.py +5 -5
- reconcile/gql_definitions/fragments/email_service.py +5 -5
- reconcile/gql_definitions/fragments/email_user.py +5 -5
- reconcile/gql_definitions/fragments/jumphost_common_fields.py +5 -5
- reconcile/gql_definitions/fragments/membership_source.py +5 -5
- reconcile/gql_definitions/fragments/minimal_ocm_organization.py +5 -5
- reconcile/gql_definitions/fragments/oc_connection_cluster.py +5 -5
- reconcile/gql_definitions/fragments/ocm_environment.py +5 -5
- reconcile/gql_definitions/fragments/pipeline_provider_retention.py +5 -5
- reconcile/gql_definitions/fragments/prometheus_instance.py +5 -5
- reconcile/gql_definitions/fragments/resource_limits_requirements.py +5 -5
- reconcile/gql_definitions/fragments/resource_requests_requirements.py +5 -5
- reconcile/gql_definitions/fragments/resource_values.py +5 -5
- reconcile/gql_definitions/fragments/saas_slo_document.py +5 -5
- reconcile/gql_definitions/fragments/saas_target_namespace.py +5 -5
- reconcile/gql_definitions/fragments/serviceaccount_token.py +5 -5
- reconcile/gql_definitions/fragments/terraform_state.py +5 -5
- reconcile/gql_definitions/fragments/upgrade_policy.py +5 -5
- reconcile/gql_definitions/fragments/user.py +5 -5
- reconcile/gql_definitions/fragments/vault_secret.py +5 -5
- reconcile/gql_definitions/gcp/gcp_docker_repos.py +5 -5
- reconcile/gql_definitions/gcp/gcp_projects.py +5 -5
- reconcile/gql_definitions/gitlab_members/gitlab_instances.py +5 -5
- reconcile/gql_definitions/gitlab_members/permissions.py +5 -5
- reconcile/gql_definitions/glitchtip/glitchtip_instance.py +5 -5
- reconcile/gql_definitions/glitchtip/glitchtip_project.py +5 -5
- reconcile/gql_definitions/glitchtip_project_alerts/glitchtip_project.py +5 -5
- reconcile/gql_definitions/integrations/integrations.py +5 -5
- reconcile/gql_definitions/introspection.json +2137 -1053
- reconcile/gql_definitions/jenkins_configs/jenkins_configs.py +5 -5
- reconcile/gql_definitions/jenkins_configs/jenkins_instances.py +5 -5
- reconcile/gql_definitions/jira/jira_servers.py +5 -5
- reconcile/gql_definitions/jira_permissions_validator/jira_boards_for_permissions_validator.py +9 -5
- reconcile/gql_definitions/jumphosts/jumphosts.py +5 -5
- reconcile/gql_definitions/ldap_groups/roles.py +5 -5
- reconcile/gql_definitions/ldap_groups/settings.py +5 -5
- reconcile/gql_definitions/maintenance/maintenances.py +5 -5
- reconcile/gql_definitions/membershipsources/roles.py +5 -5
- reconcile/gql_definitions/ocm_labels/clusters.py +5 -5
- reconcile/gql_definitions/ocm_labels/organizations.py +5 -5
- reconcile/gql_definitions/openshift_cluster_bots/clusters.py +5 -5
- reconcile/gql_definitions/openshift_groups/managed_groups.py +5 -5
- reconcile/gql_definitions/openshift_groups/managed_roles.py +5 -5
- reconcile/gql_definitions/openshift_serviceaccount_tokens/tokens.py +5 -5
- reconcile/gql_definitions/quay_membership/quay_membership.py +5 -5
- reconcile/gql_definitions/rhcs/certs.py +5 -5
- reconcile/gql_definitions/rhidp/organizations.py +5 -5
- reconcile/gql_definitions/service_dependencies/jenkins_instance_fragment.py +5 -5
- reconcile/gql_definitions/service_dependencies/service_dependencies.py +5 -5
- reconcile/gql_definitions/sharding/aws_accounts.py +5 -5
- reconcile/gql_definitions/sharding/ocm_organization.py +5 -5
- reconcile/gql_definitions/skupper_network/site_controller_template.py +5 -5
- reconcile/gql_definitions/skupper_network/skupper_networks.py +5 -5
- reconcile/gql_definitions/slack_usergroups/clusters.py +5 -5
- reconcile/gql_definitions/slack_usergroups/permissions.py +5 -5
- reconcile/gql_definitions/slack_usergroups/users.py +5 -5
- reconcile/gql_definitions/slo_documents/slo_documents.py +5 -5
- reconcile/gql_definitions/status_board/status_board.py +5 -5
- reconcile/gql_definitions/statuspage/statuspages.py +5 -5
- reconcile/gql_definitions/templating/template_collection.py +5 -5
- reconcile/gql_definitions/templating/templates.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_dns/app_interface_cloudflare_dns_settings.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_dns/terraform_cloudflare_zones.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_resources/terraform_cloudflare_accounts.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_resources/terraform_cloudflare_resources.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_users/app_interface_setting_cloudflare_and_vault.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_users/terraform_cloudflare_roles.py +5 -5
- reconcile/gql_definitions/terraform_init/aws_accounts.py +19 -5
- reconcile/gql_definitions/terraform_repo/terraform_repo.py +5 -5
- reconcile/gql_definitions/terraform_resources/database_access_manager.py +5 -5
- reconcile/gql_definitions/terraform_resources/terraform_resources_namespaces.py +38 -6
- reconcile/gql_definitions/terraform_tgw_attachments/aws_accounts.py +15 -5
- reconcile/gql_definitions/unleash_feature_toggles/feature_toggles.py +5 -5
- reconcile/gql_definitions/vault_instances/vault_instances.py +5 -5
- reconcile/gql_definitions/vault_policies/vault_policies.py +5 -5
- reconcile/gql_definitions/vpc_peerings_validator/vpc_peerings_validator.py +5 -5
- reconcile/gql_definitions/vpc_peerings_validator/vpc_peerings_validator_peered_cluster_fragment.py +5 -5
- reconcile/integrations_manager.py +3 -3
- reconcile/jenkins_worker_fleets.py +10 -8
- reconcile/jira_permissions_validator.py +237 -122
- reconcile/ldap_groups/integration.py +1 -1
- reconcile/ocm/types.py +35 -56
- reconcile/ocm_aws_infrastructure_access.py +1 -1
- reconcile/ocm_clusters.py +4 -4
- reconcile/ocm_labels/integration.py +3 -2
- reconcile/ocm_machine_pools.py +23 -23
- reconcile/openshift_base.py +53 -2
- reconcile/openshift_cluster_bots.py +3 -2
- reconcile/openshift_namespace_labels.py +1 -1
- reconcile/openshift_namespaces.py +97 -101
- reconcile/openshift_resources_base.py +6 -2
- reconcile/openshift_rhcs_certs.py +5 -5
- reconcile/openshift_rolebindings.py +7 -11
- reconcile/openshift_saas_deploy.py +6 -7
- reconcile/openshift_saas_deploy_change_tester.py +9 -7
- reconcile/openshift_saas_deploy_trigger_cleaner.py +3 -5
- reconcile/openshift_serviceaccount_tokens.py +2 -2
- reconcile/openshift_upgrade_watcher.py +4 -4
- reconcile/oum/labelset.py +5 -3
- reconcile/oum/models.py +1 -4
- reconcile/prometheus_rules_tester/integration.py +3 -3
- reconcile/quay_mirror.py +1 -1
- reconcile/queries.py +131 -1
- reconcile/rhidp/common.py +3 -5
- reconcile/rhidp/sso_client/base.py +1 -1
- reconcile/saas_auto_promotions_manager/merge_request_manager/renderer.py +1 -1
- reconcile/saas_auto_promotions_manager/subscriber.py +4 -3
- reconcile/skupper_network/integration.py +2 -2
- reconcile/slack_usergroups.py +35 -14
- reconcile/sql_query.py +1 -0
- reconcile/status_board.py +6 -6
- reconcile/statuspage/atlassian.py +7 -7
- reconcile/statuspage/integrations/maintenances.py +4 -3
- reconcile/statuspage/page.py +4 -9
- reconcile/statuspage/status.py +5 -8
- reconcile/templates/rosa-classic-cluster-creation.sh.j2 +4 -0
- reconcile/templates/rosa-hcp-cluster-creation.sh.j2 +3 -0
- reconcile/templating/lib/rendering.py +3 -3
- reconcile/templating/renderer.py +4 -3
- reconcile/terraform_aws_route53.py +7 -1
- reconcile/terraform_cloudflare_dns.py +3 -3
- reconcile/terraform_cloudflare_resources.py +5 -5
- reconcile/terraform_cloudflare_users.py +3 -2
- reconcile/terraform_init/integration.py +187 -23
- reconcile/terraform_repo.py +16 -12
- reconcile/terraform_resources.py +17 -7
- reconcile/terraform_tgw_attachments.py +27 -19
- reconcile/terraform_users.py +7 -0
- reconcile/terraform_vpc_peerings.py +14 -3
- reconcile/terraform_vpc_resources/integration.py +10 -1
- reconcile/typed_queries/aws_account_tags.py +41 -0
- reconcile/typed_queries/cost_report/app_names.py +1 -1
- reconcile/typed_queries/cost_report/cost_namespaces.py +2 -2
- reconcile/typed_queries/saas_files.py +13 -13
- reconcile/typed_queries/status_board.py +2 -2
- reconcile/unleash_feature_toggles/integration.py +4 -2
- reconcile/utils/acs/base.py +6 -3
- reconcile/utils/acs/policies.py +2 -2
- reconcile/utils/aggregated_list.py +4 -3
- reconcile/utils/aws_api.py +51 -54
- reconcile/utils/aws_api_typed/api.py +38 -9
- reconcile/utils/aws_api_typed/cloudformation.py +149 -0
- reconcile/utils/aws_api_typed/logs.py +73 -0
- reconcile/utils/aws_api_typed/organization.py +4 -2
- reconcile/utils/datetime_util.py +67 -0
- reconcile/utils/deadmanssnitch_api.py +1 -1
- reconcile/utils/differ.py +2 -3
- reconcile/utils/early_exit_cache.py +11 -12
- reconcile/utils/expiration.py +7 -3
- reconcile/utils/external_resource_spec.py +24 -1
- reconcile/utils/filtering.py +1 -1
- reconcile/utils/gitlab_api.py +7 -5
- reconcile/utils/glitchtip/client.py +6 -2
- reconcile/utils/glitchtip/models.py +25 -28
- reconcile/utils/gql.py +4 -7
- reconcile/utils/helm.py +2 -1
- reconcile/utils/helpers.py +1 -1
- reconcile/utils/instrumented_wrappers.py +1 -1
- reconcile/utils/internal_groups/client.py +2 -2
- reconcile/utils/internal_groups/models.py +8 -17
- reconcile/utils/jinja2/utils.py +6 -101
- reconcile/utils/jira_client.py +82 -63
- reconcile/utils/jjb_client.py +9 -12
- reconcile/utils/jobcontroller/controller.py +1 -1
- reconcile/utils/jobcontroller/models.py +17 -1
- reconcile/utils/json.py +70 -0
- reconcile/utils/membershipsources/app_interface_resolver.py +4 -2
- reconcile/utils/membershipsources/models.py +16 -23
- reconcile/utils/membershipsources/resolver.py +4 -2
- reconcile/utils/merge_request_manager/merge_request_manager.py +4 -4
- reconcile/utils/merge_request_manager/parser.py +6 -6
- reconcile/utils/metrics.py +5 -5
- reconcile/utils/models.py +304 -82
- reconcile/utils/mr/app_interface_reporter.py +2 -2
- reconcile/utils/mr/base.py +2 -2
- reconcile/utils/mr/notificator.py +3 -3
- reconcile/utils/mr/update_access_report_base.py +3 -4
- reconcile/utils/mr/user_maintenance.py +3 -2
- reconcile/utils/oc.py +118 -97
- reconcile/utils/oc_filters.py +3 -3
- reconcile/utils/ocm/addons.py +0 -1
- reconcile/utils/ocm/base.py +17 -20
- reconcile/utils/ocm/cluster_groups.py +1 -1
- reconcile/utils/ocm/identity_providers.py +2 -2
- reconcile/utils/ocm/labels.py +1 -1
- reconcile/utils/ocm/products.py +9 -3
- reconcile/utils/ocm/search_filters.py +3 -6
- reconcile/utils/ocm/service_log.py +4 -6
- reconcile/utils/ocm/sre_capability_labels.py +20 -13
- reconcile/utils/openshift_resource.py +10 -5
- reconcile/utils/output.py +3 -2
- reconcile/utils/pagerduty_api.py +10 -7
- reconcile/utils/promotion_state.py +6 -11
- reconcile/utils/raw_github_api.py +1 -1
- reconcile/utils/rhcsv2_certs.py +1 -4
- reconcile/utils/runtime/integration.py +2 -3
- reconcile/utils/runtime/runner.py +2 -2
- reconcile/utils/saasherder/interfaces.py +13 -20
- reconcile/utils/saasherder/models.py +25 -21
- reconcile/utils/saasherder/saasherder.py +35 -24
- reconcile/utils/slack_api.py +26 -4
- reconcile/utils/sloth.py +171 -2
- reconcile/utils/sqs_gateway.py +2 -1
- reconcile/utils/state.py +2 -1
- reconcile/utils/structs.py +1 -1
- reconcile/utils/terraform_client.py +5 -4
- reconcile/utils/terrascript_aws_client.py +171 -114
- reconcile/utils/unleash/server.py +2 -8
- reconcile/utils/vault.py +5 -12
- reconcile/utils/vcs.py +8 -8
- reconcile/vault_replication.py +107 -42
- tools/app_interface_reporter.py +4 -4
- tools/cli_commands/cost_report/cost_management_api.py +3 -3
- tools/cli_commands/cost_report/view.py +7 -6
- tools/cli_commands/erv2.py +3 -1
- tools/cli_commands/systems_and_tools.py +5 -1
- tools/qontract_cli.py +31 -18
- tools/template_validation.py +3 -1
- {qontract_reconcile-0.10.2.dev349.dist-info → qontract_reconcile-0.10.2.dev414.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev349.dist-info → qontract_reconcile-0.10.2.dev414.dist-info}/entry_points.txt +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import json
|
|
2
1
|
import logging
|
|
3
2
|
import sys
|
|
4
3
|
from collections.abc import (
|
|
@@ -7,10 +6,11 @@ from collections.abc import (
|
|
|
7
6
|
)
|
|
8
7
|
from typing import (
|
|
9
8
|
Any,
|
|
9
|
+
Self,
|
|
10
10
|
TypedDict,
|
|
11
11
|
)
|
|
12
12
|
|
|
13
|
-
from pydantic import BaseModel,
|
|
13
|
+
from pydantic import BaseModel, field_validator, model_validator
|
|
14
14
|
|
|
15
15
|
from reconcile.gql_definitions.aws_saml_roles.aws_accounts import (
|
|
16
16
|
AWSAccountV1,
|
|
@@ -22,6 +22,7 @@ from reconcile.gql_definitions.aws_saml_roles.roles import (
|
|
|
22
22
|
query as roles_query,
|
|
23
23
|
)
|
|
24
24
|
from reconcile.status import ExitCodes
|
|
25
|
+
from reconcile.typed_queries.external_resources import get_settings
|
|
25
26
|
from reconcile.utils import gql
|
|
26
27
|
from reconcile.utils.aws_api import AWSApi
|
|
27
28
|
from reconcile.utils.aws_helper import unique_sso_aws_accounts
|
|
@@ -32,6 +33,7 @@ from reconcile.utils.extended_early_exit import (
|
|
|
32
33
|
ExtendedEarlyExitRunnerResult,
|
|
33
34
|
extended_early_exit_run,
|
|
34
35
|
)
|
|
36
|
+
from reconcile.utils.json import json_dumps
|
|
35
37
|
from reconcile.utils.runtime.integration import (
|
|
36
38
|
PydanticRunParams,
|
|
37
39
|
QontractReconcileIntegration,
|
|
@@ -58,7 +60,8 @@ class AwsSamlRolesIntegrationParams(PydanticRunParams):
|
|
|
58
60
|
extended_early_exit_cache_ttl_seconds: int = 3600
|
|
59
61
|
log_cached_log_output: bool = False
|
|
60
62
|
|
|
61
|
-
@
|
|
63
|
+
@field_validator("max_session_duration_hours")
|
|
64
|
+
@classmethod
|
|
62
65
|
def max_session_duration_range(cls, v: str | int) -> int:
|
|
63
66
|
if 1 <= int(v) <= 12:
|
|
64
67
|
return int(v)
|
|
@@ -69,7 +72,8 @@ class CustomPolicy(BaseModel):
|
|
|
69
72
|
name: str
|
|
70
73
|
policy: dict[str, Any]
|
|
71
74
|
|
|
72
|
-
@
|
|
75
|
+
@field_validator("name")
|
|
76
|
+
@classmethod
|
|
73
77
|
def name_size(cls, v: str) -> str:
|
|
74
78
|
"""Check the policy name size.
|
|
75
79
|
|
|
@@ -81,13 +85,14 @@ class CustomPolicy(BaseModel):
|
|
|
81
85
|
)
|
|
82
86
|
return v
|
|
83
87
|
|
|
84
|
-
@
|
|
88
|
+
@field_validator("policy")
|
|
89
|
+
@classmethod
|
|
85
90
|
def policy_size(cls, v: dict[str, Any]) -> dict[str, Any]:
|
|
86
91
|
"""Check the policy size.
|
|
87
92
|
|
|
88
93
|
See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html
|
|
89
94
|
"""
|
|
90
|
-
if len(
|
|
95
|
+
if len(json_dumps(v, compact=True)) > 6144:
|
|
91
96
|
raise ValueError(
|
|
92
97
|
f"The policy document '{v}' is too large. AWS policy documents must be 6144 characters or less (w/o white spaces)."
|
|
93
98
|
)
|
|
@@ -104,7 +109,8 @@ class AwsRole(BaseModel):
|
|
|
104
109
|
custom_policies: list[CustomPolicy]
|
|
105
110
|
managed_policies: list[ManagedPolicy]
|
|
106
111
|
|
|
107
|
-
@
|
|
112
|
+
@field_validator("name")
|
|
113
|
+
@classmethod
|
|
108
114
|
def name_size(cls, v: str) -> str:
|
|
109
115
|
"""Check the role name size.
|
|
110
116
|
|
|
@@ -116,29 +122,23 @@ class AwsRole(BaseModel):
|
|
|
116
122
|
)
|
|
117
123
|
return v
|
|
118
124
|
|
|
119
|
-
@
|
|
120
|
-
def validate_policies(
|
|
125
|
+
@model_validator(mode="after")
|
|
126
|
+
def validate_policies(self) -> Self:
|
|
121
127
|
"""Check the policies.
|
|
122
128
|
|
|
123
129
|
See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html
|
|
124
130
|
"""
|
|
125
|
-
custom_policies
|
|
126
|
-
managed_policies = values.get("managed_policies", [])
|
|
127
|
-
if len(custom_policies) + len(managed_policies) > 20:
|
|
131
|
+
if len(self.custom_policies) + len(self.managed_policies) > 20:
|
|
128
132
|
raise ValueError(
|
|
129
|
-
f"The role '{
|
|
133
|
+
f"The role '{self.name}' has too many policies. AWS roles can have at most 20 policies (via quota increase). Please consider consolidating the policies."
|
|
130
134
|
)
|
|
131
|
-
cp_names = [cp.name for cp in custom_policies]
|
|
135
|
+
cp_names = [cp.name for cp in self.custom_policies]
|
|
132
136
|
if len(set(cp_names)) != len(cp_names):
|
|
133
|
-
raise ValueError(
|
|
134
|
-
|
|
135
|
-
)
|
|
136
|
-
mp_names = [mp.name for mp in managed_policies]
|
|
137
|
+
raise ValueError(f"The role '{self.name}' has duplicate custom policies.")
|
|
138
|
+
mp_names = [mp.name for mp in self.managed_policies]
|
|
137
139
|
if len(set(mp_names)) != len(mp_names):
|
|
138
|
-
raise ValueError(
|
|
139
|
-
|
|
140
|
-
)
|
|
141
|
-
return values
|
|
140
|
+
raise ValueError(f"The role '{self.name}' has duplicate managed policies.")
|
|
141
|
+
return self
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
class RunnerParams(TypedDict):
|
|
@@ -163,7 +163,7 @@ class AwsSamlRolesIntegration(
|
|
|
163
163
|
if not query_func:
|
|
164
164
|
query_func = gql.get_api().query
|
|
165
165
|
return {
|
|
166
|
-
"roles": [c.
|
|
166
|
+
"roles": [c.model_dump() for c in self.get_roles(query_func)],
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
def get_aws_accounts(
|
|
@@ -251,15 +251,22 @@ class AwsSamlRolesIntegration(
|
|
|
251
251
|
aws_accounts = self.get_aws_accounts(
|
|
252
252
|
gql_api.query, account_name=self.params.account_name
|
|
253
253
|
)
|
|
254
|
-
aws_accounts_dict = [
|
|
254
|
+
aws_accounts_dict = [
|
|
255
|
+
account.model_dump(by_alias=True) for account in aws_accounts
|
|
256
|
+
]
|
|
255
257
|
aws_roles = self.get_roles(gql_api.query, account_name=self.params.account_name)
|
|
256
|
-
|
|
258
|
+
try:
|
|
259
|
+
default_tags = get_settings().default_tags
|
|
260
|
+
except ValueError:
|
|
261
|
+
# no external resources settings found
|
|
262
|
+
default_tags = None
|
|
257
263
|
ts = TerrascriptClient(
|
|
258
264
|
self.name.replace("-", "_"),
|
|
259
265
|
"",
|
|
260
266
|
self.params.thread_pool_size,
|
|
261
267
|
aws_accounts_dict,
|
|
262
268
|
secret_reader=self.secret_reader,
|
|
269
|
+
default_tags=default_tags,
|
|
263
270
|
)
|
|
264
271
|
self.populate_saml_iam_roles(ts, aws_roles)
|
|
265
272
|
working_dirs = ts.dump(print_to_file=self.params.print_to_file)
|
|
@@ -7,12 +7,7 @@ from enum import StrEnum
|
|
|
7
7
|
from typing import Any
|
|
8
8
|
|
|
9
9
|
import semver
|
|
10
|
-
from pydantic import
|
|
11
|
-
BaseModel,
|
|
12
|
-
ValidationError,
|
|
13
|
-
root_validator,
|
|
14
|
-
validator,
|
|
15
|
-
)
|
|
10
|
+
from pydantic import BaseModel, ValidationError, field_validator, model_validator
|
|
16
11
|
|
|
17
12
|
from reconcile.aws_version_sync.merge_request_manager.merge_request import (
|
|
18
13
|
Renderer,
|
|
@@ -81,7 +76,7 @@ class SupportedResourceProvider(StrEnum):
|
|
|
81
76
|
ELASTICACHE = "elasticache"
|
|
82
77
|
|
|
83
78
|
|
|
84
|
-
class ExternalResource(BaseModel):
|
|
79
|
+
class ExternalResource(BaseModel, arbitrary_types_allowed=True):
|
|
85
80
|
namespace_file: str | None = None
|
|
86
81
|
provider: str = "aws"
|
|
87
82
|
provisioner: ExternalResourceProvisioner
|
|
@@ -94,9 +89,6 @@ class ExternalResource(BaseModel):
|
|
|
94
89
|
# used to map AWS cache name to resource_identifier
|
|
95
90
|
redis_replication_group_id: str | None = None
|
|
96
91
|
|
|
97
|
-
class Config:
|
|
98
|
-
arbitrary_types_allowed = True
|
|
99
|
-
|
|
100
92
|
@property
|
|
101
93
|
def key(self) -> tuple:
|
|
102
94
|
return (
|
|
@@ -106,7 +98,8 @@ class ExternalResource(BaseModel):
|
|
|
106
98
|
self.resource_identifier,
|
|
107
99
|
)
|
|
108
100
|
|
|
109
|
-
@
|
|
101
|
+
@field_validator("resource_engine_version", mode="before")
|
|
102
|
+
@classmethod
|
|
110
103
|
def parse_resource_engine_version(
|
|
111
104
|
cls, v: str | semver.VersionInfo
|
|
112
105
|
) -> semver.VersionInfo:
|
|
@@ -114,7 +107,8 @@ class ExternalResource(BaseModel):
|
|
|
114
107
|
return v
|
|
115
108
|
return parse_semver(str(v), optional_minor_and_patch=True)
|
|
116
109
|
|
|
117
|
-
@
|
|
110
|
+
@model_validator(mode="before")
|
|
111
|
+
@classmethod
|
|
118
112
|
def set_resource_engine_version_format(cls, values: dict) -> dict:
|
|
119
113
|
resource_engine_version, resource_engine_version_format = (
|
|
120
114
|
str(values.get("resource_engine_version")),
|
|
@@ -62,8 +62,8 @@ class QontractServerDatafileDiff(BaseModel):
|
|
|
62
62
|
|
|
63
63
|
datafilepath: str
|
|
64
64
|
datafileschema: str
|
|
65
|
-
old: dict[str, Any] | None
|
|
66
|
-
new: dict[str, Any] | None
|
|
65
|
+
old: dict[str, Any] | None = None
|
|
66
|
+
new: dict[str, Any] | None = None
|
|
67
67
|
|
|
68
68
|
@property
|
|
69
69
|
def old_datafilepath(self) -> str | None:
|
|
@@ -119,7 +119,7 @@ class QontractServerResourcefileDiffState(BaseModel):
|
|
|
119
119
|
content: str
|
|
120
120
|
resourcefileschema: str | None = Field(..., alias="$schema")
|
|
121
121
|
sha256sum: str
|
|
122
|
-
backrefs: list[QontractServerResourcefileBackref] | None
|
|
122
|
+
backrefs: list[QontractServerResourcefileBackref] | None = None
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
class QontractServerResourcefileDiff(BaseModel):
|
|
@@ -155,7 +155,8 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
|
|
|
155
155
|
changes = aggregate_resource_changes(
|
|
156
156
|
bundle_changes=aggregate_file_moves(parse_bundle_changes(diff)),
|
|
157
157
|
content_store={
|
|
158
|
-
c.path: c.
|
|
158
|
+
c.path: c.model_dump(by_alias=True)
|
|
159
|
+
for c in namespaces + jenkins_configs
|
|
159
160
|
},
|
|
160
161
|
supported_schemas={
|
|
161
162
|
"/openshift/namespace-1.yml",
|
|
@@ -239,4 +240,4 @@ class ChangeLogIntegration(QontractReconcileIntegration[ChangeLogIntegrationPara
|
|
|
239
240
|
change_log.items, key=lambda i: i.merged_at, reverse=True
|
|
240
241
|
)
|
|
241
242
|
if not dry_run:
|
|
242
|
-
integration_state.add(BUNDLE_DIFFS_OBJ, change_log.
|
|
243
|
+
integration_state.add(BUNDLE_DIFFS_OBJ, change_log.model_dump(), force=True)
|
|
@@ -140,7 +140,7 @@ def write_coverage_report_to_mr(
|
|
|
140
140
|
approver_reachability = set()
|
|
141
141
|
for d in change_decisions:
|
|
142
142
|
approvers = [
|
|
143
|
-
f"{cr.context} - {' '.join([f'@{a.org_username}' if a.tag_on_merge_requests else a.org_username for a in cr.approvers])}"
|
|
143
|
+
f"{cr.context} - {' '.join([f'@{a.org_username}' if (a.tag_on_merge_requests or len(cr.approvers) == 1) else a.org_username for a in cr.approvers])}"
|
|
144
144
|
for cr in d.change_responsibles
|
|
145
145
|
]
|
|
146
146
|
if d.coverable_by_fragment_decisions:
|
reconcile/change_owners/diff.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import copy
|
|
2
|
-
import json
|
|
3
2
|
from dataclasses import dataclass
|
|
4
3
|
from enum import Enum
|
|
5
4
|
from functools import reduce
|
|
@@ -11,6 +10,7 @@ from deepdiff.helper import CannotCompare
|
|
|
11
10
|
from deepdiff.model import DiffLevel
|
|
12
11
|
from deepdiff.path import parse_path
|
|
13
12
|
|
|
13
|
+
from reconcile.utils.json import json_dumps
|
|
14
14
|
from reconcile.utils.jsonpath import parse_jsonpath
|
|
15
15
|
|
|
16
16
|
|
|
@@ -75,7 +75,7 @@ class Diff:
|
|
|
75
75
|
def _value_repr(self, value: Any | None) -> str | None:
|
|
76
76
|
if value:
|
|
77
77
|
if isinstance(value, dict | list):
|
|
78
|
-
return
|
|
78
|
+
return json_dumps(value, indent=2)
|
|
79
79
|
return str(value)
|
|
80
80
|
return value
|
|
81
81
|
|
|
@@ -251,8 +251,6 @@ def deepdiff_path_to_jsonpath(deep_diff_path: str) -> jsonpath_ng.JSONPath:
|
|
|
251
251
|
case int():
|
|
252
252
|
return jsonpath_ng.Index(element)
|
|
253
253
|
case str():
|
|
254
|
-
if "." in element:
|
|
255
|
-
return jsonpath_ng.Fields(f"'{element}'")
|
|
256
254
|
return jsonpath_ng.Fields(element)
|
|
257
255
|
|
|
258
256
|
path_parts = [build_jsonpath_part(p) for p in parse_path(deep_diff_path)]
|
reconcile/checkpoint.py
CHANGED
|
@@ -26,6 +26,7 @@ from jira import Issue
|
|
|
26
26
|
|
|
27
27
|
from reconcile.utils.constants import PROJ_ROOT
|
|
28
28
|
from reconcile.utils.jira_client import JiraClient
|
|
29
|
+
from reconcile.utils.secret_reader import SecretReaderBase
|
|
29
30
|
|
|
30
31
|
DEFAULT_CHECKPOINT_LABELS = ("sre-checkpoint",)
|
|
31
32
|
|
|
@@ -118,8 +119,8 @@ def file_ticket(
|
|
|
118
119
|
def report_invalid_metadata(
|
|
119
120
|
app: Mapping[str, Any],
|
|
120
121
|
path: str,
|
|
121
|
-
board: Mapping[str,
|
|
122
|
-
|
|
122
|
+
board: Mapping[str, Any],
|
|
123
|
+
secret_reader: SecretReaderBase,
|
|
123
124
|
parent: str,
|
|
124
125
|
dry_run: bool = False,
|
|
125
126
|
) -> None:
|
|
@@ -150,7 +151,14 @@ def report_invalid_metadata(
|
|
|
150
151
|
path=path,
|
|
151
152
|
)
|
|
152
153
|
else:
|
|
153
|
-
jira = JiraClient(
|
|
154
|
+
jira = JiraClient.create(
|
|
155
|
+
project_name=board["name"],
|
|
156
|
+
token=secret_reader.read_secret(board["server"]["token"]),
|
|
157
|
+
email=secret_reader.read_secret(board["server"]["email"])
|
|
158
|
+
if board["server"]["email"]
|
|
159
|
+
else None,
|
|
160
|
+
server_url=board["server"]["server_url"],
|
|
161
|
+
)
|
|
154
162
|
do_cut = partial(
|
|
155
163
|
file_ticket, # type: ignore
|
|
156
164
|
jira=jira,
|
reconcile/cli.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# ruff: noqa: PLC0415 - `import` should be at the top-level of a file
|
|
2
2
|
import faulthandler
|
|
3
|
-
import json
|
|
4
3
|
import logging
|
|
5
4
|
import os
|
|
6
5
|
import re
|
|
@@ -31,6 +30,7 @@ from reconcile.utils.constants import DEFAULT_THREAD_POOL_SIZE
|
|
|
31
30
|
from reconcile.utils.exceptions import PrintToFileInGitRepositoryError
|
|
32
31
|
from reconcile.utils.git import is_file_in_git_repo
|
|
33
32
|
from reconcile.utils.gql import GqlApiSingleton
|
|
33
|
+
from reconcile.utils.json import json_dumps
|
|
34
34
|
from reconcile.utils.promtool import PROMTOOL_VERSION, PROMTOOL_VERSION_REGEX
|
|
35
35
|
from reconcile.utils.runtime.environment import init_env
|
|
36
36
|
from reconcile.utils.runtime.integration import (
|
|
@@ -608,7 +608,7 @@ def run_class_integration(
|
|
|
608
608
|
if dump_schemas_file:
|
|
609
609
|
gqlapi = gql.get_api()
|
|
610
610
|
with open(dump_schemas_file, "w", encoding="locale") as f:
|
|
611
|
-
f.write(
|
|
611
|
+
f.write(json_dumps(gqlapi.get_queried_schemas()))
|
|
612
612
|
|
|
613
613
|
|
|
614
614
|
@click.group()
|
|
@@ -1028,7 +1028,7 @@ def aws_account_manager(
|
|
|
1028
1028
|
"--state-tmpl-resource",
|
|
1029
1029
|
help="Resource name of the state template-collection template in the app-interface.",
|
|
1030
1030
|
required=True,
|
|
1031
|
-
default="/terraform-init/terraform-state.yml",
|
|
1031
|
+
default="/terraform-init/terraform-state.yml.j2",
|
|
1032
1032
|
)
|
|
1033
1033
|
@click.option(
|
|
1034
1034
|
"--template-collection-root-path",
|
|
@@ -1036,12 +1036,26 @@ def aws_account_manager(
|
|
|
1036
1036
|
required=True,
|
|
1037
1037
|
default="data/templating/collections/terraform-init",
|
|
1038
1038
|
)
|
|
1039
|
+
@click.option(
|
|
1040
|
+
"--cloudformation-template-resource",
|
|
1041
|
+
help="Resource name of the CloudFormation template to create the S3 bucket",
|
|
1042
|
+
required=True,
|
|
1043
|
+
default="/terraform-init/terraform-state-s3-bucket.yaml",
|
|
1044
|
+
)
|
|
1045
|
+
@click.option(
|
|
1046
|
+
"--cloudformation-import-template-resource",
|
|
1047
|
+
help="Resource name of the CloudFormation template to import existing S3 bucket",
|
|
1048
|
+
required=True,
|
|
1049
|
+
default="/terraform-init/terraform-state-s3-bucket-import.yaml",
|
|
1050
|
+
)
|
|
1039
1051
|
@click.pass_context
|
|
1040
1052
|
def terraform_init(
|
|
1041
1053
|
ctx: click.Context,
|
|
1042
1054
|
account_name: str | None,
|
|
1043
1055
|
state_tmpl_resource: str,
|
|
1044
1056
|
template_collection_root_path: str,
|
|
1057
|
+
cloudformation_template_resource: str,
|
|
1058
|
+
cloudformation_import_template_resource: str,
|
|
1045
1059
|
) -> None:
|
|
1046
1060
|
from reconcile.terraform_init.integration import (
|
|
1047
1061
|
TerraformInitIntegration,
|
|
@@ -1054,6 +1068,8 @@ def terraform_init(
|
|
|
1054
1068
|
account_name=account_name,
|
|
1055
1069
|
state_tmpl_resource=state_tmpl_resource,
|
|
1056
1070
|
template_collection_root_path=template_collection_root_path,
|
|
1071
|
+
cloudformation_template_resource=cloudformation_template_resource,
|
|
1072
|
+
cloudformation_import_template_resource=cloudformation_import_template_resource,
|
|
1057
1073
|
)
|
|
1058
1074
|
),
|
|
1059
1075
|
ctx=ctx,
|
|
@@ -1135,9 +1151,17 @@ def jenkins_webhooks_cleaner(ctx: click.Context) -> None:
|
|
|
1135
1151
|
"--jira-board-name", help="The Jira board to act on.", default=None, multiple=True
|
|
1136
1152
|
)
|
|
1137
1153
|
@click.option("--board-check-interval", help="Check interval in minutes", default=120)
|
|
1154
|
+
@click.option(
|
|
1155
|
+
"--use-cache/--no-use-cache",
|
|
1156
|
+
default=True,
|
|
1157
|
+
help="Use cached results for validation.",
|
|
1158
|
+
)
|
|
1138
1159
|
@click.pass_context
|
|
1139
1160
|
def jira_permissions_validator(
|
|
1140
|
-
ctx: click.Context,
|
|
1161
|
+
ctx: click.Context,
|
|
1162
|
+
jira_board_name: Iterable[str] | None,
|
|
1163
|
+
board_check_interval: int,
|
|
1164
|
+
use_cache: bool,
|
|
1141
1165
|
) -> None:
|
|
1142
1166
|
import reconcile.jira_permissions_validator
|
|
1143
1167
|
|
|
@@ -1146,6 +1170,7 @@ def jira_permissions_validator(
|
|
|
1146
1170
|
ctx,
|
|
1147
1171
|
jira_board_name=jira_board_name,
|
|
1148
1172
|
board_check_interval_sec=board_check_interval * 60,
|
|
1173
|
+
use_cache=use_cache,
|
|
1149
1174
|
)
|
|
1150
1175
|
|
|
1151
1176
|
|
|
@@ -1270,14 +1295,14 @@ def aws_ami_cleanup(ctx: click.Context, thread_pool_size: int) -> None:
|
|
|
1270
1295
|
run_integration(reconcile.aws_ami_cleanup.integration, ctx, thread_pool_size)
|
|
1271
1296
|
|
|
1272
1297
|
|
|
1273
|
-
@integration.command(short_help="Set up retention period for Cloudwatch logs.")
|
|
1274
|
-
@threaded()
|
|
1298
|
+
@integration.command(short_help="Set up retention period and tags for Cloudwatch logs.")
|
|
1275
1299
|
@click.pass_context
|
|
1276
|
-
def aws_cloudwatch_log_retention(ctx: click.Context
|
|
1300
|
+
def aws_cloudwatch_log_retention(ctx: click.Context) -> None:
|
|
1277
1301
|
import reconcile.aws_cloudwatch_log_retention.integration
|
|
1278
1302
|
|
|
1279
1303
|
run_integration(
|
|
1280
|
-
reconcile.aws_cloudwatch_log_retention.integration,
|
|
1304
|
+
reconcile.aws_cloudwatch_log_retention.integration,
|
|
1305
|
+
ctx,
|
|
1281
1306
|
)
|
|
1282
1307
|
|
|
1283
1308
|
|
reconcile/dashdotdb_dora.py
CHANGED
|
@@ -4,7 +4,6 @@ from collections import defaultdict
|
|
|
4
4
|
from collections.abc import Iterable, Mapping
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
from datetime import (
|
|
7
|
-
UTC,
|
|
8
7
|
datetime,
|
|
9
8
|
timedelta,
|
|
10
9
|
)
|
|
@@ -31,6 +30,7 @@ from reconcile.typed_queries.app_interface_vault_settings import (
|
|
|
31
30
|
get_app_interface_vault_settings,
|
|
32
31
|
)
|
|
33
32
|
from reconcile.typed_queries.saas_files import get_saas_files
|
|
33
|
+
from reconcile.utils.datetime_util import ensure_utc, utc_now
|
|
34
34
|
from reconcile.utils.github_api import GithubRepositoryApi
|
|
35
35
|
from reconcile.utils.gitlab_api import GitLabApi
|
|
36
36
|
from reconcile.utils.secret_reader import create_secret_reader
|
|
@@ -159,15 +159,8 @@ class Commit:
|
|
|
159
159
|
date: datetime
|
|
160
160
|
|
|
161
161
|
def lttc(self, finish_timestamp: datetime) -> int:
|
|
162
|
-
commit_date_tzaware = self.date
|
|
163
|
-
finish_timestamp_tzaware = finish_timestamp
|
|
164
|
-
|
|
165
|
-
if commit_date_tzaware.tzinfo is None:
|
|
166
|
-
commit_date_tzaware = commit_date_tzaware.replace(tzinfo=UTC)
|
|
167
|
-
|
|
168
|
-
if finish_timestamp_tzaware.tzinfo is None:
|
|
169
|
-
finish_timestamp_tzaware = finish_timestamp_tzaware.replace(tzinfo=UTC)
|
|
170
|
-
|
|
162
|
+
commit_date_tzaware = ensure_utc(self.date)
|
|
163
|
+
finish_timestamp_tzaware = ensure_utc(finish_timestamp)
|
|
171
164
|
return int((finish_timestamp_tzaware - commit_date_tzaware).total_seconds())
|
|
172
165
|
|
|
173
166
|
|
|
@@ -277,7 +270,7 @@ class DashdotdbDORA(DashdotdbBase):
|
|
|
277
270
|
# from the DB for a unique (app_name, env_name) multiple times.
|
|
278
271
|
app_envs = {s.app_env for s in saastargets}
|
|
279
272
|
|
|
280
|
-
since_default =
|
|
273
|
+
since_default = utc_now() - timedelta(days=90)
|
|
281
274
|
app_env_since_list: list[tuple[AppEnv, datetime]] = threaded.run(
|
|
282
275
|
func=functools.partial(self.get_latest_with_default, since_default),
|
|
283
276
|
iterable=app_envs,
|
|
@@ -473,7 +466,7 @@ class DashdotdbDORA(DashdotdbBase):
|
|
|
473
466
|
]
|
|
474
467
|
|
|
475
468
|
def _github_compare_commits(self, rc: RepoChanges, repo: str) -> list[Commit]:
|
|
476
|
-
if not rc.repo_url:
|
|
469
|
+
if not rc.repo_url or not rc.ref_from or not rc.ref_to:
|
|
477
470
|
return []
|
|
478
471
|
|
|
479
472
|
return [
|
reconcile/dashdotdb_slo.py
CHANGED