feat: add coolify.environment label
This commit is contained in:
@@ -1683,7 +1683,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
return escapeDollarSign($value);
|
return escapeDollarSign($value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$labels = $labels->merge(defaultLabels($this->application->id, $this->application->uuid, $this->application->project()->name, $this->application->name, $this->pull_request_id))->toArray();
|
$labels = $labels->merge(defaultLabels($this->application->id, $this->application->uuid, $this->application->project()->name, $this->application->name, $this->application->environment->name, $this->pull_request_id))->toArray();
|
||||||
|
|
||||||
// Check for custom HEALTHCHECK
|
// Check for custom HEALTHCHECK
|
||||||
if ($this->application->build_pack === 'dockerfile' || $this->application->dockerfile) {
|
if ($this->application->build_pack === 'dockerfile' || $this->application->dockerfile) {
|
||||||
|
@@ -196,11 +196,12 @@ function defaultDatabaseLabels($database) {
|
|||||||
$labels->push('coolify.resourceName='.Str::slug($database->name));
|
$labels->push('coolify.resourceName='.Str::slug($database->name));
|
||||||
$labels->push('coolify.serviceName='.Str::slug($database->name));
|
$labels->push('coolify.serviceName='.Str::slug($database->name));
|
||||||
$labels->push('coolify.projectName='.Str::slug($database->project()->name));
|
$labels->push('coolify.projectName='.Str::slug($database->project()->name));
|
||||||
|
$labels->push('coolify.environment='.Str::slug($database->environment->name));
|
||||||
|
|
||||||
return $labels;
|
return $labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
function defaultLabels($id, $name, string $projectName, string $resourceName, $pull_request_id = 0, string $type = 'application', $subType = null, $subId = null, $subName = null)
|
function defaultLabels($id, $name, string $projectName, string $resourceName, string $environment, $pull_request_id = 0, string $type = 'application', $subType = null, $subId = null, $subName = null)
|
||||||
{
|
{
|
||||||
$labels = collect([]);
|
$labels = collect([]);
|
||||||
$labels->push('coolify.managed=true');
|
$labels->push('coolify.managed=true');
|
||||||
@@ -211,6 +212,8 @@ function defaultLabels($id, $name, string $projectName, string $resourceName, $p
|
|||||||
$labels->push('coolify.resourceName='.Str::slug($resourceName));
|
$labels->push('coolify.resourceName='.Str::slug($resourceName));
|
||||||
$labels->push('coolify.projectName='.Str::slug($projectName));
|
$labels->push('coolify.projectName='.Str::slug($projectName));
|
||||||
$labels->push('coolify.serviceName='.Str::slug($subName ?? $resourceName));
|
$labels->push('coolify.serviceName='.Str::slug($subName ?? $resourceName));
|
||||||
|
$labels->push('coolify.environment='.Str::slug($environment));
|
||||||
|
|
||||||
$labels->push('coolify.pullRequestId='.$pull_request_id);
|
$labels->push('coolify.pullRequestId='.$pull_request_id);
|
||||||
if ($type === 'service') {
|
if ($type === 'service') {
|
||||||
$subId && $labels->push('coolify.service.subId='.$subId);
|
$subId && $labels->push('coolify.service.subId='.$subId);
|
||||||
|
@@ -2068,6 +2068,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
subType: $isDatabase ? 'database' : 'application',
|
subType: $isDatabase ? 'database' : 'application',
|
||||||
subId: $savedService->id,
|
subId: $savedService->id,
|
||||||
subName: $savedService->name,
|
subName: $savedService->name,
|
||||||
|
environment: $resource->environment->name,
|
||||||
);
|
);
|
||||||
$serviceLabels = $serviceLabels->merge($defaultLabels);
|
$serviceLabels = $serviceLabels->merge($defaultLabels);
|
||||||
if (! $isDatabase && $fqdns->count() > 0) {
|
if (! $isDatabase && $fqdns->count() > 0) {
|
||||||
@@ -2902,6 +2903,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
name: $containerName,
|
name: $containerName,
|
||||||
projectName: $resource->project()->name,
|
projectName: $resource->project()->name,
|
||||||
resourceName: $resource->name,
|
resourceName: $resource->name,
|
||||||
|
environment: $resource->environment->name,
|
||||||
pull_request_id: $pull_request_id,
|
pull_request_id: $pull_request_id,
|
||||||
type: 'application'
|
type: 'application'
|
||||||
);
|
);
|
||||||
@@ -3687,13 +3689,15 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$defaultLabels = defaultLabels(
|
$defaultLabels = defaultLabels(
|
||||||
id: $resource->id,
|
id: $resource->id,
|
||||||
name: $containerName,
|
name: $containerName,
|
||||||
projectName: $resource->project()->name,
|
projectName: $resource->project()->name,
|
||||||
resourceName: $resource->name,
|
resourceName: $resource->name,
|
||||||
pull_request_id: $pullRequestId,
|
pull_request_id: $pullRequestId,
|
||||||
type: 'application'
|
type: 'application',
|
||||||
|
environment: $resource->environment->name,
|
||||||
);
|
);
|
||||||
} elseif ($isService) {
|
} elseif ($isService) {
|
||||||
if ($savedService->serviceType()) {
|
if ($savedService->serviceType()) {
|
||||||
@@ -3711,6 +3715,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
subType: $isDatabase ? 'database' : 'application',
|
subType: $isDatabase ? 'database' : 'application',
|
||||||
subId: $savedService->id,
|
subId: $savedService->id,
|
||||||
subName: $savedService->human_name ?? $savedService->name,
|
subName: $savedService->human_name ?? $savedService->name,
|
||||||
|
environment: $resource->environment->name,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Add COOLIFY_FQDN & COOLIFY_URL to environment
|
// Add COOLIFY_FQDN & COOLIFY_URL to environment
|
||||||
|
Reference in New Issue
Block a user