Class: Strata::CLI::SubCommands::Deploy
- Inherits:
-
Thor
- Object
- Thor
- Strata::CLI::SubCommands::Deploy
- Extended by:
- Helpers::DescriptionHelper
- Defined in:
- lib/strata/cli/sub_commands/deploy.rb
Constant Summary
Constants included from Output
Constants included from Guard
Instance Method Summary collapse
Methods included from Helpers::DescriptionHelper
Methods included from Output
format, pastel, print_error, #print_error, print_hint, #print_hint, print_info, #print_info, print_status, #print_status, print_success, #print_success, print_warning, #print_warning, shell_for, thor_color
Methods included from Terminal
#create_spinner, #print_table, #with_spinner
Methods included from Guard
Instance Method Details
#deploy ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/strata/cli/sub_commands/deploy.rb', line 37 def deploy config = load_deployment_configuration validate_deployment_configuration(config) run_pre_deploy_checks unless [:skip_audit] refreshed_imports = refresh_external_imports # Auto-refresh external imports before checking for changes branch_id = determine_deployment_branch run_git_status_checks(branch_id) confirm_production_deploy(branch_id, config) unless [:yes] # Get last successful deployment to determine what files changed last_deployment_commit = get_last_successful_deployment_commit(config, branch_id) # Check local file changes local_file_changes = if last_deployment_commit && Utils::Git.git_repo? Utils::Git.changed_file_paths_since(last_deployment_commit) else [] end = (last_deployment_commit) # If only external imports changed, generate synthetic commit identifier if refreshed_imports.any? && local_file_changes.empty? import_commit_hash = Utils::ImportManager.generate_import_commit_hash(project_path) print_info("\nExternal imports change found. Proceeding with deployment") [:commit] = "imports-#{import_commit_hash}" [:commit_message] = "External imports updated: #{refreshed_imports.map do |c| File.basename(c[:source]) end.join(", ")}" end archive_path = create_and_upload_archive(last_deployment_commit, refreshed_imports: refreshed_imports) env_display = [:environment] ? " (#{[:environment]} environment)" : "" server_info = config["server"] ? " (#{config["server"]})" : "" print_info("\nDeploying to branch '#{branch_id}' on Strata server#{env_display}#{server_info}\n") deployment = submit_deployment(config, branch_id, archive_path, ) # Start monitoring deployment progress monitor_deployment(config, branch_id, deployment) end |
#status ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/strata/cli/sub_commands/deploy.rb', line 82 def status config = load_deployment_configuration validate_deployment_configuration(config) branch_id = determine_deployment_branch client = API::Client.new(config["server"], config["api_key"]) deployment = client.latest_deployment(config["project_id"], branch_id) unless deployment print_info("No deployments found for branch '#{branch_id}'.\n") return end deployment_id = deployment["id"] has_tests = test_files_exist? monitor = Utils::DeploymentMonitor.new(client, config["project_id"], branch_id, deployment_id, has_tests: has_tests) # Show current status result = monitor.display_status # Continue monitoring if deployment is in progress, or if tests are expected but not yet available should_continue_monitoring = if result && !%w[succeeded failed].include?(result["status"]) true elsif result && result["status"] == "succeeded" && result["stage"] == "finished" # Check if tests are expected but not yet available latest_test_run = result["latest_test_run"] || result[:latest_test_run] has_tests && latest_test_run.nil? else false end monitor.start(skip_initial_display: true) if should_continue_monitoring end |