Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -444,8 +444,8 @@ export async function up(knex: Knex): Promise<any> {
INSERT INTO global_config (key, config, "createdAt", "updatedAt", "deletedAt", description) VALUES ('redis', '{"version":"3.7.2","args":"--force --timeout 60m0s --wait","action":"install","chart":{"name":"redis","repoUrl":"https://charts.bitnami.com/bitnami","version":"20.3.0","values":["replica.replicaCount=0","replica.persistence.enabled=false","auth.enabled=false","master.resourcesPreset=none","master.readinessProbe.timeoutSeconds=20","master.readinessProbe.periodSeconds=15","master.livenessProbe.timeoutSeconds=20","master.livenessProbe.periodSeconds=15"],"valueFiles":[]},"label":"master.persistence.labels","tolerations":"master.tolerations","affinity":"master.affinity","nodeSelector":"master.nodeSelector"}', now(), now(), null, 'Redis bitnami helm chart configuration default values.');
INSERT INTO global_config (key, config, "createdAt", "updatedAt", "deletedAt", description) VALUES ('elasticsearch', '{"version":"3.7.2","args":"--force --timeout 15m0s --wait","action":"install","chart":{"name":"elasticsearch","repoUrl":"https://charts.bitnami.com/bitnami","version":"19.10.9","values":["master.replicaCount=1","ingress.enabled=true","data.replicaCount=0","coordinating.replicaCount=0","ingest.enabled=false","master.readinessProbe.timeoutSeconds=20","master.livenessProbe.timeoutSeconds=20","master.startupProbe.timeoutSeconds=20"],"valueFiles":[]},"tolerations":"master.tolerations","affinity":"master.affinity","nodeSelector":"nodeSelector"}', now(), now(), null, 'Elasticsearch bitnami helm chart configuration default values.');
INSERT INTO global_config (key, config, "createdAt", "updatedAt", "deletedAt", description) VALUES ('publicChart', '{"block":false}', now(), now(), null, 'Potential Danger: If set to true lifecycle.yaml will allow any public helm chart to be deployed. Otherwise only charts defined in global_config will be allowed.');
INSERT INTO global_config (key, config, "createdAt", "updatedAt", "deletedAt", description) VALUES ('lifecycleDefaults', '{"defaultUUID":"dev-0","defaultPublicUrl":"dev-0.app.0env.com","cfStepType":"helm:1.1.12","ecrDomain":"${
IS_DEV ? '10.96.188.230:5000' : 'distribution.0env.com'
INSERT INTO global_config (key, config, "createdAt", "updatedAt", "deletedAt", description) VALUES ('lifecycleDefaults', '{"defaultUUID":"dev-0","defaultPublicUrl":"dev-0.app.example.com","cfStepType":"helm:1.1.12","ecrDomain":"${
IS_DEV ? '10.96.188.230:5000' : process.env.DISTRIBUTION_HOST || 'distribution.example.com'
}","ecrRegistry":"default","buildPipeline":"","deployCluster":"lifecycle-gke","helmDeployPipeline":"replace_me"}', now(), now(), null, 'Default values for lifecycle');
INSERT INTO global_config (key, config, "createdAt", "updatedAt", "deletedAt", description) VALUES ('helmDefaults', '{"version":"3.12.0","nativeHelm":{"enabled":true,"defaultArgs":"--wait --reset-values --timeout 30m","defaultHelmVersion":"3.12.0"}}', now(), now(), null, 'Default configuration for helm deployments.');
INSERT INTO global_config (key, config, "createdAt", "updatedAt", "deletedAt", description) VALUES ('socat-tunneller', '{"version":"3.7.2","args":"--force --timeout 60m0s --wait","action":"install","chart":{"name":"isotoma/socat-tunneller","repoUrl":" https://isotoma.github.io/charts","version":"0.2.0","values":[],"valueFiles":[]},"label":"podAnnotations","tolerations":"tolerations","affinity":"affinity","nodeSelector":"nodeSelector"}', now(), now(), null, 'soca-tunneller configuration for db-tunnels with helm');
Expand Down
2 changes: 1 addition & 1 deletion src/server/db/migrations/003_add_build_defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Knex } from 'knex';

export async function up(knex: Knex): Promise<any> {
const IS_DEV = process.env.APP_ENV === 'dev';
const cacheRegistry = IS_DEV ? '10.96.188.230:5000' : 'distribution.0env.com';
const cacheRegistry = IS_DEV ? '10.96.188.230:5000' : process.env.DISTRIBUTION_HOST || 'distribution.example.com';

const existingConfig = await knex('global_config').where('key', 'buildDefaults').first();

Expand Down
14 changes: 9 additions & 5 deletions src/server/lib/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('constructEcrRepoPath', () => {
});

test('appends service name for internal registries', () => {
const result = constructEcrRepoPath('my-repo/my-service/lfc', 'service-name', 'distribution.0env.com');
const result = constructEcrRepoPath('my-repo/my-service/lfc', 'service-name', 'distribution.example.com');
expect(result).toBe('my-repo/my-service/lfc/service-name');
});

Expand All @@ -155,12 +155,16 @@ describe('constructEcrRepoPath', () => {
});

test('does not append service name if already present at the end', () => {
const result = constructEcrRepoPath('my-repo/my-service/lfc/service-name', 'service-name', 'distribution.0env.com');
const result = constructEcrRepoPath(
'my-repo/my-service/lfc/service-name',
'service-name',
'distribution.example.com'
);
expect(result).toBe('my-repo/my-service/lfc/service-name');
});

test('appends service name even if it exists elsewhere in the path', () => {
const result = constructEcrRepoPath('service-name/repo', 'service-name', 'distribution.0env.com');
const result = constructEcrRepoPath('service-name/repo', 'service-name', 'distribution.example.com');
expect(result).toBe('service-name/repo/service-name');
});

Expand All @@ -180,12 +184,12 @@ describe('constructEcrRepoPath', () => {
});

test('handles service name with special characters', () => {
const result = constructEcrRepoPath('my-repo', 'my-service-v2.1', 'distribution.0env.com');
const result = constructEcrRepoPath('my-repo', 'my-service-v2.1', 'distribution.example.com');
expect(result).toBe('my-repo/my-service-v2.1');
});

test('handles base repo with trailing slash', () => {
const result = constructEcrRepoPath('my-repo/', 'my-service', 'distribution.0env.com');
const result = constructEcrRepoPath('my-repo/', 'my-service', 'distribution.example.com');
expect(result).toBe('my-repo//my-service');
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/server/lib/nativeBuild/engines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export async function buildWithEngine(
const jobTimeout = options.jobTimeout || buildDefaults.jobTimeout || 2100;
const resources = options.resources || buildDefaults.resources?.[engineName] || DEFAULT_BUILD_RESOURCES[engineName];

let cacheRegistry = options.cacheRegistry || buildDefaults.cacheRegistry || 'distribution.0env.com';
let cacheRegistry = options.cacheRegistry || buildDefaults.cacheRegistry;
if (engineName === 'buildkit' && buildDefaults.buildkit?.endpoint) {
cacheRegistry = options.ecrDomain;
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ export default class DeployService extends BaseService {
namespace: deploy.build.namespace,
buildId: String(deploy.build.id),
deployUuid: deploy.uuid, // Use the full deploy UUID which includes service name
cacheRegistry: buildDefaults?.cacheRegistry || 'distribution.0env.com',
cacheRegistry: buildDefaults?.cacheRegistry,
};

if (!initDockerfilePath) {
Expand Down