5 changed files with 78 additions and 55 deletions
@ -1,34 +0,0 @@ |
|||||||
package com.redhat.pctsec.model; |
|
||||||
|
|
||||||
import jakarta.enterprise.context.ApplicationScoped; |
|
||||||
|
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.HashSet; |
|
||||||
import java.util.Set; |
|
||||||
@ApplicationScoped |
|
||||||
public class ScanCollection { |
|
||||||
|
|
||||||
//
|
|
||||||
private Set<Scan> scans = new HashSet<>(); |
|
||||||
private HashMap<String, String> globalScanProperties; |
|
||||||
|
|
||||||
public ScanCollection(pssaas pssaas){ |
|
||||||
//Iterate scan payload and create scans
|
|
||||||
} |
|
||||||
|
|
||||||
public ScanCollection(String repo, String rev){ |
|
||||||
//shortcut for single scans
|
|
||||||
scans.add(new Scan(repo, rev)); |
|
||||||
} |
|
||||||
|
|
||||||
public ScanCollection(String brewBuildId){ |
|
||||||
scans.add(new Scan(brewBuildId)); |
|
||||||
} |
|
||||||
|
|
||||||
//Create tekton pipeline/taskrun
|
|
||||||
public void execute(){ |
|
||||||
for(Scan s : scans){ |
|
||||||
s.executeScan(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -0,0 +1,50 @@ |
|||||||
|
package com.redhat.pctsec.model; |
||||||
|
|
||||||
|
import com.redhat.pctsec.rest.v1alpha1.Scan; |
||||||
|
import jakarta.enterprise.context.ApplicationScoped; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.HashSet; |
||||||
|
import java.util.Set; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
@ApplicationScoped |
||||||
|
public class ScanRequests { |
||||||
|
|
||||||
|
@Id @GeneratedValue private Long id; |
||||||
|
private Set<ScanRequest> scanRequests = new HashSet<>(); |
||||||
|
private HashMap<String, String> globalScanProperties; |
||||||
|
|
||||||
|
public ScanRequests(){ |
||||||
|
this.id = |
||||||
|
} |
||||||
|
public ScanRequests(pssaas pssaas){ |
||||||
|
//Iterate scan payload and create scans
|
||||||
|
} |
||||||
|
|
||||||
|
public ScanRequests(String repo, String rev){ |
||||||
|
//shortcut for single scans
|
||||||
|
scanRequests.add(new ScanRequest(repo, rev)); |
||||||
|
} |
||||||
|
|
||||||
|
public ScanRequests(String brewBuildId){ |
||||||
|
scanRequests.add(new ScanRequest(brewBuildId)); |
||||||
|
} |
||||||
|
|
||||||
|
public void addBrewBuild(String brewBuildId) |
||||||
|
{ |
||||||
|
scanRequests.add(new ScanRequest(brewBuildId)); |
||||||
|
} |
||||||
|
|
||||||
|
public void addGit(String repo, String rev) |
||||||
|
{ |
||||||
|
scanRequests.add(new ScanRequest(repo, rev)); |
||||||
|
} |
||||||
|
|
||||||
|
//Create tekton pipeline/taskrun
|
||||||
|
public void execute(){ |
||||||
|
for(ScanRequest s : scanRequests){ |
||||||
|
s.executeScan(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue