Refactor deployment logic in ApplicationDeploymentJob.php
This commit is contained in:
parent
3323533fd0
commit
8b668cf8b7
1 changed files with 4 additions and 5 deletions
|
|
@ -336,7 +336,6 @@ private function deploy_simple_dockerfile()
|
||||||
// if (!$this->force_rebuild) {
|
// if (!$this->force_rebuild) {
|
||||||
// $this->check_image_locally_or_remotely();
|
// $this->check_image_locally_or_remotely();
|
||||||
// if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
|
// if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
|
||||||
// $this->create_workdir();
|
|
||||||
// $this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
|
// $this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
|
||||||
// $this->generate_compose_file();
|
// $this->generate_compose_file();
|
||||||
// $this->push_to_docker_registry();
|
// $this->push_to_docker_registry();
|
||||||
|
|
@ -477,7 +476,6 @@ private function deploy_dockerfile_buildpack()
|
||||||
if (!$this->force_rebuild) {
|
if (!$this->force_rebuild) {
|
||||||
$this->check_image_locally_or_remotely();
|
$this->check_image_locally_or_remotely();
|
||||||
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
|
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
|
||||||
$this->create_workdir();
|
|
||||||
$this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
|
$this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
|
||||||
$this->generate_compose_file();
|
$this->generate_compose_file();
|
||||||
$this->push_to_docker_registry();
|
$this->push_to_docker_registry();
|
||||||
|
|
@ -506,7 +504,6 @@ private function deploy_nixpacks_buildpack()
|
||||||
if (!$this->force_rebuild) {
|
if (!$this->force_rebuild) {
|
||||||
$this->check_image_locally_or_remotely();
|
$this->check_image_locally_or_remotely();
|
||||||
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
|
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
|
||||||
$this->create_workdir();
|
|
||||||
$this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
|
$this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
|
||||||
$this->generate_compose_file();
|
$this->generate_compose_file();
|
||||||
ray('pushing to docker registry');
|
ray('pushing to docker registry');
|
||||||
|
|
@ -540,7 +537,6 @@ private function deploy_static_buildpack()
|
||||||
if (!$this->force_rebuild) {
|
if (!$this->force_rebuild) {
|
||||||
$this->check_image_locally_or_remotely();
|
$this->check_image_locally_or_remotely();
|
||||||
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
|
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
|
||||||
$this->create_workdir();
|
|
||||||
$this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
|
$this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
|
||||||
$this->generate_compose_file();
|
$this->generate_compose_file();
|
||||||
$this->push_to_docker_registry();
|
$this->push_to_docker_registry();
|
||||||
|
|
@ -691,7 +687,6 @@ private function just_restart()
|
||||||
$this->check_image_locally_or_remotely();
|
$this->check_image_locally_or_remotely();
|
||||||
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty()) {
|
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty()) {
|
||||||
$this->application_deployment_queue->addLogEntry("Image found ({$this->production_image_name}) with the same Git Commit SHA. Restarting container.");
|
$this->application_deployment_queue->addLogEntry("Image found ({$this->production_image_name}) with the same Git Commit SHA. Restarting container.");
|
||||||
$this->create_workdir();
|
|
||||||
$this->generate_compose_file();
|
$this->generate_compose_file();
|
||||||
$this->rolling_update();
|
$this->rolling_update();
|
||||||
return;
|
return;
|
||||||
|
|
@ -876,6 +871,9 @@ private function create_workdir()
|
||||||
[
|
[
|
||||||
"command" => executeInDocker($this->deployment_uuid, "mkdir -p {$this->workdir}")
|
"command" => executeInDocker($this->deployment_uuid, "mkdir -p {$this->workdir}")
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"command" => "mkdir -p {$this->configuration_dir}"
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
private function prepare_builder_image()
|
private function prepare_builder_image()
|
||||||
|
|
@ -1001,6 +999,7 @@ private function clone_repository()
|
||||||
$importCommands, "hidden" => true
|
$importCommands, "hidden" => true
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
$this->create_workdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generate_git_import_commands()
|
private function generate_git_import_commands()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue