You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.8 KiB
78 lines
1.8 KiB
package com.redhat.pctsec.model; |
|
|
|
import com.redhat.pctsec.model.api.request.pssaas; |
|
import com.redhat.pctsec.model.api.request.scanChain; |
|
import jakarta.enterprise.context.ApplicationScoped; |
|
|
|
import java.util.HashMap; |
|
import java.util.HashSet; |
|
import java.util.Set; |
|
|
|
import jakarta.persistence.*; |
|
|
|
@ApplicationScoped |
|
@Entity |
|
public class ScanRequests { |
|
|
|
@Id |
|
@GeneratedValue |
|
private Long id; |
|
|
|
@OneToMany |
|
@JoinColumn(name = "scan_request_id", referencedColumnName = "id") |
|
private Set<ScanRequest> scanRequests; |
|
|
|
@Column(name="scan_properties") |
|
private String scanProperties; |
|
|
|
@Column(name="scan_metadata") |
|
private String scanMetadata; |
|
|
|
|
|
public ScanRequests(){ |
|
//Default to the Snyk scan |
|
this.scanProperties = "-p snyk-only-unstable --tarball-build-script=\":\""; |
|
} |
|
|
|
public ScanRequests(pssaas pssaas){ |
|
this(); |
|
//Iterate scan payload and create scans |
|
} |
|
|
|
public ScanRequests(scanChain scanchain){ |
|
this(); |
|
} |
|
|
|
//public ScanRequests(String repo, String rev){ |
|
// //shortcut for single scans |
|
// scanRequests.add(new ScanRequest(repo, rev)); |
|
//} |
|
|
|
/* |
|
public ScanRequests(String brewBuildId){ |
|
scanRequests.add(new ScanRequest(new B)); |
|
} |
|
*/ |
|
|
|
public void addBrewBuild(String brewBuildId) |
|
{ |
|
scanRequests.add(new ScanRequest(new BrewBuild(brewBuildId))); |
|
} |
|
|
|
public void addGit(String repo, String rev) |
|
{ |
|
scanRequests.add(new ScanRequest(new Git(repo, rev))); |
|
} |
|
|
|
public void addPNCBuild(String pncBuildId) |
|
{ |
|
scanRequests.add(new ScanRequest(new PNCBuild(pncBuildId))); |
|
} |
|
|
|
//Create tekton pipeline/taskrun |
|
public void execute(){ |
|
for(ScanRequest s : scanRequests){ |
|
s.executeScan(); |
|
} |
|
} |
|
}
|
|
|