shipit-engine 0.28.1 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +41 -2
- data/Rakefile +4 -2
- data/app/assets/images/archive-solid.svg +1 -0
- data/app/assets/images/magic-solid.svg +1 -0
- data/app/assets/javascripts/shipit/repositories_search.js.coffee +60 -0
- data/app/assets/javascripts/shipit/{search.js.coffee → stack_search.js.coffee} +0 -0
- data/app/assets/stylesheets/_pages/_repositories.scss +148 -0
- data/app/assets/stylesheets/_pages/_stacks.scss +95 -3
- data/app/assets/stylesheets/merge_status.scss +0 -3
- data/app/assets/stylesheets/shipit.scss +1 -0
- data/app/controllers/concerns/shipit/active_model_serializers_patch.rb +13 -0
- data/app/controllers/concerns/shipit/api/cacheable.rb +1 -0
- data/app/controllers/concerns/shipit/api/paginable.rb +3 -2
- data/app/controllers/concerns/shipit/api/rendering.rb +5 -4
- data/app/controllers/concerns/shipit/authentication.rb +3 -2
- data/app/controllers/concerns/shipit/pagination.rb +2 -1
- data/app/controllers/shipit/api/base_controller.rb +11 -6
- data/app/controllers/shipit/api/ccmenu_controller.rb +2 -1
- data/app/controllers/shipit/api/commits_controller.rb +2 -1
- data/app/controllers/shipit/api/deploys_controller.rb +4 -3
- data/app/controllers/shipit/api/hooks_controller.rb +6 -5
- data/app/controllers/shipit/api/locks_controller.rb +5 -4
- data/app/controllers/shipit/api/merge_requests_controller.rb +37 -0
- data/app/controllers/shipit/api/outputs_controller.rb +2 -1
- data/app/controllers/shipit/api/release_statuses_controller.rb +3 -2
- data/app/controllers/shipit/api/rollbacks_controller.rb +33 -0
- data/app/controllers/shipit/api/stacks_controller.rb +50 -5
- data/app/controllers/shipit/api/tasks_controller.rb +6 -5
- data/app/controllers/shipit/api_clients_controller.rb +50 -0
- data/app/controllers/shipit/ccmenu_url_controller.rb +4 -3
- data/app/controllers/shipit/commit_checks_controller.rb +2 -1
- data/app/controllers/shipit/commits_controller.rb +2 -1
- data/app/controllers/shipit/deploys_controller.rb +5 -4
- data/app/controllers/shipit/github_authentication_controller.rb +4 -3
- data/app/controllers/shipit/merge_requests_controller.rb +31 -0
- data/app/controllers/shipit/merge_status_controller.rb +33 -28
- data/app/controllers/shipit/release_statuses_controller.rb +3 -2
- data/app/controllers/shipit/repositories_controller.rb +74 -0
- data/app/controllers/shipit/rollbacks_controller.rb +3 -2
- data/app/controllers/shipit/shipit_controller.rb +2 -1
- data/app/controllers/shipit/stacks_controller.rb +78 -14
- data/app/controllers/shipit/status_controller.rb +2 -1
- data/app/controllers/shipit/tasks_controller.rb +9 -8
- data/app/controllers/shipit/webhooks_controller.rb +5 -132
- data/app/helpers/shipit/chunks_helper.rb +3 -2
- data/app/helpers/shipit/deploys_helper.rb +4 -3
- data/app/helpers/shipit/github_url_helper.rb +9 -0
- data/app/helpers/shipit/merge_status_helper.rb +1 -0
- data/app/helpers/shipit/shipit_helper.rb +1 -0
- data/app/helpers/shipit/stacks_helper.rb +9 -0
- data/app/helpers/shipit/tasks_helper.rb +1 -0
- data/app/jobs/shipit/background_job.rb +4 -0
- data/app/jobs/shipit/background_job/unique.rb +4 -1
- data/app/jobs/shipit/cache_deploy_spec_job.rb +1 -0
- data/app/jobs/shipit/chunk_rollup_job.rb +4 -0
- data/app/jobs/shipit/clear_git_cache_job.rb +1 -0
- data/app/jobs/shipit/continuous_delivery_job.rb +3 -1
- data/app/jobs/shipit/create_on_github_job.rb +7 -1
- data/app/jobs/shipit/create_release_statuses_job.rb +1 -0
- data/app/jobs/shipit/deferred_touch_job.rb +4 -0
- data/app/jobs/shipit/deliver_hook_job.rb +1 -0
- data/app/jobs/shipit/destroy_job.rb +1 -0
- data/app/jobs/shipit/destroy_repository_job.rb +24 -0
- data/app/jobs/shipit/destroy_stack_job.rb +5 -4
- data/app/jobs/shipit/emit_event_job.rb +2 -1
- data/app/jobs/shipit/fetch_commit_stats_job.rb +1 -0
- data/app/jobs/shipit/fetch_deployed_revision_job.rb +1 -0
- data/app/jobs/shipit/github_sync_job.rb +2 -1
- data/app/jobs/shipit/{mark_deploy_healty_job.rb → mark_deploy_healthy_job.rb} +1 -0
- data/app/jobs/shipit/perform_commit_checks_job.rb +1 -0
- data/app/jobs/shipit/perform_task_job.rb +5 -90
- data/app/jobs/shipit/process_merge_requests_job.rb +32 -0
- data/app/jobs/shipit/purge_old_deliveries_job.rb +1 -0
- data/app/jobs/shipit/reap_dead_tasks_job.rb +21 -0
- data/app/jobs/shipit/refresh_check_runs_job.rb +1 -0
- data/app/jobs/shipit/refresh_github_user_job.rb +1 -0
- data/app/jobs/shipit/refresh_merge_request_job.rb +11 -0
- data/app/jobs/shipit/refresh_statuses_job.rb +1 -0
- data/app/jobs/shipit/setup_github_hook_job.rb +1 -0
- data/app/jobs/shipit/update_estimated_deploy_duration_job.rb +1 -0
- data/app/jobs/shipit/update_github_last_deployed_ref_job.rb +4 -3
- data/app/models/concerns/shipit/deferred_touch.rb +4 -3
- data/app/models/shipit/anonymous_user.rb +9 -0
- data/app/models/shipit/api_client.rb +3 -2
- data/app/models/shipit/application_record.rb +2 -1
- data/app/models/shipit/check_run.rb +5 -4
- data/app/models/shipit/command_line_user.rb +5 -0
- data/app/models/shipit/commit.rb +41 -22
- data/app/models/shipit/commit_checks.rb +2 -0
- data/app/models/shipit/commit_deployment.rb +17 -12
- data/app/models/shipit/commit_deployment_status.rb +8 -3
- data/app/models/shipit/commit_message.rb +1 -0
- data/app/models/shipit/delivery.rb +4 -3
- data/app/models/shipit/deploy.rb +41 -10
- data/app/models/shipit/deploy_spec.rb +38 -7
- data/app/models/shipit/deploy_spec/bundler_discovery.rb +2 -1
- data/app/models/shipit/deploy_spec/capistrano_discovery.rb +1 -0
- data/app/models/shipit/deploy_spec/file_system.rb +20 -7
- data/app/models/shipit/deploy_spec/kubernetes_discovery.rb +1 -0
- data/app/models/shipit/deploy_spec/lerna_discovery.rb +1 -0
- data/app/models/shipit/deploy_spec/npm_discovery.rb +5 -4
- data/app/models/shipit/deploy_spec/pypi_discovery.rb +1 -0
- data/app/models/shipit/deploy_spec/rubygems_discovery.rb +1 -0
- data/app/models/shipit/deploy_stats.rb +58 -0
- data/app/models/shipit/duration.rb +3 -2
- data/app/models/shipit/ephemeral_commit_checks.rb +1 -0
- data/app/models/shipit/github_hook.rb +2 -1
- data/app/models/shipit/github_status.rb +2 -1
- data/app/models/shipit/hook.rb +8 -5
- data/app/models/shipit/membership.rb +3 -2
- data/app/models/shipit/merge_request.rb +302 -0
- data/app/models/shipit/output_chunk.rb +7 -2
- data/app/models/shipit/provisioning_handler.rb +32 -0
- data/app/models/shipit/provisioning_handler/base.rb +30 -0
- data/app/models/shipit/provisioning_handler/unregistered_provisioning_handler.rb +35 -0
- data/app/models/shipit/pull_request.rb +27 -260
- data/app/models/shipit/pull_request_assignment.rb +10 -0
- data/app/models/shipit/record.rb +18 -0
- data/app/models/shipit/release_status.rb +3 -2
- data/app/models/shipit/repository.rb +97 -0
- data/app/models/shipit/review_stack.rb +116 -0
- data/app/models/shipit/review_stack_provisioning_queue.rb +39 -0
- data/app/models/shipit/rollback.rb +1 -0
- data/app/models/shipit/stack.rb +130 -57
- data/app/models/shipit/status.rb +3 -2
- data/app/models/shipit/status/common.rb +7 -6
- data/app/models/shipit/status/group.rb +1 -0
- data/app/models/shipit/status/missing.rb +2 -1
- data/app/models/shipit/status/unknown.rb +2 -1
- data/app/models/shipit/task.rb +118 -14
- data/app/models/shipit/task_definition.rb +1 -0
- data/app/models/shipit/task_execution_strategy/base.rb +20 -0
- data/app/models/shipit/task_execution_strategy/default.rb +110 -0
- data/app/models/shipit/team.rb +2 -1
- data/app/models/shipit/undeployed_commit.rb +1 -0
- data/app/models/shipit/unlimited_api_client.rb +1 -0
- data/app/models/shipit/user.rb +15 -8
- data/app/models/shipit/variable_definition.rb +1 -0
- data/app/models/shipit/webhooks.rb +43 -0
- data/app/models/shipit/webhooks/handlers/check_suite_handler.rb +20 -0
- data/app/models/shipit/webhooks/handlers/handler.rb +41 -0
- data/app/models/shipit/webhooks/handlers/membership_handler.rb +46 -0
- data/app/models/shipit/webhooks/handlers/pull_request/assigned_handler.rb +74 -0
- data/app/models/shipit/webhooks/handlers/pull_request/closed_handler.rb +68 -0
- data/app/models/shipit/webhooks/handlers/pull_request/edited_handler.rb +74 -0
- data/app/models/shipit/webhooks/handlers/pull_request/label_capturing_handler.rb +127 -0
- data/app/models/shipit/webhooks/handlers/pull_request/labeled_handler.rb +106 -0
- data/app/models/shipit/webhooks/handlers/pull_request/opened_handler.rb +83 -0
- data/app/models/shipit/webhooks/handlers/pull_request/reopened_handler.rb +88 -0
- data/app/models/shipit/webhooks/handlers/pull_request/review_stack_adapter.rb +103 -0
- data/app/models/shipit/webhooks/handlers/pull_request/unlabeled_handler.rb +107 -0
- data/app/models/shipit/webhooks/handlers/push_handler.rb +21 -0
- data/app/models/shipit/webhooks/handlers/status_handler.rb +27 -0
- data/app/serializers/concerns/shipit/conditional_attributes.rb +1 -0
- data/app/serializers/shipit/anonymous_user_serializer.rb +1 -0
- data/app/serializers/shipit/command_line_user_serializer.rb +1 -0
- data/app/serializers/shipit/commit_serializer.rb +1 -0
- data/app/serializers/shipit/deploy_serializer.rb +8 -1
- data/app/serializers/shipit/hook_serializer.rb +1 -0
- data/app/serializers/shipit/merge_request_serializer.rb +21 -0
- data/app/serializers/shipit/pull_request_serializer.rb +6 -8
- data/app/serializers/shipit/review_stack_serializer.rb +7 -0
- data/app/serializers/shipit/rollback_serializer.rb +1 -0
- data/app/serializers/shipit/short_commit_serializer.rb +1 -0
- data/app/serializers/shipit/stack_serializer.rb +12 -5
- data/app/serializers/shipit/tail_task_serializer.rb +11 -2
- data/app/serializers/shipit/task_serializer.rb +2 -17
- data/app/serializers/shipit/user_serializer.rb +6 -1
- data/app/validators/ascii_only_validator.rb +4 -3
- data/app/validators/subset_validator.rb +1 -0
- data/app/views/layouts/_head.html.erb +0 -0
- data/app/views/layouts/shipit.html.erb +5 -3
- data/app/views/shipit/_variables.html.erb +1 -1
- data/app/views/shipit/api_clients/index.html.erb +36 -0
- data/app/views/shipit/api_clients/new.html.erb +33 -0
- data/app/views/shipit/api_clients/show.html.erb +35 -0
- data/app/views/shipit/ccmenu/project.xml.builder +2 -1
- data/app/views/shipit/deploys/show.html.erb +2 -2
- data/app/views/shipit/merge_requests/_merge_request.html.erb +29 -0
- data/app/views/shipit/{pull_requests → merge_requests}/index.html.erb +2 -2
- data/app/views/shipit/merge_requests/merge_requests/_pull_request.html.erb +29 -0
- data/app/views/shipit/merge_requests/merge_requests/index.html.erb +20 -0
- data/app/views/shipit/merge_status/_merge_queue_button.html.erb +3 -3
- data/app/views/shipit/merge_status/backlogged.html.erb +1 -1
- data/app/views/shipit/merge_status/failure.html.erb +1 -1
- data/app/views/shipit/merge_status/locked.html.erb +1 -1
- data/app/views/shipit/merge_status/logged_out.erb +1 -1
- data/app/views/shipit/merge_status/success.html.erb +2 -2
- data/app/views/shipit/repositories/_header.html.erb +19 -0
- data/app/views/shipit/repositories/index.html.erb +31 -0
- data/app/views/shipit/repositories/new.html.erb +23 -0
- data/app/views/shipit/repositories/settings.html.erb +53 -0
- data/app/views/shipit/repositories/show.html.erb +30 -0
- data/app/views/shipit/stacks/_banners.html.erb +13 -0
- data/app/views/shipit/stacks/_header.html.erb +30 -12
- data/app/views/shipit/stacks/_links.html.erb +1 -0
- data/app/views/shipit/stacks/_stack.html.erb +8 -0
- data/app/views/shipit/stacks/all_tasks.html.erb +28 -0
- data/app/views/shipit/stacks/index.html.erb +9 -3
- data/app/views/shipit/stacks/settings.html.erb +22 -3
- data/app/views/shipit/stacks/show.html.erb +1 -1
- data/app/views/shipit/stacks/statistics.html.erb +82 -0
- data/app/views/shipit/tasks/_task_output.html.erb +1 -1
- data/app/views/shipit/tasks/show.html.erb +1 -1
- data/config/initializers/inflections.rb +2 -1
- data/config/locales/en.yml +18 -5
- data/config/routes.rb +29 -7
- data/db/migrate/20191209231045_create_shipit_repositories.rb +12 -0
- data/db/migrate/20191209231307_add_repository_reference_to_stacks.rb +15 -0
- data/db/migrate/20191216162728_backfill_repository_data.rb +22 -0
- data/db/migrate/20191216163010_remove_repository_information_from_stacks.rb +20 -0
- data/db/migrate/20191219205202_add_archived_since_to_stacks.rb +6 -0
- data/db/migrate/20200102175621_optional_task_commits.rb +6 -0
- data/db/migrate/20200109132519_add_sha_to_commit_deployments.rb +5 -0
- data/db/migrate/20200226211925_add_index_to_tasks_status.rb +5 -0
- data/db/migrate/20200427135152_add_pull_request_head_sha_to_commit.rb +5 -0
- data/db/migrate/20200615181558_add_rollback_once_aborted_to.rb +5 -0
- data/db/migrate/20200706145406_add_review_stacks.rb +12 -0
- data/db/migrate/20200804144639_rename_pull_request_to_merge_request.rb +7 -0
- data/db/migrate/20200804161512_rename_commits_pull_request_id_to_merge_request_id.rb +5 -0
- data/db/migrate/20200813134712_recreate_shipit_pull_requests.rb +22 -0
- data/db/migrate/20200813194056_create_pull_request_assignments.rb +8 -0
- data/db/migrate/20201001125502_add_provision_pr_stacks_flag_to_repositories.rb +7 -0
- data/db/migrate/20201008145809_add_retry_attempt_to_tasks.rb +5 -0
- data/db/migrate/20201008152744_add_max_retries_to_tasks.rb +5 -0
- data/lib/shipit.rb +23 -3
- data/lib/shipit/cast_value.rb +1 -0
- data/lib/shipit/command.rb +14 -18
- data/lib/shipit/commands.rb +5 -4
- data/lib/shipit/csv_serializer.rb +1 -0
- data/lib/shipit/deploy_commands.rb +1 -0
- data/lib/shipit/engine.rb +11 -2
- data/lib/shipit/environment_variables.rb +11 -1
- data/lib/shipit/first_parent_commits_iterator.rb +1 -0
- data/lib/shipit/flock.rb +1 -0
- data/lib/shipit/github_app.rb +41 -10
- data/lib/shipit/github_http_cache_middleware.rb +1 -0
- data/lib/shipit/null_serializer.rb +1 -0
- data/lib/shipit/octokit_check_runs.rb +3 -2
- data/lib/shipit/octokit_iterator.rb +3 -2
- data/lib/shipit/paginator.rb +3 -2
- data/lib/shipit/review_stack_commands.rb +8 -0
- data/lib/shipit/rollback_commands.rb +1 -0
- data/lib/shipit/same_site_cookie_middleware.rb +29 -0
- data/lib/shipit/simple_message_verifier.rb +1 -0
- data/lib/shipit/stack_commands.rb +12 -4
- data/lib/shipit/stat.rb +1 -0
- data/lib/shipit/task_commands.rb +23 -14
- data/lib/shipit/version.rb +2 -1
- data/lib/snippets/release-gem +5 -1
- data/lib/tasks/cron.rake +13 -2
- data/lib/tasks/dev.rake +3 -2
- data/lib/tasks/shipit.rake +16 -17
- data/lib/tasks/teams.rake +1 -0
- data/test/controllers/api/base_controller_test.rb +3 -2
- data/test/controllers/api/ccmenu_controller_test.rb +9 -8
- data/test/controllers/api/commits_controller_test.rb +3 -2
- data/test/controllers/api/deploys_controller_test.rb +15 -14
- data/test/controllers/api/hooks_controller_test.rb +8 -7
- data/test/controllers/api/locks_controller_test.rb +7 -6
- data/test/controllers/api/{pull_requests_controller_test.rb → merge_requests_controller_test.rb} +17 -16
- data/test/controllers/api/outputs_controller_test.rb +4 -2
- data/test/controllers/api/release_statuses_controller_test.rb +2 -1
- data/test/controllers/api/rollback_controller_test.rb +113 -0
- data/test/controllers/api/stacks_controller_test.rb +65 -16
- data/test/controllers/api/tasks_controller_test.rb +13 -12
- data/test/controllers/api_clients_controller_test.rb +104 -0
- data/test/controllers/ccmenu_controller_test.rb +4 -3
- data/test/controllers/commit_checks_controller_test.rb +4 -3
- data/test/controllers/commits_controller_test.rb +3 -2
- data/test/controllers/deploys_controller_test.rb +33 -22
- data/test/controllers/github_authentication_controller_test.rb +1 -0
- data/test/controllers/merge_requests_controller_test.rb +32 -0
- data/test/controllers/merge_status_controller_test.rb +27 -9
- data/test/controllers/release_statuses_controller_test.rb +3 -2
- data/test/controllers/repositories_controller_test.rb +71 -0
- data/test/controllers/rollbacks_controller_test.rb +9 -8
- data/test/controllers/stacks_controller_test.rb +72 -15
- data/test/controllers/status_controller_test.rb +1 -0
- data/test/controllers/tasks_controller_test.rb +33 -20
- data/test/controllers/webhooks_controller_test.rb +36 -9
- data/test/dummy/config/application.rb +7 -2
- data/test/dummy/config/environments/development.rb +23 -6
- data/test/dummy/config/environments/test.rb +2 -5
- data/test/dummy/db/schema.rb +76 -24
- data/test/dummy/db/seeds.rb +30 -16
- data/test/fixtures/payloads/check_suite_master.json +2 -2
- data/test/fixtures/payloads/invalid_pull_request.json +117 -0
- data/test/fixtures/payloads/provision_disabled_pull_request.json +454 -0
- data/test/fixtures/payloads/pull_request_assigned.json +480 -0
- data/test/fixtures/payloads/pull_request_closed.json +454 -0
- data/test/fixtures/payloads/pull_request_labeled.json +461 -0
- data/test/fixtures/payloads/pull_request_opened.json +454 -0
- data/test/fixtures/payloads/pull_request_reopened.json +454 -0
- data/test/fixtures/payloads/pull_request_unlabeled.json +454 -0
- data/test/fixtures/payloads/pull_request_with_no_repo.json +454 -0
- data/test/fixtures/shipit/commit_deployment_statuses.yml +4 -4
- data/test/fixtures/shipit/commit_deployments.yml +8 -8
- data/test/fixtures/shipit/commits.yml +52 -1
- data/test/fixtures/shipit/merge_requests.yml +141 -0
- data/test/fixtures/shipit/pull_request_assignments.yml +3 -0
- data/test/fixtures/shipit/pull_requests.yml +10 -131
- data/test/fixtures/shipit/repositories.yml +28 -0
- data/test/fixtures/shipit/stacks.yml +335 -30
- data/test/fixtures/shipit/statuses.yml +9 -0
- data/test/fixtures/shipit/tasks.yml +69 -3
- data/test/fixtures/shipit/users.yml +7 -0
- data/test/fixtures/timeout +2 -1
- data/test/helpers/api_helper.rb +1 -0
- data/test/helpers/fixture_aliases_helper.rb +1 -0
- data/test/helpers/hooks_helper.rb +2 -1
- data/test/helpers/json_helper.rb +15 -11
- data/test/helpers/links_helper.rb +4 -3
- data/test/helpers/payloads_helper.rb +5 -0
- data/test/helpers/queries_helper.rb +3 -2
- data/test/jobs/cache_deploy_spec_job_test.rb +2 -1
- data/test/jobs/chunk_rollup_job_test.rb +16 -1
- data/test/jobs/deliver_hook_job_test.rb +1 -0
- data/test/jobs/destroy_repository_job_test.rb +27 -0
- data/test/jobs/destroy_stack_job_test.rb +10 -0
- data/test/jobs/emit_event_job_test.rb +2 -1
- data/test/jobs/fetch_commit_stats_job_test.rb +1 -0
- data/test/jobs/fetch_deployed_revision_job_test.rb +1 -0
- data/test/jobs/github_sync_job_test.rb +1 -0
- data/test/jobs/mark_deploy_healthy_job_test.rb +1 -0
- data/test/jobs/perform_task_job_test.rb +12 -11
- data/test/jobs/{merge_pull_requests_job_test.rb → process_merge_requests_job_test.rb} +19 -18
- data/test/jobs/purge_old_deliveries_job_test.rb +1 -0
- data/test/jobs/reap_dead_tasks_job_test.rb +68 -0
- data/test/jobs/refresh_github_user_job_test.rb +1 -0
- data/test/jobs/refresh_status_job_test.rb +1 -0
- data/test/jobs/unique_job_test.rb +1 -0
- data/test/jobs/update_github_last_deployed_ref_job_test.rb +1 -0
- data/test/lib/shipit/deploy_commands_test.rb +16 -0
- data/test/lib/shipit/task_commands_test.rb +17 -0
- data/test/middleware/same_site_cookie_middleware_test.rb +52 -0
- data/test/models/api_client_test.rb +1 -0
- data/test/models/commit_checks_test.rb +1 -0
- data/test/models/commit_deployment_status_test.rb +34 -4
- data/test/models/commit_deployment_test.rb +9 -11
- data/test/models/commits_test.rb +116 -21
- data/test/models/delivery_test.rb +2 -1
- data/test/models/deploy_spec_test.rb +103 -65
- data/test/models/deploy_stats_test.rb +113 -0
- data/test/models/deploys_test.rb +207 -26
- data/test/models/duration_test.rb +1 -0
- data/test/models/github_hook_test.rb +1 -0
- data/test/models/hook_test.rb +20 -16
- data/test/models/membership_test.rb +1 -0
- data/test/models/{pull_request_test.rb → merge_request_test.rb} +48 -41
- data/test/models/pull_request_assignment_test.rb +16 -0
- data/test/models/release_statuses_test.rb +1 -0
- data/test/models/rollbacks_test.rb +1 -0
- data/test/models/shipit/check_run_test.rb +1 -0
- data/test/models/shipit/provisioning_handler/base_test.rb +33 -0
- data/test/models/shipit/provisioning_handler/unregistered_provisioning_handler_test.rb +49 -0
- data/test/models/shipit/provisioning_handler_test.rb +64 -0
- data/test/models/shipit/pull_request_test.rb +52 -0
- data/test/models/shipit/repository_test.rb +81 -0
- data/test/models/shipit/review_stack_provision_status_test.rb +77 -0
- data/test/models/shipit/review_stack_provisioning_queue_test.rb +63 -0
- data/test/models/shipit/review_stack_test.rb +59 -0
- data/test/models/{stacks_test.rb → shipit/stacks_test.rb} +120 -60
- data/test/models/shipit/webhooks/handlers/pull_request/assigned_handler_test.rb +45 -0
- data/test/models/shipit/webhooks/handlers/pull_request/closed_handler_test.rb +192 -0
- data/test/models/shipit/webhooks/handlers/pull_request/edited_handler_test.rb +47 -0
- data/test/models/shipit/webhooks/handlers/pull_request/label_capturing_handler_test.rb +209 -0
- data/test/models/shipit/webhooks/handlers/pull_request/labeled_handler_test.rb +332 -0
- data/test/models/shipit/webhooks/handlers/pull_request/opened_handler_test.rb +238 -0
- data/test/models/shipit/webhooks/handlers/pull_request/reopened_handler_test.rb +282 -0
- data/test/models/shipit/webhooks/handlers/pull_request/review_stack_adapter_test.rb +83 -0
- data/test/models/shipit/webhooks/handlers/pull_request/unlabeled_handler_test.rb +324 -0
- data/test/models/shipit/webhooks/handlers_test.rb +27 -0
- data/test/models/status/group_test.rb +1 -0
- data/test/models/status/missing_test.rb +1 -0
- data/test/models/status_test.rb +1 -0
- data/test/models/task_definitions_test.rb +9 -8
- data/test/models/tasks_test.rb +59 -1
- data/test/models/team_test.rb +4 -2
- data/test/models/undeployed_commits_test.rb +14 -0
- data/test/models/users_test.rb +13 -5
- data/test/serializers/shipit/pull_request_serializer_test.rb +29 -0
- data/test/test_command_integration.rb +3 -2
- data/test/test_helper.rb +37 -32
- data/test/unit/anonymous_user_serializer_test.rb +14 -0
- data/test/unit/command_test.rb +15 -10
- data/test/unit/commands_test.rb +1 -0
- data/test/unit/commit_serializer_test.rb +16 -0
- data/test/unit/csv_serializer_test.rb +3 -2
- data/test/unit/deploy_commands_test.rb +14 -4
- data/test/unit/deploy_serializer_test.rb +17 -0
- data/test/unit/environment_variables_test.rb +5 -4
- data/test/unit/github_app_test.rb +137 -0
- data/test/unit/github_url_helper_test.rb +6 -0
- data/test/unit/rollback_commands_test.rb +2 -1
- data/test/unit/shipit_helper_test.rb +17 -0
- data/test/unit/shipit_task_execution_strategy_test.rb +47 -0
- data/test/unit/shipit_test.rb +1 -0
- data/test/unit/user_serializer_test.rb +14 -0
- data/test/unit/variable_definition_test.rb +1 -0
- metadata +334 -169
- data/app/controllers/shipit/api/pull_requests_controller.rb +0 -36
- data/app/controllers/shipit/pull_requests_controller.rb +0 -30
- data/app/jobs/shipit/merge_pull_requests_job.rb +0 -31
- data/app/jobs/shipit/refresh_pull_request_job.rb +0 -10
- data/app/views/shipit/pull_requests/_pull_request.html.erb +0 -29
- data/test/controllers/pull_requests_controller_test.rb +0 -31
- data/test/fixtures/shipit/output_chunks.yml +0 -47
- data/test/models/output_chunk_test.rb +0 -20
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'test_helper'
|
2
3
|
|
3
4
|
module Shipit
|
@@ -11,7 +12,7 @@ module Shipit
|
|
11
12
|
end
|
12
13
|
|
13
14
|
test "tasks defined in the shipit.yml can be displayed" do
|
14
|
-
get :new, params: {stack_id: @stack, definition_id: @definition.id}
|
15
|
+
get :new, params: { stack_id: @stack, definition_id: @definition.id }
|
15
16
|
assert_response :ok
|
16
17
|
end
|
17
18
|
|
@@ -20,7 +21,7 @@ module Shipit
|
|
20
21
|
|
21
22
|
assert_predicate @stack, :active_task?
|
22
23
|
assert_no_difference -> { @stack.tasks.count } do
|
23
|
-
post :create, params: {stack_id: @stack, definition_id: @definition.id}
|
24
|
+
post :create, params: { stack_id: @stack, definition_id: @definition.id }
|
24
25
|
end
|
25
26
|
assert_redirected_to new_stack_tasks_path(@stack, @definition)
|
26
27
|
end
|
@@ -30,7 +31,7 @@ module Shipit
|
|
30
31
|
|
31
32
|
assert_predicate @stack, :active_task?
|
32
33
|
assert_difference -> { @stack.tasks.count } do
|
33
|
-
post :create, params: {stack_id: @stack, definition_id: @definition.id, force: 'true'}
|
34
|
+
post :create, params: { stack_id: @stack, definition_id: @definition.id, force: 'true' }
|
34
35
|
end
|
35
36
|
assert_redirected_to stack_task_path(@stack, Task.last)
|
36
37
|
end
|
@@ -38,34 +39,34 @@ module Shipit
|
|
38
39
|
test "tasks defined in the shipit.yml can be triggered while the stack is being deployed if specified as such" do
|
39
40
|
@definition = @stack.find_task_definition('flush_cache')
|
40
41
|
assert_difference -> { @stack.tasks.count } do
|
41
|
-
post :create, params: {stack_id: @stack, definition_id: @definition.id}
|
42
|
+
post :create, params: { stack_id: @stack, definition_id: @definition.id }
|
42
43
|
end
|
43
44
|
assert_redirected_to stack_task_path(@stack, Task.last)
|
44
45
|
end
|
45
46
|
|
46
47
|
test "tasks with variables defined in the shipit.yml can be triggered with their variables set" do
|
47
|
-
env = {"FOO" => "0"}
|
48
|
+
env = { "FOO" => "0" }
|
48
49
|
|
49
|
-
post :create, params: {stack_id: @stack, definition_id: @definition.id, task: {env: env}, force: 'true'}
|
50
|
+
post :create, params: { stack_id: @stack, definition_id: @definition.id, task: { env: env }, force: 'true' }
|
50
51
|
|
51
52
|
assert_redirected_to stack_tasks_path(@stack, Task.last)
|
52
53
|
end
|
53
54
|
|
54
55
|
test "triggered tasks can be observed" do
|
55
|
-
get :show, params: {stack_id: @stack, id: @task.id}
|
56
|
+
get :show, params: { stack_id: @stack, id: @task.id }
|
56
57
|
assert_response :ok
|
57
58
|
end
|
58
59
|
|
59
60
|
test "triggered tasks can be observed as raw text" do
|
60
|
-
get :show, params: {stack_id: @stack, id: @task.id}, format: 'txt'
|
61
|
+
get :show, params: { stack_id: @stack, id: @task.id }, format: 'txt'
|
61
62
|
assert_response :success
|
62
|
-
assert_equal("text/plain", @response.
|
63
|
+
assert_equal("text/plain", @response.media_type)
|
63
64
|
end
|
64
65
|
|
65
66
|
test ":abort call abort! on the deploy" do
|
66
67
|
@task = shipit_deploys(:shipit_running)
|
67
68
|
@task.ping
|
68
|
-
post :abort, params: {stack_id: @stack.to_param, id: @task.id}
|
69
|
+
post :abort, params: { stack_id: @stack.to_param, id: @task.id }
|
69
70
|
|
70
71
|
@task.reload
|
71
72
|
assert_response :success
|
@@ -77,7 +78,7 @@ module Shipit
|
|
77
78
|
test ":abort schedule the rollback if `rollback` is present" do
|
78
79
|
@task = shipit_deploys(:shipit_running)
|
79
80
|
@task.ping
|
80
|
-
post :abort, params: {stack_id: @stack.to_param, id: @task.id, rollback: 'true'}
|
81
|
+
post :abort, params: { stack_id: @stack.to_param, id: @task.id, rollback: 'true' }
|
81
82
|
|
82
83
|
@task.reload
|
83
84
|
assert_response :success
|
@@ -87,31 +88,43 @@ module Shipit
|
|
87
88
|
end
|
88
89
|
|
89
90
|
test ":index list the stack deploys" do
|
90
|
-
get :index, params: {stack_id: @stack.to_param}
|
91
|
+
get :index, params: { stack_id: @stack.to_param }
|
91
92
|
assert_response :success
|
92
93
|
assert_select '.task-list .task', @stack.tasks.count
|
93
94
|
end
|
94
95
|
|
95
96
|
test ":index paginates with the `since` parameter" do
|
96
|
-
get :index, params: {stack_id: @stack.to_param, since: @stack.tasks.last.id}
|
97
|
+
get :index, params: { stack_id: @stack.to_param, since: @stack.tasks.last.id }
|
97
98
|
assert_response :success
|
98
99
|
assert_select '.task-list .task', @stack.tasks.count - 1
|
99
100
|
end
|
100
101
|
|
101
102
|
test ":tail returns the task status, output, and next url" do
|
102
103
|
@task = shipit_deploys(:shipit_running)
|
103
|
-
|
104
|
+
@task.write("dummy output")
|
105
|
+
last_chunk = @task.chunk_output.bytesize
|
104
106
|
|
105
|
-
get :tail, params: {stack_id: @stack.to_param, id: @task.id
|
107
|
+
get :tail, params: { stack_id: @stack.to_param, id: @task.id }, format: :json
|
106
108
|
assert_response :success
|
107
109
|
assert_json_keys %w(url status output)
|
108
110
|
assert_json 'status', @task.status
|
111
|
+
assert_json 'output', @task.chunk_output
|
112
|
+
assert_json 'url', "/shopify/shipit-engine/production/tasks/#{@task.id}/tail?last_byte=#{last_chunk}"
|
113
|
+
end
|
114
|
+
|
115
|
+
test ":tail can handle last_byte as string" do
|
116
|
+
@task = shipit_deploys(:shipit_running)
|
117
|
+
@task.write("dummy output")
|
118
|
+
|
119
|
+
get :tail, params: { stack_id: @stack.to_param, id: @task.id, last_byte: "50" }, format: :json
|
120
|
+
assert_response :success
|
121
|
+
assert_json_keys %w(url status output)
|
109
122
|
end
|
110
123
|
|
111
124
|
test ":tail doesn't returns the next url if the task is finished" do
|
112
125
|
@task = shipit_deploys(:shipit)
|
113
126
|
|
114
|
-
get :tail, params: {stack_id: @stack.to_param, id: @task.id}, format: :json
|
127
|
+
get :tail, params: { stack_id: @stack.to_param, id: @task.id }, format: :json
|
115
128
|
assert_response :success
|
116
129
|
assert_no_json 'url'
|
117
130
|
end
|
@@ -119,7 +132,7 @@ module Shipit
|
|
119
132
|
test ":tail returns the rollback url if the task have been aborted" do
|
120
133
|
@task = shipit_deploys(:shipit_aborted)
|
121
134
|
|
122
|
-
get :tail, params: {stack_id: @stack.to_param, id: @task.id}, format: :json
|
135
|
+
get :tail, params: { stack_id: @stack.to_param, id: @task.id }, format: :json
|
123
136
|
assert_response :success
|
124
137
|
assert_json_keys %w(status output rollback_url)
|
125
138
|
end
|
@@ -127,7 +140,7 @@ module Shipit
|
|
127
140
|
test ":lookup returns stack task url if the task is an instance of Task" do
|
128
141
|
@task = shipit_tasks(:shipit_restart)
|
129
142
|
|
130
|
-
get :lookup, params: {id: @task.id}
|
143
|
+
get :lookup, params: { id: @task.id }
|
131
144
|
|
132
145
|
assert_redirected_to stack_task_path(@task.stack, @task)
|
133
146
|
end
|
@@ -135,7 +148,7 @@ module Shipit
|
|
135
148
|
test ":lookup returns stack deploy url if the task is an instance of Deploy" do
|
136
149
|
@task = shipit_tasks(:shipit)
|
137
150
|
|
138
|
-
get :lookup, params: {id: @task.id}
|
151
|
+
get :lookup, params: { id: @task.id }
|
139
152
|
|
140
153
|
assert_redirected_to stack_deploy_path(@task.stack, @task)
|
141
154
|
end
|
@@ -143,7 +156,7 @@ module Shipit
|
|
143
156
|
test ":lookup returns stack deploy url if the task is an instance of Rollback" do
|
144
157
|
@task = shipit_tasks(:shipit_rollback)
|
145
158
|
|
146
|
-
get :lookup, params: {id: @task.id}
|
159
|
+
get :lookup, params: { id: @task.id }
|
147
160
|
|
148
161
|
assert_redirected_to stack_deploy_path(@task.stack, @task)
|
149
162
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'test_helper'
|
2
3
|
|
3
4
|
module Shipit
|
@@ -7,6 +8,17 @@ module Shipit
|
|
7
8
|
GithubHook.any_instance.stubs(:verify_signature).returns(true)
|
8
9
|
end
|
9
10
|
|
11
|
+
test "create github repository which is not yet present in the datastore" do
|
12
|
+
request.headers['X-Github-Event'] = 'push'
|
13
|
+
unknown_repo_payload = JSON.parse(payload(:push_master))
|
14
|
+
unknown_repo_payload["repository"]["full_name"] = "owner/unknown-repository"
|
15
|
+
unknown_repo_payload = unknown_repo_payload.to_json
|
16
|
+
|
17
|
+
assert_nothing_raised do
|
18
|
+
post :create, body: unknown_repo_payload, as: :json
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
10
22
|
test ":push with the target branch queues a GithubSyncJob" do
|
11
23
|
request.headers['X-Github-Event'] = 'push'
|
12
24
|
|
@@ -43,14 +55,14 @@ module Shipit
|
|
43
55
|
|
44
56
|
test ":state with a unexisting commit respond with 200 OK" do
|
45
57
|
request.headers['X-Github-Event'] = 'status'
|
46
|
-
params = {'sha' => 'notarealcommit', 'state' => 'pending', 'branches' => [{'name' => 'master'}]}.to_json
|
58
|
+
params = { 'sha' => 'notarealcommit', 'state' => 'pending', 'branches' => [{ 'name' => 'master' }] }.to_json
|
47
59
|
post :create, body: params, as: :json
|
48
60
|
assert_response :ok
|
49
61
|
end
|
50
62
|
|
51
63
|
test ":state in an untracked branche bails out" do
|
52
64
|
request.headers['X-Github-Event'] = 'status'
|
53
|
-
params = {'sha' => 'notarealcommit', 'state' => 'pending', 'branches' => []}.to_json
|
65
|
+
params = { 'sha' => 'notarealcommit', 'state' => 'pending', 'branches' => [] }.to_json
|
54
66
|
post :create, body: params, as: :json
|
55
67
|
assert_response :ok
|
56
68
|
end
|
@@ -68,7 +80,7 @@ module Shipit
|
|
68
80
|
@request.headers['X-Github-Event'] = 'ping'
|
69
81
|
|
70
82
|
assert_no_enqueued_jobs do
|
71
|
-
post :create, body: {zen: 'Git is beautiful'}.to_json, as: :json
|
83
|
+
post :create, body: { zen: 'Git is beautiful' }.to_json, as: :json
|
72
84
|
assert_response :ok
|
73
85
|
end
|
74
86
|
end
|
@@ -76,7 +88,7 @@ module Shipit
|
|
76
88
|
test "verifies webhook signature" do
|
77
89
|
commit = shipit_commits(:first)
|
78
90
|
|
79
|
-
payload = {"sha" => commit.sha, "state" => "pending", "target_url" => "https://ci.example.com/1000/output"}.to_json
|
91
|
+
payload = { "sha" => commit.sha, "state" => "pending", "target_url" => "https://ci.example.com/1000/output" }.to_json
|
80
92
|
signature = 'sha1=4848deb1c9642cd938e8caa578d201ca359a8249'
|
81
93
|
|
82
94
|
@request.headers['X-Github-Event'] = 'push'
|
@@ -105,7 +117,7 @@ module Shipit
|
|
105
117
|
@request.headers['X-Github-Event'] = 'membership'
|
106
118
|
Shipit.github.api.expects(:user).with('george').returns(george)
|
107
119
|
assert_difference -> { User.count }, 1 do
|
108
|
-
post :create, body: membership_params.merge(member: {login: 'george'}).to_json, as: :json
|
120
|
+
post :create, body: membership_params.merge(member: { login: 'george' }).to_json, as: :json
|
109
121
|
assert_response :ok
|
110
122
|
end
|
111
123
|
end
|
@@ -121,7 +133,7 @@ module Shipit
|
|
121
133
|
test ":membership can append an user membership" do
|
122
134
|
@request.headers['X-Github-Event'] = 'membership'
|
123
135
|
assert_difference -> { Membership.count }, 1 do
|
124
|
-
post :create, body: membership_params.merge(member: {login: 'bob'}).to_json, as: :json
|
136
|
+
post :create, body: membership_params.merge(member: { login: 'bob' }).to_json, as: :json
|
125
137
|
assert_response :ok
|
126
138
|
end
|
127
139
|
end
|
@@ -137,19 +149,34 @@ module Shipit
|
|
137
149
|
test ":membership can delete an user twice" do
|
138
150
|
@request.headers['X-Github-Event'] = 'membership'
|
139
151
|
assert_no_difference -> { Membership.count } do
|
140
|
-
post :create, body: membership_params.merge(action: 'removed', member: {login: 'bob'}).to_json, as: :json
|
152
|
+
post :create, body: membership_params.merge(action: 'removed', member: { login: 'bob' }).to_json, as: :json
|
141
153
|
assert_response :ok
|
142
154
|
end
|
143
155
|
end
|
144
156
|
|
157
|
+
test "other events trigger custom handlers" do
|
158
|
+
event = 'pull_request'
|
159
|
+
mock_handler = mock
|
160
|
+
mock_handler.expects(:call).with(pull_request_params.stringify_keys).once
|
161
|
+
Shipit::Webhooks.handlers["pull_request"] = [mock_handler]
|
162
|
+
|
163
|
+
@request.headers['X-Github-Event'] = event
|
164
|
+
post :create, body: pull_request_params.to_json, as: :json
|
165
|
+
assert_response :ok
|
166
|
+
end
|
167
|
+
|
145
168
|
private
|
146
169
|
|
170
|
+
def pull_request_params
|
171
|
+
{ action: 'opened', number: 2, pull_request: 'foobar' }
|
172
|
+
end
|
173
|
+
|
147
174
|
def membership_params
|
148
|
-
{action: 'added', team: team_params, organization: {login: 'shopify'}, member: {login: 'walrus'}}
|
175
|
+
{ action: 'added', team: team_params, organization: { login: 'shopify' }, member: { login: 'walrus' } }
|
149
176
|
end
|
150
177
|
|
151
178
|
def team_params
|
152
|
-
{id: shipit_teams(:shopify_developers).id, slug: 'developers', name: 'Developers', url: 'http://example.com'}
|
179
|
+
{ id: shipit_teams(:shopify_developers).id, slug: 'developers', name: 'Developers', url: 'http://example.com' }
|
153
180
|
end
|
154
181
|
|
155
182
|
def george
|
@@ -1,6 +1,11 @@
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'active_record/railtie'
|
4
|
+
require 'action_controller/railtie'
|
5
|
+
require 'action_view/railtie'
|
6
|
+
require 'active_job/railtie'
|
7
|
+
require 'rails/test_unit/railtie'
|
8
|
+
require 'sprockets/railtie'
|
4
9
|
|
5
10
|
Bundler.require(*Rails.groups)
|
6
11
|
require "shipit"
|
@@ -12,7 +17,7 @@ end
|
|
12
17
|
|
13
18
|
module Shipit
|
14
19
|
class Application < Rails::Application
|
15
|
-
config.load_defaults
|
20
|
+
config.load_defaults 6.0
|
16
21
|
end
|
17
22
|
end
|
18
23
|
|
@@ -9,12 +9,24 @@ Rails.application.configure do
|
|
9
9
|
# Do not eager load code on boot.
|
10
10
|
config.eager_load = false
|
11
11
|
|
12
|
-
# Show full error reports
|
13
|
-
config.consider_all_requests_local
|
14
|
-
config.action_controller.perform_caching = false
|
12
|
+
# Show full error reports
|
13
|
+
config.consider_all_requests_local = true
|
15
14
|
|
16
|
-
#
|
17
|
-
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
# Run rails dev:cache to toggle caching.
|
17
|
+
if Shipit::Engine.root.join("tmp", "caching-dev.txt").exist?
|
18
|
+
config.action_controller.perform_caching = true
|
19
|
+
config.action_controller.enable_fragment_cache_logging = true
|
20
|
+
|
21
|
+
config.cache_store = :memory_store
|
22
|
+
config.public_file_server.headers = {
|
23
|
+
"Cache-Control" => "public, max-age=#{2.days.to_i}",
|
24
|
+
}
|
25
|
+
else
|
26
|
+
config.action_controller.perform_caching = false
|
27
|
+
|
28
|
+
config.cache_store = :null_store
|
29
|
+
end
|
18
30
|
|
19
31
|
# Print deprecation notices to the Rails logger.
|
20
32
|
config.active_support.deprecation = :log
|
@@ -39,11 +51,16 @@ Rails.application.configure do
|
|
39
51
|
# Raises error for missing translations
|
40
52
|
# config.action_view.raise_on_missing_translations = true
|
41
53
|
if Rails.application.config_for(:database)['adapter'] == 'sqlite3'
|
42
|
-
|
54
|
+
config.to_prepare do
|
55
|
+
Shipit::DeferredTouch.enabled = false
|
56
|
+
end
|
43
57
|
end
|
58
|
+
|
44
59
|
config.active_job.queue_adapter = :async
|
45
60
|
|
46
61
|
Pubsubstub.use_persistent_connections = false
|
47
62
|
|
48
63
|
Shipit.disable_api_authentication = true if ENV['PUBLIC_API']
|
64
|
+
|
65
|
+
config.hosts << "shipit-engine.myshopify.io"
|
49
66
|
end
|
@@ -26,11 +26,6 @@ Rails.application.configure do
|
|
26
26
|
# Disable request forgery protection in test environment.
|
27
27
|
config.action_controller.allow_forgery_protection = false
|
28
28
|
|
29
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
-
# The :test delivery method accumulates sent emails in the
|
31
|
-
# ActionMailer::Base.deliveries array.
|
32
|
-
config.action_mailer.delivery_method = :test
|
33
|
-
|
34
29
|
# Randomize the order test cases are executed.
|
35
30
|
config.active_support.test_order = :random
|
36
31
|
|
@@ -42,5 +37,7 @@ Rails.application.configure do
|
|
42
37
|
|
43
38
|
config.to_prepare do
|
44
39
|
Shipit::DeferredTouch.enabled = false
|
40
|
+
# The deploy specs in fixtures are pretty printed, we should do the same to avoid marking stacks as dirty
|
41
|
+
Shipit::DeploySpec.pretty_generate = true
|
45
42
|
end
|
46
43
|
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
# of editing this file, please use the migrations feature of Active Record to
|
3
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
# from scratch.
|
9
|
-
#
|
5
|
+
# This file is the source Rails uses to define your schema when running `rails
|
6
|
+
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
9
|
+
# migrations use external dependencies or application code.
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 2020_10_08_152744) do
|
14
14
|
|
15
15
|
create_table "api_clients", force: :cascade do |t|
|
16
16
|
t.text "permissions", limit: 65535
|
@@ -55,6 +55,7 @@ ActiveRecord::Schema.define(version: 2019_05_02_020249) do
|
|
55
55
|
t.string "api_url"
|
56
56
|
t.datetime "created_at", null: false
|
57
57
|
t.datetime "updated_at", null: false
|
58
|
+
t.string "sha", limit: 40
|
58
59
|
t.index ["commit_id", "task_id"], name: "index_commit_deployments_on_commit_id_and_task_id", unique: true
|
59
60
|
t.index ["task_id"], name: "index_commit_deployments_on_task_id"
|
60
61
|
end
|
@@ -74,9 +75,10 @@ ActiveRecord::Schema.define(version: 2019_05_02_020249) do
|
|
74
75
|
t.integer "deletions", limit: 4
|
75
76
|
t.integer "pull_request_number"
|
76
77
|
t.string "pull_request_title", limit: 1024
|
77
|
-
t.integer "
|
78
|
+
t.integer "merge_request_id"
|
78
79
|
t.boolean "locked", default: false, null: false
|
79
80
|
t.integer "lock_author_id", limit: 4
|
81
|
+
t.string "pull_request_head_sha", limit: 40
|
80
82
|
t.index ["author_id"], name: "index_commits_on_author_id"
|
81
83
|
t.index ["committer_id"], name: "index_commits_on_committer_id"
|
82
84
|
t.index ["created_at"], name: "index_commits_on_created_at"
|
@@ -136,15 +138,7 @@ ActiveRecord::Schema.define(version: 2019_05_02_020249) do
|
|
136
138
|
t.index ["user_id"], name: "index_memberships_on_user_id"
|
137
139
|
end
|
138
140
|
|
139
|
-
create_table "
|
140
|
-
t.integer "task_id", limit: 4
|
141
|
-
t.text "text", limit: 16777215
|
142
|
-
t.datetime "created_at"
|
143
|
-
t.datetime "updated_at"
|
144
|
-
t.index ["task_id"], name: "index_output_chunks_on_task_id"
|
145
|
-
end
|
146
|
-
|
147
|
-
create_table "pull_requests", force: :cascade do |t|
|
141
|
+
create_table "merge_requests", force: :cascade do |t|
|
148
142
|
t.integer "stack_id", null: false
|
149
143
|
t.integer "number", null: false
|
150
144
|
t.string "title", limit: 256
|
@@ -166,11 +160,46 @@ ActiveRecord::Schema.define(version: 2019_05_02_020249) do
|
|
166
160
|
t.datetime "merged_at"
|
167
161
|
t.string "base_ref", limit: 1024
|
168
162
|
t.integer "base_commit_id"
|
163
|
+
t.index ["head_id"], name: "index_merge_requests_on_head_id"
|
164
|
+
t.index ["merge_requested_by_id"], name: "index_merge_requests_on_merge_requested_by_id"
|
165
|
+
t.index ["merge_status"], name: "index_merge_requests_on_merge_status"
|
166
|
+
t.index ["stack_id", "github_id"], name: "index_merge_requests_on_stack_id_and_github_id", unique: true
|
167
|
+
t.index ["stack_id", "merge_status"], name: "index_merge_requests_on_stack_id_and_merge_status"
|
168
|
+
t.index ["stack_id", "number"], name: "index_merge_requests_on_stack_id_and_number", unique: true
|
169
|
+
t.index ["stack_id"], name: "index_merge_requests_on_stack_id"
|
170
|
+
end
|
171
|
+
|
172
|
+
create_table "output_chunks", force: :cascade do |t|
|
173
|
+
t.integer "task_id", limit: 4
|
174
|
+
t.text "text", limit: 16777215
|
175
|
+
t.datetime "created_at"
|
176
|
+
t.datetime "updated_at"
|
177
|
+
t.index ["task_id"], name: "index_output_chunks_on_task_id"
|
178
|
+
end
|
179
|
+
|
180
|
+
create_table "pull_request_assignments", force: :cascade do |t|
|
181
|
+
t.integer "pull_request_id"
|
182
|
+
t.integer "user_id"
|
183
|
+
t.index ["pull_request_id"], name: "index_pull_request_assignments_on_pull_request_id"
|
184
|
+
t.index ["user_id"], name: "index_pull_request_assignments_on_user_id"
|
185
|
+
end
|
186
|
+
|
187
|
+
create_table "pull_requests", force: :cascade do |t|
|
188
|
+
t.integer "stack_id", null: false
|
189
|
+
t.integer "number", null: false
|
190
|
+
t.string "title", limit: 256
|
191
|
+
t.integer "github_id", limit: 8
|
192
|
+
t.string "api_url", limit: 1024
|
193
|
+
t.string "state"
|
194
|
+
t.integer "additions", default: 0, null: false
|
195
|
+
t.integer "deletions", default: 0, null: false
|
196
|
+
t.integer "user_id"
|
197
|
+
t.text "labels"
|
198
|
+
t.integer "head_id"
|
199
|
+
t.datetime "created_at", precision: 6, null: false
|
200
|
+
t.datetime "updated_at", precision: 6, null: false
|
169
201
|
t.index ["head_id"], name: "index_pull_requests_on_head_id"
|
170
|
-
t.index ["merge_requested_by_id"], name: "index_pull_requests_on_merge_requested_by_id"
|
171
|
-
t.index ["merge_status"], name: "index_pull_requests_on_merge_status"
|
172
202
|
t.index ["stack_id", "github_id"], name: "index_pull_requests_on_stack_id_and_github_id", unique: true
|
173
|
-
t.index ["stack_id", "merge_status"], name: "index_pull_requests_on_stack_id_and_merge_status"
|
174
203
|
t.index ["stack_id", "number"], name: "index_pull_requests_on_stack_id_and_number", unique: true
|
175
204
|
t.index ["stack_id"], name: "index_pull_requests_on_stack_id"
|
176
205
|
end
|
@@ -190,9 +219,18 @@ ActiveRecord::Schema.define(version: 2019_05_02_020249) do
|
|
190
219
|
t.index ["user_id"], name: "index_deploy_statuses_on_user_id"
|
191
220
|
end
|
192
221
|
|
222
|
+
create_table "repositories", force: :cascade do |t|
|
223
|
+
t.string "owner", limit: 39, null: false
|
224
|
+
t.string "name", limit: 100, null: false
|
225
|
+
t.datetime "created_at", precision: 6, null: false
|
226
|
+
t.datetime "updated_at", precision: 6, null: false
|
227
|
+
t.boolean "review_stacks_enabled", default: false
|
228
|
+
t.string "provisioning_behavior", default: "allow_all"
|
229
|
+
t.string "provisioning_label_name"
|
230
|
+
t.index ["owner", "name"], name: "repository_unicity", unique: true
|
231
|
+
end
|
232
|
+
|
193
233
|
create_table "stacks", force: :cascade do |t|
|
194
|
-
t.string "repo_name", limit: 100, null: false
|
195
|
-
t.string "repo_owner", limit: 39, null: false
|
196
234
|
t.string "environment", limit: 50, default: "production", null: false
|
197
235
|
t.datetime "created_at"
|
198
236
|
t.datetime "updated_at"
|
@@ -211,7 +249,17 @@ ActiveRecord::Schema.define(version: 2019_05_02_020249) do
|
|
211
249
|
t.datetime "locked_since"
|
212
250
|
t.boolean "merge_queue_enabled", default: false, null: false
|
213
251
|
t.datetime "last_deployed_at"
|
214
|
-
t.
|
252
|
+
t.integer "repository_id", null: false
|
253
|
+
t.datetime "archived_since"
|
254
|
+
t.string "provision_status", default: "deprovisioned", null: false
|
255
|
+
t.string "type", default: "Shipit::Stack"
|
256
|
+
t.boolean "awaiting_provision", default: false, null: false
|
257
|
+
t.index ["archived_since"], name: "index_stacks_on_archived_since"
|
258
|
+
t.index ["awaiting_provision"], name: "index_stacks_on_awaiting_provision"
|
259
|
+
t.index ["provision_status"], name: "index_stacks_on_provision_status"
|
260
|
+
t.index ["repository_id", "environment"], name: "stack_unicity", unique: true
|
261
|
+
t.index ["repository_id"], name: "index_stacks_on_repository_id"
|
262
|
+
t.index ["type"], name: "index_stacks_on_type"
|
215
263
|
end
|
216
264
|
|
217
265
|
create_table "statuses", force: :cascade do |t|
|
@@ -228,8 +276,8 @@ ActiveRecord::Schema.define(version: 2019_05_02_020249) do
|
|
228
276
|
|
229
277
|
create_table "tasks", force: :cascade do |t|
|
230
278
|
t.integer "stack_id", limit: 4, null: false
|
231
|
-
t.integer "since_commit_id", limit: 4
|
232
|
-
t.integer "until_commit_id", limit: 4
|
279
|
+
t.integer "since_commit_id", limit: 4
|
280
|
+
t.integer "until_commit_id", limit: 4
|
233
281
|
t.string "status", limit: 10, default: "pending", null: false
|
234
282
|
t.datetime "created_at"
|
235
283
|
t.datetime "updated_at"
|
@@ -249,11 +297,15 @@ ActiveRecord::Schema.define(version: 2019_05_02_020249) do
|
|
249
297
|
t.datetime "ended_at"
|
250
298
|
t.boolean "ignored_safeties", default: false, null: false
|
251
299
|
t.integer "aborted_by_id"
|
300
|
+
t.integer "rollback_once_aborted_to_id"
|
301
|
+
t.integer "retry_attempt", default: 0, null: false
|
302
|
+
t.integer "max_retries"
|
252
303
|
t.index ["rolled_up", "created_at", "status"], name: "index_tasks_on_rolled_up_and_created_at_and_status"
|
253
304
|
t.index ["since_commit_id"], name: "index_tasks_on_since_commit_id"
|
254
305
|
t.index ["stack_id", "allow_concurrency", "status"], name: "index_active_tasks"
|
255
306
|
t.index ["stack_id", "allow_concurrency"], name: "index_tasks_on_stack_id_and_allow_concurrency"
|
256
307
|
t.index ["stack_id", "status", "type"], name: "index_tasks_by_stack_and_status"
|
308
|
+
t.index ["status"], name: "index_tasks_on_status"
|
257
309
|
t.index ["type", "stack_id", "parent_id"], name: "index_tasks_by_stack_and_parent"
|
258
310
|
t.index ["until_commit_id"], name: "index_tasks_on_until_commit_id"
|
259
311
|
t.index ["user_id"], name: "index_tasks_on_user_id"
|