Skip to content
155 changes: 60 additions & 95 deletions docs/schema/yaml/1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ environment:
# @param environment.defaultServices
defaultServices:
# @param environment.defaultServices[]
-
# @param environment.defaultServices.name (required)
- # @param environment.defaultServices.name (required)
name: ''
# @param environment.defaultServices.repository
repository: ''
Expand All @@ -27,8 +26,7 @@ environment:
# @param environment.optionalServices
optionalServices:
# @param environment.optionalServices[]
-
# @param environment.optionalServices.name (required)
- # @param environment.optionalServices.name (required)
name: ''
# @param environment.optionalServices.repository
repository: ''
Expand All @@ -39,8 +37,7 @@ environment:
# @param environment.webhooks
webhooks:
# @param environment.webhooks[]
-
# @param environment.webhooks.name
- # @param environment.webhooks.name
name: ''
# @param environment.webhooks.description
description: ''
Expand All @@ -50,11 +47,8 @@ environment:
type: ''
# @param environment.webhooks.pipelineId
pipelineId: ''
# @param environment.webhooks.trigger (required)
# @param environment.webhooks.trigger
trigger: ''
# @param environment.webhooks.env (required)
env:

# @param environment.webhooks.docker
docker:
# @param environment.webhooks.docker.image (required)
Expand All @@ -77,11 +71,13 @@ environment:
script: ''
# @param environment.webhooks.command.timeout
timeout: 0
# @param environment.webhooks.env (required)
env:

# @section services
services:
# @param services[]
-
# @param services.name (required)
- # @param services.name (required)
name: ''
# @param services.appShort
appShort: ''
Expand All @@ -90,9 +86,40 @@ services:
# @param services.requires
requires:
# @param services.requires[]
-
# @param services.requires.name (required)
- # @param services.requires.name (required)
name: ''
# @param services.deploymentDependsOn
deploymentDependsOn:
# @param services.deploymentDependsOn[]
- ''
# @param services.kedaScaleToZero
kedaScaleToZero:
# @param services.kedaScaleToZero.type
type: ''
# @param services.kedaScaleToZero.replicas
replicas:
# @param services.kedaScaleToZero.replicas.min
min: 0
# @param services.kedaScaleToZero.replicas.max
max: 0
# @param services.kedaScaleToZero.scaledownPeriod
scaledownPeriod: 0
# @param services.kedaScaleToZero.maxRetries
maxRetries: 0
# @param services.kedaScaleToZero.scalingMetric
scalingMetric:
# @param services.kedaScaleToZero.scalingMetric.requestRate
requestRate:
# @param services.kedaScaleToZero.scalingMetric.requestRate.granularity
granularity: ''
# @param services.kedaScaleToZero.scalingMetric.requestRate.targetValue
targetValue: 0
# @param services.kedaScaleToZero.scalingMetric.requestRate.window
window: ''
# @param services.kedaScaleToZero.scalingMetric.concurrency
concurrency:
# @param services.kedaScaleToZero.scalingMetric.concurrency.targetValue
targetValue: 0
# @param services.helm
helm:
# @param services.helm.cfStepType
Expand All @@ -105,9 +132,9 @@ services:
version: ''
# @param services.helm.action
action: ''
# @param services.helm.repository (required)
# @param services.helm.repository
repository: ''
# @param services.helm.branchName (required)
# @param services.helm.branchName
branchName: ''
# @param services.helm.chart
chart:
Expand All @@ -125,6 +152,8 @@ services:
valueFiles:
# @param services.helm.chart.valueFiles[]
- ''
# @param services.helm.envLens
envLens: false
# @param services.helm.grpc
grpc: false
# @param services.helm.disableIngressHost
Expand All @@ -137,6 +166,12 @@ services:
defaultTag: ''
# @param services.helm.docker.pipelineId
pipelineId: ''
# @param services.helm.docker.ecr
ecr: ''
# @param services.helm.docker.builder
builder:
# @param services.helm.docker.builder.engine
engine: ''
# @param services.helm.docker.app (required)
app:
# @param services.helm.docker.app.afterBuildPipelineConfig
Expand Down Expand Up @@ -171,14 +206,6 @@ services:
# @param services.helm.docker.init.env
env:

