-
Notifications
You must be signed in to change notification settings - Fork 1
/
validate_repository.java
30 lines (27 loc) · 1.12 KB
/
validate_repository.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.io.FileInputStream;
import java.util.Properties;
public class validate_repository {
public static void main(String[] args) throws Exception {
// Path artifactDir = Path.of(System.getenv("ARTIFACT_DIR"));
String repository = System.getenv("REPOSITORY");
String name = System.getenv("NAME");
// String version = System.getenv("VERSION");
// Verify if the repository pattern is valid
Properties prop = groupIdMapping();
// Check if the artifacts are from the authorized group Id
if (!prop.containsKey(repository)) {
throw new Exception("Group Id not found in the mapping files for the repository: " + repository);
}
//TODO: Perform other checks here
}
private static Properties groupIdMapping() throws Exception {
Properties prop = new Properties();
try (FileInputStream fis = new FileInputStream("mapping.properties")) {
prop.load(fis);
}
try (FileInputStream fis = new FileInputStream("quarkiverse-mapping.properties")) {
prop.load(fis);
}
return prop;
}
}