add custom git commit deployment
This commit is contained in:
@@ -21,7 +21,7 @@ class ApplicationController extends Controller
|
||||
if (!$application) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
return view('project.application.configuration', ['application' => $application]);
|
||||
return view('project.application.configuration', ['application' => $application,]);
|
||||
}
|
||||
public function deployments()
|
||||
{
|
||||
|
||||
@@ -19,4 +19,13 @@ class Source extends Component
|
||||
{
|
||||
$this->application = Application::where('id', $this->applicationId)->first();
|
||||
}
|
||||
public function submit()
|
||||
{
|
||||
$this->validate();
|
||||
if (!$this->application->git_commit_sha) {
|
||||
$this->application->git_commit_sha = 'HEAD';
|
||||
}
|
||||
$this->application->save();
|
||||
$this->emit('saved', 'Application source updated!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,8 +430,8 @@ COPY --from={$this->application->uuid}:{$this->git_commit}-build /app/{$this->ap
|
||||
}
|
||||
private function setGitImportSettings($git_clone_command)
|
||||
{
|
||||
if ($this->application->git_commit_sha) {
|
||||
$git_clone_command = "{$git_clone_command} && cd {$this->workdir} && git checkout {$this->application->git_commit_sha}";
|
||||
if ($this->application->git_commit_sha !== 'HEAD') {
|
||||
$git_clone_command = "{$git_clone_command} && cd {$this->workdir} && git -c advice.detachedHead=false checkout {$this->application->git_commit_sha} >/dev/null 2>&1";
|
||||
}
|
||||
if ($this->application->settings->is_git_submodules_allowed) {
|
||||
$git_clone_command = "{$git_clone_command} && cd {$this->workdir} && git submodule update --init --recursive";
|
||||
|
||||
@@ -44,16 +44,23 @@ class Application extends BaseModel
|
||||
set: fn ($value) => $value ? '/' . ltrim($value, '/') : null,
|
||||
);
|
||||
}
|
||||
public function gitLocation(): Attribute
|
||||
public function gitBranchLocation(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function () {
|
||||
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
|
||||
if (is_null($this->git_commit_sha)) {
|
||||
return "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_branch}";
|
||||
} else {
|
||||
return "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_commit_sha}";
|
||||
}
|
||||
return "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_branch}";
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
public function gitCommits(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: function () {
|
||||
if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
|
||||
return "{$this->source->html_url}/{$this->git_repository}/commits/{$this->git_branch}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user