-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SEAB-6360: download github event from s3 #491
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #491 +/- ##
==========================================
Coverage 48.42% 48.42%
Complexity 305 305
==========================================
Files 46 46
Lines 2480 2480
Branches 200 200
==========================================
Hits 1201 1201
Misses 1187 1187
Partials 92 92
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
CloudShell :) Too may terms with "Cloud" in them... |
githubdelivery/src/main/java/io/dockstore/githubdelivery/package-info.java
Outdated
Show resolved
Hide resolved
githubdelivery/src/main/java/io/dockstore/githubdelivery/GithubDeliveryS3Client.java
Outdated
Show resolved
Hide resolved
githubdelivery/src/main/java/io/dockstore/githubdelivery/GithubDeliveryS3Client.java
Show resolved
Hide resolved
You could perform a release once this is merged to develop so the reviewer can just |
githubdelivery/src/main/java/io/dockstore/githubdelivery/package-info.java
Show resolved
Hide resolved
githubdelivery/src/main/java/io/dockstore/githubdelivery/GithubDeliveryConfig.java
Outdated
Show resolved
Hide resolved
githubdelivery/src/main/java/io/dockstore/githubdelivery/GithubDeliveryCommandLineArgs.java
Outdated
Show resolved
Hide resolved
pom.xml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting here but unrelated to this file: should also add this module to the CircleCI file so that it gets built
dockstore-support/.circleci/config.yml
Line 31 in 98c476c
jobs: |
@Parameters(commandNames = { "download-event" }, commandDescription = "Download github event from S3 bucket using key.") | ||
public static class DownloadEventCommand { | ||
|
||
@Parameter(names = {"-k", "--key"}, description = "The key of the event in bucket. Format should be YYYY-MM-DD/deliveryid") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can cross this bridge when we get there, but it could be useful to submit by date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second, can create follow-up ticket to avoid this PR from dragging too long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some clean-up items
Please link created tickets to the comments so we know what was done here and what remains to be done
@Parameters(commandNames = { "download-event" }, commandDescription = "Download github event from S3 bucket using key.") | ||
public static class DownloadEventCommand { | ||
|
||
@Parameter(names = {"-k", "--key"}, description = "The key of the event in bucket. Format should be YYYY-MM-DD/deliveryid") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second, can create follow-up ticket to avoid this PR from dragging too long
final GithubDeliveryS3Client githubDeliveryS3Client = new GithubDeliveryS3Client(githubDeliveryConfig.getS3Config().bucket()); | ||
|
||
if ("download-event".equals(jCommander.getParsedCommand())) { | ||
System.out.println(githubDeliveryS3Client.getGitHubDeliveryEventByKey(downloadEventCommand.getBucketKey())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use logging framework, can be follow-up ticket
public static void main(String[] args) throws IOException { | ||
final GithubDeliveryCommandLineArgs commandLineArgs = new GithubDeliveryCommandLineArgs(); | ||
final JCommander jCommander = new JCommander(commandLineArgs); | ||
final DownloadEventCommand downloadEventCommand = new DownloadEventCommand(); | ||
jCommander.addCommand(downloadEventCommand); | ||
|
||
try { | ||
jCommander.parse(args); | ||
} catch (MissingCommandException e) { | ||
jCommander.usage(); | ||
if (e.getUnknownCommand().isEmpty()) { | ||
LOG.error("No command entered"); | ||
} else { | ||
LOG.error("Unknown command"); | ||
} | ||
exceptionMessage(e, "The command is missing", GENERIC_ERROR); | ||
} catch (ParameterException e) { | ||
jCommander.usage(); | ||
exceptionMessage(e, "Error parsing arguments", GENERIC_ERROR); | ||
} | ||
|
||
if (jCommander.getParsedCommand() == null || commandLineArgs.isHelp()) { | ||
jCommander.usage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code section, which creates the JCommander
object and handles errors and prints usage information, appears to repeat in some of our other utilities. If, upon inspection, we find that it's repeated more-or-less verbatim, we might consider moving it to a helper (at some time, doesn't need to happen now). Then, we could do something like:
final GithubDeliveryCommandLineArgs commandLineArgs = new GithubDeliveryCommandLineArgs();
final DownloadEventCommand downloadEventCommand = new DownloadEventCommand();
final JCommander jCommander = JCommanderHelper.createAndParse(commandLineArgs, downloadEventCommand);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add this to the followup :)
githubdelivery/src/main/java/io/dockstore/githubdelivery/GithubDeliveryConfig.java
Outdated
Show resolved
Hide resolved
githubdelivery/src/main/java/io/dockstore/githubdelivery/package-info.java
Outdated
Show resolved
Hide resolved
githubdelivery/src/main/java/io/dockstore/githubdelivery/GithubDeliveryS3Client.java
Show resolved
Hide resolved
githubdelivery/src/main/java/io/dockstore/githubdelivery/GithubDeliveryS3Client.java
Outdated
Show resolved
Hide resolved
I created ticket https://ucsc-cgl.atlassian.net/browse/SEAB-6452 For followup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor redundancy
Quality Gate failedFailed conditions |
Description
This PR creates a module
githubdelivery
and adds a commanddownload-event
to return the github payload from s3 from its key.Review Instructions
It was the easiest to run on CloudShell
Steps I used was
sudo yum install java-17-amazon-corretto
githubdelivery
module by running./mvnw install -pl githubdelivery -am
github-delivery.config
for QA (template intemplates
folder)java -jar target/githubdelivery-1.16.0-SNAPSHOT.jar download-event -k "2024-05-15/004701ac-1307-11ef-94b7-6b9aec991740"
and verify the payload is printed on the console.Issue
https://ucsc-cgl.atlassian.net/browse/SEAB-6360
Security
If there are any concerns that require extra attention from the security team, highlight them here.
Please make sure that you've checked the following before submitting your pull request. Thanks!
mvn clean install
in the project that you have modified (until https://ucsc-cgl.atlassian.net/browse/SEAB-5300 adds multi-module support properly)