Skip to content

Commit

Permalink
added validations
Browse files Browse the repository at this point in the history
Signed-off-by: munishchouhan <[email protected]>
  • Loading branch information
munishchouhan committed Sep 27, 2024
1 parent f7622aa commit 03b704d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ class BuildConfig {
@Value('${wave.build.retry-attempts:0}')
int retryAttempts

@Value('${wave.build.max_conda_file_size:100000}')
int maxCondaFileSize

@Value('${wave.build.max_container_file_size:100000}')
int maxContainerFileSize

@PostConstruct
private void init() {
log.info("Builder config: " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,12 @@ class ContainerController {

void validateContainerRequest(SubmitContainerTokenRequest req) throws BadRequestException {
String msg
//check conda file size
if( req.condaFile && req.condaFile.length() > buildConfig.maxCondaFileSize )
throw new BadRequestException("Conda file size exceeds the maximum allowed size of ${buildConfig.maxCondaFileSize} bytes")
// check container file size
if( req.containerFile && req.containerFile.length() > buildConfig.maxContainerFileSize )
throw new BadRequestException("Container file size exceeds the maximum allowed size of ${buildConfig.maxContainerFileSize} bytes")
// check valid image name
msg = validationService.checkContainerName(req.containerImage)
if( msg ) throw new BadRequestException(msg)
Expand All @@ -531,6 +537,7 @@ class ContainerController {
// check cache repository
msg = validationService.checkBuildRepository(req.cacheRepository, true)
if( msg ) throw new BadRequestException(msg)

}

void validateMirrorRequest(SubmitContainerTokenRequest req, boolean v2) throws BadRequestException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class WaveContainerRecord {

/**
* wave request id, this will be the token
* This is container token and it is named as id for surrealdb requirement
*/
final String id

Expand Down

0 comments on commit 03b704d

Please sign in to comment.