-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This contains the authorized repository=groupId where: | ||
# - repository is the repository where the extension is hosted | ||
# - groupId is the groupId of the extension | ||
quarkiverse-release/quarkus-slack=io.quarkiverse.slack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.util.Properties; | ||
|
||
public class validate_repository { | ||
|
||
public static void main(String[] args) { | ||
System.out.println(new File(System.getenv("ARTIFACT_DIR")).exists()); | ||
System.out.println("Hello, World"); | ||
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("Unauthorized group Id"); | ||
} | ||
//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); | ||
} | ||
return prop; | ||
} | ||
} |