# @param services.helm.docker.ecr
ecr: ''
# @param services.helm.docker.builder
builder:
# @param services.helm.docker.builder.engine
engine: ''
# @param services.helm.envLens
envLens: false
# @param services.codefresh
codefresh:
# @param services.codefresh.repository (required)
Expand Down Expand Up @@ -272,12 +299,6 @@ services:
successThreshold: 0
# @param services.codefresh.deployment.readiness.failureThreshold
failureThreshold: 0
# @param services.codefresh.deployment.scaling
scaling:
# @param services.codefresh.deployment.scaling.scaleToZero
scaleToZero: false
# @param services.codefresh.deployment.scaling.scaleToZeroMetricsCheckInterval
scaleToZeroMetricsCheckInterval: 0
# @param services.codefresh.deployment.hostnames
hostnames:
# @param services.codefresh.deployment.hostnames.host
Expand All @@ -300,9 +321,6 @@ services:
# @param services.codefresh.deployment.network.hostPortMapping
hostPortMapping:

# @param services.codefresh.deployment.network.kuma
kuma:

# @param services.codefresh.deployment.network.grpc
grpc:
# @param services.codefresh.deployment.network.grpc.enable
Expand All @@ -314,8 +332,7 @@ services:
# @param services.codefresh.deployment.serviceDisks
serviceDisks:
# @param services.codefresh.deployment.serviceDisks[]
-
# @param services.codefresh.deployment.serviceDisks.name (required)
- # @param services.codefresh.deployment.serviceDisks.name (required)
name: ''
# @param services.codefresh.deployment.serviceDisks.mountPath (required)
mountPath: ''
Expand All @@ -337,6 +354,12 @@ services:
defaultTag: ''
# @param services.github.docker.pipelineId
pipelineId: ''
# @param services.github.docker.ecr
ecr: ''
# @param services.github.docker.builder
builder:
# @param services.github.docker.builder.engine
engine: ''
# @param services.github.docker.app (required)
app:
# @param services.github.docker.app.afterBuildPipelineConfig
Expand Down Expand Up @@ -371,12 +394,6 @@ services:
# @param services.github.docker.init.env
env:

# @param services.github.docker.ecr
ecr: ''
# @param services.github.docker.builder
builder:
# @param services.github.docker.builder.engine
engine: ''
# @param services.github.deployment
deployment:
# @param services.github.deployment.helm
Expand Down Expand Up @@ -449,12 +466,6 @@ services:
successThreshold: 0
# @param services.github.deployment.readiness.failureThreshold
failureThreshold: 0
# @param services.github.deployment.scaling
scaling:
# @param services.github.deployment.scaling.scaleToZero
scaleToZero: false
# @param services.github.deployment.scaling.scaleToZeroMetricsCheckInterval
scaleToZeroMetricsCheckInterval: 0
# @param services.github.deployment.hostnames
hostnames:
# @param services.github.deployment.hostnames.host
Expand All @@ -477,9 +488,6 @@ services:
# @param services.github.deployment.network.hostPortMapping
hostPortMapping:

# @param services.github.deployment.network.kuma
kuma:

# @param services.github.deployment.network.grpc
grpc:
# @param services.github.deployment.network.grpc.enable
Expand All @@ -491,8 +499,7 @@ services:
# @param services.github.deployment.serviceDisks
serviceDisks:
# @param services.github.deployment.serviceDisks[]
-
# @param services.github.deployment.serviceDisks.name (required)
- # @param services.github.deployment.serviceDisks.name (required)
name: ''
# @param services.github.deployment.serviceDisks.mountPath (required)
mountPath: ''
Expand Down Expand Up @@ -591,12 +598,6 @@ services:
successThreshold: 0
# @param services.docker.deployment.readiness.failureThreshold
failureThreshold: 0
# @param services.docker.deployment.scaling
scaling:
# @param services.docker.deployment.scaling.scaleToZero
scaleToZero: false
# @param services.docker.deployment.scaling.scaleToZeroMetricsCheckInterval
scaleToZeroMetricsCheckInterval: 0
# @param services.docker.deployment.hostnames
hostnames:
# @param services.docker.deployment.hostnames.host
Expand All @@ -619,9 +620,6 @@ services:
# @param services.docker.deployment.network.hostPortMapping
hostPortMapping:

# @param services.docker.deployment.network.kuma
kuma:

