Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
siewer committed Oct 10, 2024
1 parent 03b165b commit 38a1415
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.

## [1.0.1] - 2024-09-25

### Changed
- TEAM_MANAGER role can run manual scan via GUI and via API
- Enlarged parallel scan pool from 5 to 15
- Provided `pipreqs` to enchance python support for SCA
- It is visible when scan is currently running


### Fixed
- Performance issues that occurs while having 300+ imported repositories on dashboard and component view

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public ResponseEntity<CodeRepo> getCodeRepo(@PathVariable(name = "id")Long id, P
}
}

@PreAuthorize("hasAuthority('ADMIN')")
@PreAuthorize("hasAuthority('TEAM_MANAGER')")
@GetMapping(value= "/api/v1/coderepo/{id}/run")
public ResponseEntity<StatusDTO> runScan(@PathVariable("id") Long id, Principal principal){
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public CodeRepo getRepo(Long id, Principal principal) {
return findCodeRepoService.findById(id, principal);
}

public void runScan(Long id, Principal principal) throws ScanException, IOException, InterruptedException {
public void runScan(Long id, Principal principal) {
CodeRepo repo = findCodeRepoService.findById(id, principal);
if (repo != null){
scanManagerService.scanRepository(repo, repo.getDefaultBranch(),null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ScanScheduler {
private final CodeRepoRepository codeRepoRepository;
private final ScanManagerService scanManagerService;
private final SCAService scaService;
private static final int THREAD_POOL_SIZE = 5; // Adjust the pool size as needed
private static final int THREAD_POOL_SIZE = 15; // Adjust the pool size as needed
private final GetCodeRepoInfoService getCodeRepoInfoService;

/**
Expand All @@ -54,7 +54,7 @@ public void runAfterStartup() {
* Scheduled task that runs every day at 3 AM.
* This method scans all code repositories concurrently using a fixed thread pool.
*/
@Scheduled(cron = "0 0 3 * * ?")
@Scheduled(cron = "0 0 1 * * ?")
public void runEveryDayAt3AM() {
Iterable<CodeRepo> codeRepos = codeRepoRepository.findAll();
ExecutorService executorService = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public class ScanManagerService {
private final SCAService scaService;
private final GitCommentService gitCommentService;

private final int maxConcurrentScans = 5; // Maximum number of concurrent scans
private final int maxConcurrentScans = 15; // Maximum number of concurrent scans
private final Semaphore semaphore = new Semaphore(maxConcurrentScans); // Limit concurrent scans
private final ConcurrentHashMap<Long, Lock> repoLocks = new ConcurrentHashMap<>(); // Ensure no parallel scans for the same repo

private final ExecutorService executorService = Executors.newFixedThreadPool(8);
private final ExecutorService scanExecutorService = Executors.newFixedThreadPool(10);
private final ExecutorService scanExecutorService = Executors.newFixedThreadPool(15);
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);

// Counters for tracking parallel scans
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/views/show-repo/show-repo.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h2 style="margin-bottom: 1rem;"><strong>{{repoData?.name}}</strong> &nbsp;
<!-- Date of Creation -->
<small style="margin-top: 1rem;">Default branch: {{repoData?.defaultBranch.name}}</small>
<small style="margin-top: 1rem;">Created: {{repoData?.insertedDate | date }}</small>
<button *ngIf="!scanRunning && userRole==='ADMIN'" cButton color="info" shape="rounded-pill" style="margin-top:10px;" (click)="runScan()">Run Scan</button>
<button *ngIf="!scanRunning && (userRole==='ADMIN' || userRole==='TEAM_MANAGER')" cButton color="info" shape="rounded-pill" style="margin-top:10px;" (click)="runScan()">Run Scan</button>

<br/>
</div>
Expand Down

0 comments on commit 38a1415

Please sign in to comment.