Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jobs): cron and lifecycle job creation (#393)
- Loading branch information
Showing
116 changed files
with
3,869 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from './lib/slices/custom-domain.slice' | ||
export * from './lib/mocks/factories/application-factory.mock' | ||
export * from './lib/mocks/factories/job-factory.mock' | ||
export * from './lib/mocks/factories/application-deployment-factory.mock' | ||
export * from './lib/slices/applications.slice' | ||
export * from './lib/slices/application.actions' |
145 changes: 145 additions & 0 deletions
145
libs/domains/application/src/lib/mocks/factories/job-factory.mock.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
import { Chance } from 'chance' | ||
import { GitProviderEnum, StorageTypeEnum } from 'qovery-typescript-axios' | ||
import { JobApplicationEntity } from '@qovery/shared/interfaces' | ||
|
||
const chance = new Chance() | ||
|
||
export const cronjobFactoryMock = (howMany: number, withContainer: boolean = false): JobApplicationEntity[] => | ||
Array.from({ length: howMany }).map((_, index) => { | ||
let source | ||
if (!withContainer) { | ||
source = { | ||
docker: { | ||
git_repository: { | ||
has_access: true, | ||
deployed_commit_id: '8a21ddb195d821781d46eb1d8f26d5ae13609dd1', | ||
deployed_commit_date: '2022-12-19T11:57:07.425715Z', | ||
deployed_commit_contributor: 'TAGS_NOT_IMPLEMENTED', | ||
deployed_commit_tag: 'TAGS_NOT_IMPLEMENTED', | ||
provider: GitProviderEnum.GITHUB, | ||
owner: 'bdebon', | ||
url: 'https://github.com/Qovery/admin-ui.git', | ||
name: 'Qovery/admin-ui', | ||
branch: 'develop', | ||
root_path: '/', | ||
}, | ||
dockerfile_path: 'Dockerfile', | ||
}, | ||
} | ||
} else { | ||
source = { | ||
image: { | ||
name: 'nginx', | ||
image_name: 'nginx/nginx', | ||
registry_id: chance.guid(), | ||
}, | ||
} | ||
} | ||
|
||
return { | ||
id: `${index}`, | ||
created_at: new Date().toString(), | ||
updated_at: new Date().toString(), | ||
storage: [ | ||
{ | ||
id: chance.guid(), | ||
type: chance.pickone(Object.values([StorageTypeEnum.FAST_SSD])), | ||
size: 10, | ||
mount_point: '', | ||
}, | ||
], | ||
environment: { | ||
id: chance.guid(), | ||
}, | ||
maximum_cpu: 10, | ||
maximum_memory: 10, | ||
name: chance.name(), | ||
description: chance.word({ length: 10 }), | ||
max_duration_seconds: 10, | ||
max_nb_restart: 10, | ||
port: 80, | ||
cpu: 1000, | ||
memory: 1024, | ||
auto_preview: false, | ||
source, | ||
schedule: { | ||
cronjob: { | ||
scheduled_at: '0 0 * * *', | ||
entrypoint: '/', | ||
arguments: [], | ||
}, | ||
}, | ||
registry: { | ||
id: chance.guid(), | ||
}, | ||
} | ||
}) | ||
|
||
export const lifecycleJobFactoryMock = (howMany: number, withContainer: boolean = false): JobApplicationEntity[] => | ||
Array.from({ length: howMany }).map((_, index) => { | ||
let source | ||
if (!withContainer) { | ||
source = { | ||
docker: { | ||
git_repository: { | ||
has_access: true, | ||
deployed_commit_id: '8a21ddb195d821781d46eb1d8f26d5ae13609dd1', | ||
deployed_commit_date: '2022-12-19T11:57:07.425715Z', | ||
deployed_commit_contributor: 'TAGS_NOT_IMPLEMENTED', | ||
deployed_commit_tag: 'TAGS_NOT_IMPLEMENTED', | ||
provider: GitProviderEnum.GITHUB, | ||
owner: 'bdebon', | ||
url: 'https://github.com/Qovery/admin-ui.git', | ||
name: 'Qovery/admin-ui', | ||
branch: 'develop', | ||
root_path: '/', | ||
}, | ||
dockerfile_path: 'Dockerfile', | ||
}, | ||
} | ||
} else { | ||
source = { | ||
image: { | ||
name: 'nginx', | ||
image_name: 'nginx/nginx', | ||
registry_id: chance.guid(), | ||
}, | ||
} | ||
} | ||
|
||
return { | ||
id: `${index}`, | ||
created_at: new Date().toString(), | ||
updated_at: new Date().toString(), | ||
storage: [ | ||
{ | ||
id: chance.guid(), | ||
type: chance.pickone(Object.values([StorageTypeEnum.FAST_SSD])), | ||
size: 10, | ||
mount_point: '', | ||
}, | ||
], | ||
environment: { | ||
id: chance.guid(), | ||
}, | ||
maximum_cpu: 10, | ||
maximum_memory: 10, | ||
name: chance.name(), | ||
description: chance.word({ length: 10 }), | ||
max_duration_seconds: 10, | ||
max_nb_restart: 10, | ||
port: 80, | ||
cpu: 1000, | ||
memory: 1024, | ||
auto_preview: false, | ||
source, | ||
schedule: { | ||
on_start: { | ||
arguments: [], | ||
}, | ||
}, | ||
registry: { | ||
id: chance.guid(), | ||
}, | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...pplication/src/lib/feature/import-environment-variable-modal-feature/utils/form-check.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.