aiverify-moonshot 0.4.4__tar.gz → 0.4.6__tar.gz
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.
- aiverify_moonshot-0.4.6/.github/scripts/create_backup.sh +40 -0
- aiverify_moonshot-0.4.6/.github/scripts/install_ms_service.sh +52 -0
- aiverify_moonshot-0.4.6/.github/scripts/moonshot_env +28 -0
- aiverify_moonshot-0.4.6/.github/scripts/moonshot_test_env +7 -0
- aiverify_moonshot-0.4.6/.github/scripts/moonshot_ui_env +5 -0
- aiverify_moonshot-0.4.6/.github/scripts/run_smoke_test.sh +53 -0
- aiverify_moonshot-0.4.6/.github/scripts/start_ms_service.sh +10 -0
- aiverify_moonshot-0.4.4/.github/workflows/smoke-test.yaml → aiverify_moonshot-0.4.6/.github/workflows/integration-test.yaml +24 -19
- aiverify_moonshot-0.4.6/.github/workflows/nightly-build.yaml +189 -0
- aiverify_moonshot-0.4.6/.github/workflows/pre-build-checks.yaml +183 -0
- aiverify_moonshot-0.4.6/.github/workflows/pypi-deployment.yaml +101 -0
- aiverify_moonshot-0.4.6/.github/workflows/sast-codeql.yaml +157 -0
- aiverify_moonshot-0.4.4/.github/workflows/sca_scan.yaml → aiverify_moonshot-0.4.6/.github/workflows/sca-scan.yaml +13 -3
- aiverify_moonshot-0.4.6/.github/workflows/smoke-test.yaml +135 -0
- aiverify_moonshot-0.4.6/.github/workflows/test-pypi-deployment.yaml +61 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/PKG-INFO +3 -2
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/README.md +1 -1
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/__main__.py +125 -54
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/benchmark/cookbook.py +226 -42
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/benchmark/datasets.py +53 -8
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/benchmark/metrics.py +48 -7
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/benchmark/recipe.py +283 -42
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/benchmark/result.py +73 -30
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/benchmark/run.py +43 -11
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/benchmark/runner.py +29 -20
- aiverify_moonshot-0.4.6/moonshot/integrations/cli/cli_errors.py +511 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/common/connectors.py +137 -6
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/common/dataset.py +66 -13
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/common/prompt_template.py +38 -2
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/redteam/session.py +126 -43
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/app.py +1 -1
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/bookmark.py +7 -4
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_bookmark.py +6 -6
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/bookmark/bookmark.py +119 -60
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/bookmark/bookmark_arguments.py +10 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/configs/env_variables.py +7 -3
- aiverify_moonshot-0.4.6/moonshot/src/messages_constants.py +40 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/runners/runner.py +1 -1
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/runs/run.py +7 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/pyproject.toml +9 -7
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/requirements.txt +6 -6
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/.coveragerc +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/.flake8 +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/.github/pull_request_template.md +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/.gitignore +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/.pre-commit-config.yaml +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/AUTHORS.md +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/LICENSE.md +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/NOTICES.md +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/api.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/__main__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/active_session_cfg.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/benchmark/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/benchmark/benchmark.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/cli.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/common/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/common/common.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/common/display_helper.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/initialisation/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/initialisation/initialisation.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/redteam/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/redteam/attack_module.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/redteam/context_strategy.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/redteam/prompt_template.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/redteam/redteam.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/cli/utils/process_data.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/.env.dev +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/__main__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/container.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/log/.gitkeep +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/logging_conf.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/attack_modules.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/benchmark.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/benchmark_result.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/context_strategy.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/cookbook.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/dataset.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/endpoint.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/metric.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/prompt_template.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/recipe.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/redteam.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/routes/runner.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/benchmark_runner_dto.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/bookmark_create_dto.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/cookbook_create_dto.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/cookbook_response_model.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/dataset_create_dto.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/dataset_response_dto.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/endpoint_create_dto.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/endpoint_response_model.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/prompt_response_model.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/prompt_template_response_model.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/recipe_create_dto.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/recipe_response_model.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/session_create_dto.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/session_prompt_dto.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/schemas/session_response_model.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/attack_module_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/auto_red_team_test_manager.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/auto_red_team_test_state.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/base_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/benchmark_result_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/benchmark_test_manager.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/benchmark_test_state.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/benchmarking_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/bookmark_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/context_strategy_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/cookbook_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/dataset_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/endpoint_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/metric_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/prompt_template_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/recipe_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/runner_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/session_service.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/utils/exceptions_handler.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/utils/file_manager.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/services/utils/results_formatter.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/status_updater/interface/benchmark_progress_callback.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/status_updater/interface/redteam_progress_callback.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/status_updater/moonshot_ui_webhook.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/temp/.gitkeep +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/integrations/web_api/types/types.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_connector.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_connector_endpoint.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_context_strategy.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_cookbook.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_dataset.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_environment_variables.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_metrics.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_prompt_template.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_recipe.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_red_teaming.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_result.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_run.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_runner.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/api/api_session.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/configs/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/connectors/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/connectors/connector.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/connectors/connector_prompt_arguments.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/connectors_endpoints/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/connectors_endpoints/connector_endpoint.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/connectors_endpoints/connector_endpoint_arguments.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/cookbooks/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/cookbooks/cookbook.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/cookbooks/cookbook_arguments.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/datasets/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/datasets/dataset.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/datasets/dataset_arguments.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/metrics/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/metrics/metric.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/metrics/metric_interface.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/prompt_templates/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/prompt_templates/prompt_template.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/recipes/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/recipes/recipe.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/recipes/recipe_arguments.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/attack/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/attack/attack_module.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/attack/attack_module_arguments.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/attack/context_strategy.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/context_strategy/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/context_strategy/context_strategy_interface.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/session/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/session/chat.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/session/red_teaming_progress.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/session/red_teaming_type.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/redteaming/session/session.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/results/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/results/result.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/results/result_arguments.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/runners/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/runners/runner_arguments.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/runners/runner_type.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/runs/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/runs/run_arguments.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/runs/run_progress.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/runs/run_status.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/storage/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/storage/db_interface.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/storage/io_interface.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/storage/storage.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/utils/__init__.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/utils/find_feature.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/utils/import_modules.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/utils/log.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/utils/pagination.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/moonshot/src/utils/timeit.py +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/third-party/pygments-2.18.0-py3-none-any.whl +0 -0
- {aiverify_moonshot-0.4.4 → aiverify_moonshot-0.4.6}/third-party/text_unidecode-1.3-py2.py3-none-any.whl +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
BASE_DIR=~/moonshot
|
|
4
|
+
MOONSHOT_DIR=moonshot-sit
|
|
5
|
+
|
|
6
|
+
# Moonshot SIT dir
|
|
7
|
+
SIT_DIR=$BASE_DIR/$MOONSHOT_DIR
|
|
8
|
+
|
|
9
|
+
# Backup directory and the maximum number of backups
|
|
10
|
+
BACKUP_DIR=$BASE_DIR/backups
|
|
11
|
+
MAX_BACKUPS=5
|
|
12
|
+
|
|
13
|
+
# Check if the moonshot directory exists
|
|
14
|
+
if [ ! -d $SIT_DIR ]; then
|
|
15
|
+
echo "Skip backup: $SIT_DIR dir does not exist."
|
|
16
|
+
exit 0
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Create the backup directory if it doesn't exist
|
|
20
|
+
mkdir -p $BACKUP_DIR
|
|
21
|
+
|
|
22
|
+
# Find the highest existing backup number
|
|
23
|
+
highest_backup=$(ls $BACKUP_DIR | grep -oP 'backup_\d+' | grep -oP '\d+' | sort -n | tail -1)
|
|
24
|
+
highest_backup=${highest_backup:-0}
|
|
25
|
+
|
|
26
|
+
# If the number of backups is less than the maximum, increment the highest backup number
|
|
27
|
+
if [ $(ls $BACKUP_DIR | wc -l) -lt $MAX_BACKUPS ]; then
|
|
28
|
+
new_backup=$((highest_backup + 1))
|
|
29
|
+
else
|
|
30
|
+
# If the number of backups is equal to the maximum, delete the oldest backup and shift the remaining backups
|
|
31
|
+
oldest_backup=$(ls $BACKUP_DIR | grep -oP 'backup_\d+' | grep -oP '\d+' | sort -n | head -1)
|
|
32
|
+
rm -rf $BACKUP_DIR/backup_$oldest_backup
|
|
33
|
+
for i in $(seq $((oldest_backup + 1)) $highest_backup); do
|
|
34
|
+
mv $BACKUP_DIR/backup_$i $BACKUP_DIR/backup_$((i - 1))
|
|
35
|
+
done
|
|
36
|
+
new_backup=$highest_backup
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Create a new backup by moving the moonshot dir to the backup dir with the new backup number
|
|
40
|
+
mv $SIT_DIR $BACKUP_DIR/backup_$new_backup
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Arguments for branches, default to dev_main if not provided.
|
|
4
|
+
MOONSHOT_BRANCH=${1:-dev_main}
|
|
5
|
+
MOONSHOT_DATA_BRANCH=${2:-dev_main}
|
|
6
|
+
MOONSHOT_UI_BRANCH=${3:-dev_main}
|
|
7
|
+
|
|
8
|
+
BASE_DIR=~/moonshot
|
|
9
|
+
SCRIPTS_DIR=~/scripts
|
|
10
|
+
#BASE_DIR=./moonshot-test
|
|
11
|
+
#SCRIPTS_DIR=./.github/scripts
|
|
12
|
+
|
|
13
|
+
MOONSHOT_SIT=moonshot-sit
|
|
14
|
+
|
|
15
|
+
# Install moonshot from GitHub
|
|
16
|
+
|
|
17
|
+
# Create BASE_DIR if it does not
|
|
18
|
+
if [ ! -d "$BASE_DIR" ]; then
|
|
19
|
+
mkdir -p "$BASE_DIR"
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
cd $BASE_DIR
|
|
23
|
+
|
|
24
|
+
# Clone the repositories from the specified branches
|
|
25
|
+
echo "Cloning moonshot from branch $MOONSHOT_BRANCH"
|
|
26
|
+
echo "Cloning moonshot-data from branch $MOONSHOT_DATA_BRANCH"
|
|
27
|
+
echo "Cloning moonshot-ui from branch $MOONSHOT_UI_BRANCH"
|
|
28
|
+
git clone --branch $MOONSHOT_BRANCH https://github.com/aiverify-foundation/moonshot.git $MOONSHOT_SIT
|
|
29
|
+
cd $MOONSHOT_SIT
|
|
30
|
+
git clone --branch $MOONSHOT_DATA_BRANCH https://github.com/aiverify-foundation/moonshot-data.git
|
|
31
|
+
git clone --branch $MOONSHOT_UI_BRANCH https://github.com/aiverify-foundation/moonshot-ui.git
|
|
32
|
+
cp $SCRIPTS_DIR/moonshot_env .env
|
|
33
|
+
|
|
34
|
+
python3 -m venv venv
|
|
35
|
+
source venv/bin/activate
|
|
36
|
+
|
|
37
|
+
# Install Python dependencies
|
|
38
|
+
pip install -r requirements.txt
|
|
39
|
+
cd moonshot-data
|
|
40
|
+
pip install -r requirements.txt
|
|
41
|
+
|
|
42
|
+
# Install Node.js dependencies and build the UI
|
|
43
|
+
cd ../moonshot-ui
|
|
44
|
+
rm .env.local
|
|
45
|
+
cp $SCRIPTS_DIR/moonshot_ui_env .env.local
|
|
46
|
+
npm install
|
|
47
|
+
|
|
48
|
+
# Modify the start script in package.json
|
|
49
|
+
sudo apt-get install -y jq
|
|
50
|
+
jq '.scripts.start = "next start -H 0.0.0.0 -p 3100"' package.json > package.tmp.json && mv package.tmp.json package.json
|
|
51
|
+
|
|
52
|
+
npm run build
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# .env for moonshot SIT
|
|
2
|
+
|
|
3
|
+
# For Data
|
|
4
|
+
ATTACK_MODULES="./moonshot-data/attack-modules"
|
|
5
|
+
BOOKMARKS="./moonshot-data/generated-outputs/bookmarks"
|
|
6
|
+
CONNECTORS="./moonshot-data/connectors"
|
|
7
|
+
CONNECTORS_ENDPOINTS="./moonshot-data/connectors-endpoints"
|
|
8
|
+
CONTEXT_STRATEGY="./moonshot-data/context-strategy"
|
|
9
|
+
COOKBOOKS="./moonshot-data/cookbooks"
|
|
10
|
+
DATABASES="./moonshot-data/generated-outputs/databases"
|
|
11
|
+
DATABASES_MODULES="./moonshot-data/databases-modules"
|
|
12
|
+
DATASETS="./moonshot-data/datasets"
|
|
13
|
+
IO_MODULES="./moonshot-data/io-modules"
|
|
14
|
+
METRICS="./moonshot-data/metrics"
|
|
15
|
+
PROMPT_TEMPLATES="./moonshot-data/prompt-templates"
|
|
16
|
+
RECIPES="./moonshot-data/recipes"
|
|
17
|
+
RESULTS="./moonshot-data/generated-outputs/results"
|
|
18
|
+
RESULTS_MODULES="./moonshot-data/results-modules"
|
|
19
|
+
RUNNERS="./moonshot-data/generated-outputs/runners"
|
|
20
|
+
RUNNERS_MODULES="./moonshot-data/runners-modules"
|
|
21
|
+
TOKENIZERS_PARALLELISM = false
|
|
22
|
+
|
|
23
|
+
# For Web API
|
|
24
|
+
HOST_ADDRESS=127.0.0.1 # The interface the server will bind to
|
|
25
|
+
HOST_PORT=5100
|
|
26
|
+
|
|
27
|
+
# URI of the Web UI webhook
|
|
28
|
+
MOONSHOT_UI_CALLBACK_URL=http://localhost:3100/api/v1/benchmarks/status
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
AZURE_OPENAI_API_KEY=$1
|
|
4
|
+
AZURE_OPENAI_ENDPOINT=$2
|
|
5
|
+
TEST_BRANCH_NAME=${3:-main}
|
|
6
|
+
|
|
7
|
+
BASE_DIR=~/moonshot
|
|
8
|
+
SCRIPTS_DIR=~/scripts
|
|
9
|
+
|
|
10
|
+
# Export the env variables for smoke test to use
|
|
11
|
+
export AZURE_OPENAI_TOKEN=$AZURE_OPENAI_API_KEY
|
|
12
|
+
export AZURE_OPENAI_URI=$AZURE_OPENAI_ENDPOINT
|
|
13
|
+
export MOONSHOT_URL="http://127.0.0.1"
|
|
14
|
+
export MOONSHOT_PORT_NUMBER="3100"
|
|
15
|
+
export ADDITIONAL_PARAMETERS="{
|
|
16
|
+
\"timeout\": 300,
|
|
17
|
+
\"allow_retries\": true,
|
|
18
|
+
\"num_of_retries\": 3,
|
|
19
|
+
\"temperature\": 0.5,
|
|
20
|
+
\"model\": \"gpt-4o\"
|
|
21
|
+
}"
|
|
22
|
+
|
|
23
|
+
cd $BASE_DIR
|
|
24
|
+
|
|
25
|
+
if [ -d "moonshot-smoke-testing" ]; then
|
|
26
|
+
echo "Removing existing moonshot-smoke-testing directory..."
|
|
27
|
+
rm -rf moonshot-smoke-testing
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Clone the smoke test repo from the specified branch
|
|
31
|
+
echo "Cloning moonshot-smoke-testing repo from branch $BRANCH_NAME..."
|
|
32
|
+
git clone --branch $TEST_BRANCH_NAME https://github.com/aiverify-foundation/moonshot-smoke-testing.git
|
|
33
|
+
cd moonshot-smoke-testing
|
|
34
|
+
npm ci
|
|
35
|
+
cp $SCRIPTS_DIR/moonshot_test_env .env
|
|
36
|
+
|
|
37
|
+
# Install Playwright (if needed)
|
|
38
|
+
#sudo npx playwright install-deps
|
|
39
|
+
### If the above didn't work, try the following:
|
|
40
|
+
##sudo apt-get install libatk1.0-0\
|
|
41
|
+
## libatk-bridge2.0-0\
|
|
42
|
+
## libxkbcommon0\
|
|
43
|
+
## libatspi2.0-0\
|
|
44
|
+
## libxcomposite1\
|
|
45
|
+
## libxdamage1\
|
|
46
|
+
## libxfixes3\
|
|
47
|
+
## libxrandr2\
|
|
48
|
+
## libgbml
|
|
49
|
+
|
|
50
|
+
echo "Running smoke test..."
|
|
51
|
+
npx playwright test tests/smoke-test.spec.ts --reporter=list
|
|
52
|
+
|
|
53
|
+
#echo "Exit code: $?"
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# Smoke Test
|
|
2
2
|
|
|
3
|
-
name: Moonshot
|
|
3
|
+
name: Moonshot Integration Test
|
|
4
4
|
|
|
5
5
|
on:
|
|
6
|
-
# Runs on Pull Request
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# - 'main'
|
|
6
|
+
# Runs on Pull Request Review
|
|
7
|
+
pull_request_review:
|
|
8
|
+
branches:
|
|
9
|
+
- 'main'
|
|
11
10
|
|
|
12
11
|
# Run this workflow manually from Actions tab
|
|
13
12
|
workflow_dispatch:
|
|
@@ -34,15 +33,15 @@ concurrency:
|
|
|
34
33
|
cancel-in-progress: true
|
|
35
34
|
|
|
36
35
|
jobs:
|
|
37
|
-
|
|
36
|
+
integration-test:
|
|
38
37
|
|
|
39
38
|
runs-on: ubuntu-latest
|
|
40
39
|
timeout-minutes: 20
|
|
41
40
|
|
|
42
41
|
steps:
|
|
43
42
|
|
|
44
|
-
- name: Checkout Moonshot (Pull Request)
|
|
45
|
-
if: github.event_name == '
|
|
43
|
+
- name: Checkout Moonshot (Pull Request Review)
|
|
44
|
+
if: github.event_name == 'pull_request_review'
|
|
46
45
|
uses: actions/checkout@v4
|
|
47
46
|
with:
|
|
48
47
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
@@ -52,7 +51,7 @@ jobs:
|
|
|
52
51
|
if: github.event_name == 'workflow_dispatch'
|
|
53
52
|
uses: actions/checkout@v4
|
|
54
53
|
with:
|
|
55
|
-
repository: aiverify-foundation/moonshot
|
|
54
|
+
repository: aiverify-foundation/moonshot
|
|
56
55
|
ref: ${{ inputs.moonshot_branch }}
|
|
57
56
|
|
|
58
57
|
- name: Setup Python 3.11
|
|
@@ -65,9 +64,11 @@ jobs:
|
|
|
65
64
|
python -m venv venv
|
|
66
65
|
source venv/bin/activate
|
|
67
66
|
pip install -r requirements.txt
|
|
67
|
+
touch .env
|
|
68
|
+
echo "${{ vars.ENVIRONMENT_VARS }}" >> .env
|
|
68
69
|
|
|
69
|
-
- name: Checkout Moonshot Data (Pull Request)
|
|
70
|
-
if: github.event_name == '
|
|
70
|
+
- name: Checkout Moonshot Data (Pull Request Review)
|
|
71
|
+
if: github.event_name == 'pull_request_review'
|
|
71
72
|
uses: actions/checkout@v4
|
|
72
73
|
with:
|
|
73
74
|
repository: aiverify-foundation/moonshot-data
|
|
@@ -88,8 +89,8 @@ jobs:
|
|
|
88
89
|
cd moonshot-data
|
|
89
90
|
pip install -r requirements.txt
|
|
90
91
|
|
|
91
|
-
- name: Checkout Moonshot UI (Pull Request)
|
|
92
|
-
if: github.event_name == '
|
|
92
|
+
- name: Checkout Moonshot UI (Pull Request Review)
|
|
93
|
+
if: github.event_name == 'pull_request_review'
|
|
93
94
|
uses: actions/checkout@v4
|
|
94
95
|
with:
|
|
95
96
|
repository: aiverify-foundation/moonshot-ui
|
|
@@ -113,15 +114,19 @@ jobs:
|
|
|
113
114
|
source venv/bin/activate
|
|
114
115
|
python -m moonshot web &
|
|
115
116
|
|
|
116
|
-
- name: Checkout
|
|
117
|
+
- name: Checkout Integration Test
|
|
117
118
|
uses: actions/checkout@v4
|
|
118
119
|
with:
|
|
119
|
-
repository: aiverify-foundation/moonshot-
|
|
120
|
+
repository: aiverify-foundation/moonshot-integration-testing
|
|
120
121
|
path: moonshot-smoke-testing
|
|
121
122
|
|
|
122
|
-
- name: Run
|
|
123
|
+
- name: Run Integration Test
|
|
124
|
+
env:
|
|
125
|
+
AZURE_OPENAI_URI: ${{ secrets.AZURE_OPENAI_URI }}
|
|
126
|
+
AZURE_OPENAI_TOKEN: ${{ secrets.AZURE_OPENAI_TOKEN }}
|
|
127
|
+
ADDITIONAL_PARAMETERS: ${{ vars.ADDITIONAL_PARAMETERS }}
|
|
123
128
|
run: |
|
|
124
|
-
cd moonshot-smoke-testing
|
|
129
|
+
cd moonshot-smoke-testing/ui-integration-testing
|
|
125
130
|
npm ci
|
|
126
131
|
npx playwright install --with-deps
|
|
127
|
-
npx playwright test
|
|
132
|
+
AZURE_OPENAI_URI="$AZURE_OPENAI_URI" AZURE_OPENAI_TOKEN="$AZURE_OPENAI_TOKEN" ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS" npx playwright test
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
|
|
2
|
+
name: Nightly Build
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
|
|
6
|
+
# Run this workflow manually from Actions tab
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
branch_moonshot:
|
|
10
|
+
description: 'moonshot branch or tag'
|
|
11
|
+
required: true
|
|
12
|
+
default: 'dev_main'
|
|
13
|
+
type: string
|
|
14
|
+
branch_moonshot_data:
|
|
15
|
+
description: 'moonshot-data branch or tag'
|
|
16
|
+
required: true
|
|
17
|
+
default: 'dev_main'
|
|
18
|
+
type: string
|
|
19
|
+
branch_moonshot_ui:
|
|
20
|
+
description: 'moonshot-ui branch or tag'
|
|
21
|
+
required: true
|
|
22
|
+
default: 'dev_main'
|
|
23
|
+
type: string
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# Allow one concurrent deployment
|
|
27
|
+
concurrency:
|
|
28
|
+
group: ${{ github.repository }}-${{ github.workflow }}
|
|
29
|
+
cancel-in-progress: true
|
|
30
|
+
|
|
31
|
+
jobs:
|
|
32
|
+
|
|
33
|
+
nightly-build:
|
|
34
|
+
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
timeout-minutes: 40
|
|
37
|
+
permissions:
|
|
38
|
+
id-token: write
|
|
39
|
+
contents: read
|
|
40
|
+
|
|
41
|
+
steps:
|
|
42
|
+
- name: Configure AWS credentials
|
|
43
|
+
uses: aws-actions/configure-aws-credentials@v4
|
|
44
|
+
with:
|
|
45
|
+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
|
|
46
|
+
aws-region: ap-southeast-1
|
|
47
|
+
|
|
48
|
+
# - name: S3 test
|
|
49
|
+
# run: |
|
|
50
|
+
# aws s3 ls ${{ vars.AWS_S3_PATH }}
|
|
51
|
+
# echo "This job's status is ${{ job.status }}."
|
|
52
|
+
|
|
53
|
+
# Deploy moonshot
|
|
54
|
+
|
|
55
|
+
- name: Backup current install
|
|
56
|
+
run: |
|
|
57
|
+
command_id=$(aws ssm send-command \
|
|
58
|
+
--instance-ids "${{ vars.AWS_SIT_INSTANCE_ID }}" \
|
|
59
|
+
--document-name "AWS-RunShellScript" \
|
|
60
|
+
--comment "Backup current install" \
|
|
61
|
+
--parameters 'commands=["sudo su - ubuntu -c \". ~/scripts/create_backup.sh\""]' \
|
|
62
|
+
--query "Command.CommandId" \
|
|
63
|
+
--output text)
|
|
64
|
+
aws ssm wait command-executed \
|
|
65
|
+
--command-id "$command_id" \
|
|
66
|
+
--instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}"
|
|
67
|
+
status=$(aws ssm list-command-invocations \
|
|
68
|
+
--command-id "$command_id" \
|
|
69
|
+
--details \
|
|
70
|
+
--query "CommandInvocations[0].Status" \
|
|
71
|
+
--output text)
|
|
72
|
+
echo "Command status: $status"
|
|
73
|
+
|
|
74
|
+
- name: Install moonshot
|
|
75
|
+
timeout-minutes: 30
|
|
76
|
+
run: |
|
|
77
|
+
command_id=$(aws ssm send-command \
|
|
78
|
+
--instance-ids "${{ vars.AWS_SIT_INSTANCE_ID }}" \
|
|
79
|
+
--document-name "AWS-RunShellScript" \
|
|
80
|
+
--comment "Install moonshot" \
|
|
81
|
+
--parameters 'commands=["sudo su - ubuntu -c \". ~/scripts/install_ms_service.sh ${{ inputs.branch_moonshot }} ${{ inputs.branch_moonshot_data }} ${{ inputs.branch_moonshot_ui }}\""]' \
|
|
82
|
+
--query "Command.CommandId" \
|
|
83
|
+
--output text)
|
|
84
|
+
|
|
85
|
+
max_attempts=20
|
|
86
|
+
delay=60
|
|
87
|
+
attempts=0
|
|
88
|
+
while [ $attempts -lt $max_attempts ]; do
|
|
89
|
+
status=$(aws ssm list-command-invocations \
|
|
90
|
+
--command-id "$command_id" \
|
|
91
|
+
--instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}" \
|
|
92
|
+
--query "CommandInvocations[0].Status" \
|
|
93
|
+
--output text)
|
|
94
|
+
if [ "$status" == "Success" ]; then
|
|
95
|
+
echo "Command status: $status"
|
|
96
|
+
exit 0
|
|
97
|
+
elif [ "$status" == "InProgress" ]; then
|
|
98
|
+
echo "Command status: $status, waiting..."
|
|
99
|
+
sleep $delay
|
|
100
|
+
attempts=$((attempts + 1))
|
|
101
|
+
else
|
|
102
|
+
echo "Command status: $status"
|
|
103
|
+
exit 1
|
|
104
|
+
fi
|
|
105
|
+
done
|
|
106
|
+
echo "Max attempts reached, exiting."
|
|
107
|
+
exit 1
|
|
108
|
+
|
|
109
|
+
- name: Start moonshot web
|
|
110
|
+
run: |
|
|
111
|
+
command_id=$(aws ssm send-command \
|
|
112
|
+
--instance-ids "${{ vars.AWS_SIT_INSTANCE_ID }}" \
|
|
113
|
+
--document-name "AWS-RunShellScript" \
|
|
114
|
+
--comment "Start moonshot web" \
|
|
115
|
+
--parameters 'commands=["sudo systemctl restart moonshot-service"]' \
|
|
116
|
+
--query "Command.CommandId" \
|
|
117
|
+
--output text)
|
|
118
|
+
aws ssm wait command-executed \
|
|
119
|
+
--command-id "$command_id" \
|
|
120
|
+
--instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}"
|
|
121
|
+
status=$(aws ssm list-command-invocations \
|
|
122
|
+
--command-id "$command_id" \
|
|
123
|
+
--details \
|
|
124
|
+
--query "CommandInvocations[0].Status" \
|
|
125
|
+
--output text)
|
|
126
|
+
echo "Command status: $status"
|
|
127
|
+
|
|
128
|
+
- name: Run smoke test
|
|
129
|
+
run: |
|
|
130
|
+
command_id=$(aws ssm send-command \
|
|
131
|
+
--instance-ids "${{ vars.AWS_SIT_INSTANCE_ID }}" \
|
|
132
|
+
--document-name "AWS-RunShellScript" \
|
|
133
|
+
--comment "Run smoke test" \
|
|
134
|
+
--parameters 'commands=["sudo su - ubuntu -c \". ~/scripts/run_smoke_test.sh ${{ secrets.AZURE_OPENAI_TOKEN }} ${{ secrets.AZURE_OPENAI_URI }} \""]' \
|
|
135
|
+
--query "Command.CommandId" \
|
|
136
|
+
--output text)
|
|
137
|
+
|
|
138
|
+
max_attempts=20
|
|
139
|
+
delay=60
|
|
140
|
+
attempts=0
|
|
141
|
+
|
|
142
|
+
while [ $attempts -lt $max_attempts ]; do
|
|
143
|
+
status=$(aws ssm list-command-invocations \
|
|
144
|
+
--command-id "$command_id" \
|
|
145
|
+
--instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}" \
|
|
146
|
+
--query "CommandInvocations[0].Status" \
|
|
147
|
+
--output text)
|
|
148
|
+
|
|
149
|
+
if [ "$status" == "Success" ] || [ "$status" == "Failed" ]; then
|
|
150
|
+
output=$(aws ssm get-command-invocation \
|
|
151
|
+
--command-id "$command_id" \
|
|
152
|
+
--instance-id "${{ vars.AWS_SIT_INSTANCE_ID }}" \
|
|
153
|
+
--query "StandardOutputContent" \
|
|
154
|
+
--output text)
|
|
155
|
+
echo "SMOKE_TEST_STATUS=$output" >> $GITHUB_ENV
|
|
156
|
+
echo "Smoke test output: $output"
|
|
157
|
+
echo "Command status: $status"
|
|
158
|
+
if [ "$status" == "Success" ]; then
|
|
159
|
+
exit 0
|
|
160
|
+
else
|
|
161
|
+
exit 1
|
|
162
|
+
fi
|
|
163
|
+
elif [ "$status" == "InProgress" ]; then
|
|
164
|
+
echo "Command status: $status, waiting..."
|
|
165
|
+
sleep $delay
|
|
166
|
+
attempts=$((attempts + 1))
|
|
167
|
+
else
|
|
168
|
+
echo "Unexpected command status: $status"
|
|
169
|
+
exit 1
|
|
170
|
+
fi
|
|
171
|
+
done
|
|
172
|
+
|
|
173
|
+
echo "Max attempts reached, exiting."
|
|
174
|
+
exit 1
|
|
175
|
+
|
|
176
|
+
# Send slack notification
|
|
177
|
+
- name: Send slack notification
|
|
178
|
+
if: ${{ ! cancelled() }}
|
|
179
|
+
uses: slackapi/slack-github-action@v1.26.0
|
|
180
|
+
with:
|
|
181
|
+
payload: |
|
|
182
|
+
{
|
|
183
|
+
"workflow": "${{ github.repository }} | ${{ github.workflow }}",
|
|
184
|
+
"status": "${{ job.status }}",
|
|
185
|
+
"details": "${{ env.SMOKE_TEST_STATUS }}",
|
|
186
|
+
"ref": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
187
|
+
}
|
|
188
|
+
env:
|
|
189
|
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Pre-build Checks (for moonshot)
|
|
2
|
+
# 1. Unit tests with code coverage (pytest)
|
|
3
|
+
# 2. Code quality analysis (flake8)
|
|
4
|
+
# 3. Dependency analysis (vulnerabilities)
|
|
5
|
+
# 4. Dependency analysis (undesirable licenses)
|
|
6
|
+
# 5. Deploy reports generated from the above to GitHub Pages
|
|
7
|
+
|
|
8
|
+
name: Pre-Build Checks
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
# Runs when a pull request to main is being assigned
|
|
12
|
+
pull_request:
|
|
13
|
+
types: [ assigned, synchronize ]
|
|
14
|
+
branches:
|
|
15
|
+
- 'dev_main'
|
|
16
|
+
|
|
17
|
+
# Run this workflow manually from Actions tab
|
|
18
|
+
workflow_dispatch:
|
|
19
|
+
inputs:
|
|
20
|
+
branch_to_test:
|
|
21
|
+
description: 'Branch or tag to run test'
|
|
22
|
+
required: true
|
|
23
|
+
default: 'dev_main'
|
|
24
|
+
type: string
|
|
25
|
+
|
|
26
|
+
# Allow one concurrent deployment
|
|
27
|
+
concurrency:
|
|
28
|
+
group: ${{ github.repository }}-${{ github.workflow }}
|
|
29
|
+
cancel-in-progress: true
|
|
30
|
+
|
|
31
|
+
jobs:
|
|
32
|
+
|
|
33
|
+
pre-build-checks:
|
|
34
|
+
# Run only when PR is assigned, even on subsequent commits (i.e. synchronize)
|
|
35
|
+
if: (github.event_name == 'pull_request' && github.event.pull_request.assignee != null) || github.event_name == 'workflow_dispatch'
|
|
36
|
+
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
timeout-minutes: 40
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
|
|
42
|
+
- name: Set branch variable (pull_request)
|
|
43
|
+
if: github.event_name == 'pull_request'
|
|
44
|
+
run: |
|
|
45
|
+
echo "MS_BRANCH=${{ github.event.pull_request.head.ref }}" >> "$GITHUB_ENV"
|
|
46
|
+
echo "MS_DATA_BRANCH=dev_main" >> "$GITHUB_ENV"
|
|
47
|
+
echo "PR_NUM=#${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"
|
|
48
|
+
|
|
49
|
+
- name: Set branch variable (workflow_dispatch)
|
|
50
|
+
if: github.event_name == 'workflow_dispatch'
|
|
51
|
+
run: |
|
|
52
|
+
echo "MS_BRANCH=${{ inputs.branch_to_test }}" >> "$GITHUB_ENV"
|
|
53
|
+
echo "MS_DATA_BRANCH=${{ inputs.branch_to_test }}" >> "$GITHUB_ENV"
|
|
54
|
+
echo "PR_NUM=#0" >> "$GITHUB_ENV"
|
|
55
|
+
|
|
56
|
+
# Checkout moonshot code
|
|
57
|
+
- name: Checkout code (moonshot)
|
|
58
|
+
uses: actions/checkout@v3
|
|
59
|
+
with:
|
|
60
|
+
ref: ${{ env.MS_BRANCH }}
|
|
61
|
+
submodules: recursive
|
|
62
|
+
|
|
63
|
+
- name: Setup python 3.11
|
|
64
|
+
uses: actions/setup-python@v5
|
|
65
|
+
with:
|
|
66
|
+
python-version: "3.11"
|
|
67
|
+
|
|
68
|
+
# Checkout moonshot-data code
|
|
69
|
+
- name: Checkout code (moonshot-data)
|
|
70
|
+
uses: actions/checkout@v3
|
|
71
|
+
with:
|
|
72
|
+
repository: aiverify-foundation/moonshot-data
|
|
73
|
+
ref: ${{ env.MS_DATA_BRANCH }}
|
|
74
|
+
submodules: recursive
|
|
75
|
+
path: moonshot-data
|
|
76
|
+
|
|
77
|
+
# Install dependencies
|
|
78
|
+
- name: Install dependencies
|
|
79
|
+
run: |
|
|
80
|
+
pip install -r requirements.txt
|
|
81
|
+
pip install -r moonshot-data/requirements.txt
|
|
82
|
+
pip install pytest pytest-mock pytest-html pytest-json pytest-cov coverage httpx anybadge
|
|
83
|
+
pip install flake8 flake8-html
|
|
84
|
+
|
|
85
|
+
# Setup .env file
|
|
86
|
+
- name: Setup env file
|
|
87
|
+
run: |
|
|
88
|
+
echo "# For Data
|
|
89
|
+
ATTACK_MODULES=\"./moonshot-data/attack-modules\"
|
|
90
|
+
BOOKMARKS=\"./moonshot-data/generated-outputs/bookmarks\"
|
|
91
|
+
CONNECTORS=\"./moonshot-data/connectors\"
|
|
92
|
+
CONNECTORS_ENDPOINTS=\"./moonshot-data/connectors-endpoints\"
|
|
93
|
+
CONTEXT_STRATEGY=\"./moonshot-data/context-strategy\"
|
|
94
|
+
COOKBOOKS=\"./moonshot-data/cookbooks\"
|
|
95
|
+
DATABASES=\"./moonshot-data/generated-outputs/databases\"
|
|
96
|
+
DATABASES_MODULES=\"./moonshot-data/databases-modules\"
|
|
97
|
+
DATASETS=\"./moonshot-data/datasets\"
|
|
98
|
+
IO_MODULES=\"./moonshot-data/io-modules\"
|
|
99
|
+
METRICS=\"./moonshot-data/metrics\"
|
|
100
|
+
PROMPT_TEMPLATES=\"./moonshot-data/prompt-templates\"
|
|
101
|
+
RECIPES=\"./moonshot-data/recipes\"
|
|
102
|
+
RESULTS=\"./moonshot-data/generated-outputs/results\"
|
|
103
|
+
RESULTS_MODULES=\"./moonshot-data/results-modules\"
|
|
104
|
+
RUNNERS=\"./moonshot-data/generated-outputs/runners\"
|
|
105
|
+
RUNNERS_MODULES=\"./moonshot-data/runners-modules\"
|
|
106
|
+
TOKENIZERS_PARALLELISM=false
|
|
107
|
+
|
|
108
|
+
# For Web API
|
|
109
|
+
HOST_ADDRESS=127.0.0.1
|
|
110
|
+
HOST_PORT=5000" > .env
|
|
111
|
+
cat .env
|
|
112
|
+
|
|
113
|
+
# Unit tests & coverage
|
|
114
|
+
- name: Unit tests with coverage
|
|
115
|
+
id: unit_tests
|
|
116
|
+
if: ${{ ! cancelled() }}
|
|
117
|
+
timeout-minutes: 30
|
|
118
|
+
run: |
|
|
119
|
+
set +e
|
|
120
|
+
bash ci/run-test.sh
|
|
121
|
+
source ci/gen_pre_build_summ.sh test
|
|
122
|
+
test_status=$?
|
|
123
|
+
source ci/gen_pre_build_summ.sh coverage
|
|
124
|
+
coverage_status=$?
|
|
125
|
+
echo "UNIT_TESTS_STATUS=$UNITTEST_SUMMARY" >> $GITHUB_ENV
|
|
126
|
+
echo "CODE_COVERAGE_STATUS=$COVERAGE_SUMMARY" >> $GITHUB_ENV
|
|
127
|
+
set -e
|
|
128
|
+
if [ $test_status -ne 0 ] || [ $coverage_status -ne 0 ]; then
|
|
129
|
+
exit 1
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Code quality analysis (flake8)
|
|
133
|
+
- name: Code quality analysis (flake8)
|
|
134
|
+
id: code_quality
|
|
135
|
+
if: ${{ ! cancelled() }}
|
|
136
|
+
run: |
|
|
137
|
+
set +e
|
|
138
|
+
bash ci/run-flake8.sh
|
|
139
|
+
source ci/gen_pre_build_summ.sh lint
|
|
140
|
+
lint_status=$?
|
|
141
|
+
echo "CODE_QUALITY_STATUS=$LINT_SUMMARY" >> $GITHUB_ENV
|
|
142
|
+
set -e
|
|
143
|
+
exit $lint_status
|
|
144
|
+
|
|
145
|
+
# pip-audit
|
|
146
|
+
- name: Dependency analysis (vulnerabilities & licenses)
|
|
147
|
+
id: dependency_analysis
|
|
148
|
+
if: ${{ ! cancelled() }}
|
|
149
|
+
run: |
|
|
150
|
+
set +e
|
|
151
|
+
bash ci/run-pip-audit.sh
|
|
152
|
+
source ci/gen_pre_build_summ.sh dependency
|
|
153
|
+
dep_status=$?
|
|
154
|
+
source ci/gen_pre_build_summ.sh license
|
|
155
|
+
lic_status=$?
|
|
156
|
+
echo "DEPENDENCY_STATUS=$DEPENDENCY_SUMMARY" >> $GITHUB_ENV
|
|
157
|
+
echo "LICENSE_STATUS=$LICENSE_SUMMARY" >> $GITHUB_ENV
|
|
158
|
+
set -e
|
|
159
|
+
if [ $dep_status -ne 0 ] || [ $lic_status -ne 0 ]; then
|
|
160
|
+
exit 1
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# - name: Capture step statuses
|
|
164
|
+
# if: ${{ ! cancelled() }}
|
|
165
|
+
# run: |
|
|
166
|
+
# echo "UNIT_TESTS_STATUS=${{ steps.unit_tests.outcome }}" >> $GITHUB_ENV
|
|
167
|
+
# echo "CODE_QUALITY_STATUS=${{ steps.code_quality.outcome }}" >> $GITHUB_ENV
|
|
168
|
+
# echo "DEPENDENCY_ANALYSIS_STATUS=${{ steps.dependency_analysis.outcome }}" >> $GITHUB_ENV
|
|
169
|
+
|
|
170
|
+
# Send slack notification
|
|
171
|
+
- name: Send slack notification
|
|
172
|
+
if: ${{ ! cancelled() }}
|
|
173
|
+
uses: slackapi/slack-github-action@v1.26.0
|
|
174
|
+
with:
|
|
175
|
+
payload: |
|
|
176
|
+
{
|
|
177
|
+
"workflow": "${{ github.repository }} | ${{ github.workflow }} | ${{ env.PR_NUM }}",
|
|
178
|
+
"status": "${{ job.status }}",
|
|
179
|
+
"details": "${{ env.UNIT_TESTS_STATUS }} | ${{ env.CODE_COVERAGE_STATUS }} | ${{ env.CODE_QUALITY_STATUS }} | ${{ env.DEPENDENCY_STATUS }} | ${{ env.LICENSE_STATUS }}",
|
|
180
|
+
"ref": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
181
|
+
}
|
|
182
|
+
env:
|
|
183
|
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|