# @param services.docker.deployment.network.grpc
grpc:
# @param services.docker.deployment.network.grpc.enable
Expand All @@ -633,8 +631,7 @@ services:
# @param services.docker.deployment.serviceDisks
serviceDisks:
# @param services.docker.deployment.serviceDisks[]
-
# @param services.docker.deployment.serviceDisks.name (required)
- # @param services.docker.deployment.serviceDisks.name (required)
name: ''
# @param services.docker.deployment.serviceDisks.mountPath (required)
mountPath: ''
Expand Down Expand Up @@ -662,35 +659,3 @@ services:
defaultTag: ''
# @param services.configuration.branchName (required)
branchName: ''
# @param services.deploymentDependsOn
deploymentDependsOn:
# @param services.deploymentDependsOn[]
- ''
# @param services.kedaScaleToZero
kedaScaleToZero:
# @param services.kedaScaleToZero.type
type: ''
# @param services.kedaScaleToZero.replicas
replicas:
# @param services.kedaScaleToZero.replicas.min
min: 0
# @param services.kedaScaleToZero.replicas.max
max: 0
# @param services.kedaScaleToZero.scaledownPeriod
scaledownPeriod: 0
# @param services.kedaScaleToZero.maxRetries
maxRetries: 0
# @param services.kedaScaleToZero.scalingMetric
scalingMetric:
# @param services.kedaScaleToZero.scalingMetric.requestRate
requestRate:
# @param services.kedaScaleToZero.scalingMetric.requestRate.granularity
granularity: ''
# @param services.kedaScaleToZero.scalingMetric.requestRate.targetValue
targetValue: 0
# @param services.kedaScaleToZero.scalingMetric.requestRate.window
window: ''
# @param services.kedaScaleToZero.scalingMetric.concurrency
concurrency:
# @param services.kedaScaleToZero.scalingMetric.concurrency.targetValue
targetValue: 0
4 changes: 2 additions & 2 deletions src/server/db/migrations/001_seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ export async function up(knex: Knex): Promise<any> {
);
ALTER TABLE builds OWNER TO lifecycle;
INSERT INTO builds (
id, uuid, status, "statusMessage", "environmentId",
uuid, status, "statusMessage", "environmentId",
"createdAt", "updatedAt", sha, namespace
)
VALUES (
99999, 'dev-0', 'pending', 'Build is pending', 1,
'dev-0', 'pending', 'Build is pending', 1,
NOW(), NOW(), 'abc123', 'env-dev-0'
)
`);
Expand Down
19 changes: 13 additions & 6 deletions src/server/lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ export async function cliDeploy(deploy: Deploy) {

const { build, service, deployable } = deploy;
const serviceCommand: string = build.enableFullYaml ? deployable.command : service.command;
const settings = await getSettingsFor(serviceCommand);
return await shellPromise(`pnpm run babel-node -- ${serviceCommand} deploy ${contextForDeploy(deploy, settings)}`);
const { settings, region } = await getSettingsFor(serviceCommand);
return await shellPromise(
`AWS_REGION=${region} pnpm run babel-node -- ${serviceCommand} deploy ${contextForDeploy(deploy, settings)}`
);
}

/**
Expand Down Expand Up @@ -214,17 +216,22 @@ function contextForDeploy(deploy: Deploy, settings: string) {
async function deleteDeploy(deploy: Deploy) {
const serviceCmd = deploy.build.enableFullYaml ? deploy.deployable.command : deploy.service.command;

const settings = await getSettingsFor(serviceCmd);
return await shellPromise(`pnpm run babel-node -- ${serviceCmd} destroy ${contextForDeploy(deploy, settings)}`);
const { settings, region } = await getSettingsFor(serviceCmd);
return await shellPromise(
`AWS_REGION=${region} pnpm run babel-node -- ${serviceCmd} destroy ${contextForDeploy(deploy, settings)}`
);
}

async function getSettingsFor(serviceCommand: string): Promise<string> {
async function getSettingsFor(serviceCommand: string): Promise<{ settings: string; region: string }> {
const { auroraRestoreSettings, rdsRestoreSettings } = await GlobalConfigService.getInstance().getAllConfigs();
let settings: DatabaseSettings;
if (serviceCommand.includes('aurora-helper')) {
settings = auroraRestoreSettings;
} else if (serviceCommand.includes('rds-helper')) {
settings = rdsRestoreSettings;
}
return JSON.stringify(settings);
return {
settings: JSON.stringify(settings),
region: settings.region,
};
}
Loading