fix(healthcheck/reposize): unit
This commit is contained in:
		
							parent
							
								
									8fb707e07d
								
							
						
					
					
						commit
						57c50c4f68
					
				| 
						 | 
					@ -44,7 +44,7 @@ func main() {
 | 
				
			||||||
	checkRelease := flag.Bool("checkRelease", true, "trigger release check")
 | 
						checkRelease := flag.Bool("checkRelease", true, "trigger release check")
 | 
				
			||||||
	rootDir := flag.String("root", "", "")
 | 
						rootDir := flag.String("root", "", "")
 | 
				
			||||||
	repo := flag.String("repo", "", "")
 | 
						repo := flag.String("repo", "", "")
 | 
				
			||||||
	size := flag.Int("reposize", 2, "size of the repo")
 | 
						size := flag.Float64("reposize", 2, "size of the repo")
 | 
				
			||||||
	localList := flag.String("localList", "", "")
 | 
						localList := flag.String("localList", "", "")
 | 
				
			||||||
	droneBranch := flag.String("droneBranch", "", "")
 | 
						droneBranch := flag.String("droneBranch", "", "")
 | 
				
			||||||
	checkFileNameList := flag.String("checkFileNameList", "", "Comma-separated list of files to check.")
 | 
						checkFileNameList := flag.String("checkFileNameList", "", "Comma-separated list of files to check.")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// RepoSize checks the size of the repository to determine if it is oversized.
 | 
					// RepoSize checks the size of the repository to determine if it is oversized.
 | 
				
			||||||
// It executes the 'git count-objects -v' command to obtain the size information,
 | 
					// It executes the 'git count-objects -v' command to obtain the size information,
 | 
				
			||||||
func RepoSize(conf_size int) error {
 | 
					func RepoSize(conf_size float64) error {
 | 
				
			||||||
	// TODO: reimplement here when go-git is available
 | 
						// TODO: reimplement here when go-git is available
 | 
				
			||||||
	// https://github.com/go-git/go-git/blob/master/COMPATIBILITY.md
 | 
						// https://github.com/go-git/go-git/blob/master/COMPATIBILITY.md
 | 
				
			||||||
	cmd := exec.Command("git", "count-objects", "-v")
 | 
						cmd := exec.Command("git", "count-objects", "-v")
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ func RepoSize(conf_size int) error {
 | 
				
			||||||
			sum += size
 | 
								sum += size
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if sum > conf_size {
 | 
						if sum > int(conf_size*1024*1024) {
 | 
				
			||||||
		return fmt.Errorf("Repository larger than %d M. Please clean up or contact the teaching team.", conf_size)
 | 
							return fmt.Errorf("Repository larger than %d M. Please clean up or contact the teaching team.", conf_size)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user