-
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 status checks…
added ldap search command
updated collect stats to use virtual threads to improve performance
1 parent
4d4b3fb
commit 3aff246
Showing
26 changed files
with
865 additions
and
234 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
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 |
---|---|---|
|
@@ -38,5 +38,6 @@ nb-configuration.xml | |
# Local environment | ||
.env | ||
|
||
logs/ | ||
creds.source | ||
gh-members.csv | ||
supplementary.csv |
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
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
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,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
open https://docs.google.com/spreadsheets/d/1Aesp-sIoTvV-a0Qd-Kt0IpiU7fxvJLPDq8SwZ43vSOw/gviz/tq?tqx=out:csv | ||
|
||
sleep 5s | ||
mv ~/Downloads/data.csv gh-members.csv |
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,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
scripts/download-memebers-sheet.sh | ||
|
||
./mvnw clean install -Pnative | ||
|
||
#./target/github-stats-1.0.0-SNAPSHOT-runner collect-stats --organization=redhat-cop | ||
|
||
./target/github-stats-1.0.0-SNAPSHOT-runner collect-members-from-ldap --organization=redhat-cop --members-csv=gh-members.csv --csv-output=supplementary.csv --fail-if-no-vpn=true | ||
./target/github-stats-1.0.0-SNAPSHOT-runner github-member-in-ldap --organization=redhat-cop --issue-repo=org --members-csv=gh-members.csv --supplementary-csv=supplementary.csv --fail-if-no-vpn=true |
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
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
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
39 changes: 39 additions & 0 deletions
39
...om/garethahealy/githubstats/commands/users/CollectRedHatLdapSupplementaryListCommand.java
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,39 @@ | ||
package com.garethahealy.githubstats.commands.users; | ||
|
||
import com.garethahealy.githubstats.services.users.CollectRedHatLdapSupplementaryListService; | ||
import freemarker.template.TemplateException; | ||
import jakarta.enterprise.context.Dependent; | ||
import jakarta.inject.Inject; | ||
import org.apache.directory.api.ldap.model.exception.LdapException; | ||
import picocli.CommandLine; | ||
|
||
import java.io.IOException; | ||
|
||
@Dependent | ||
@CommandLine.Command(name = "collect-members-from-ldap", mixinStandardHelpOptions = true, description = "Creates a supplementary CSV containing members who have added their GitHub ID to LDAP") | ||
public class CollectRedHatLdapSupplementaryListCommand implements Runnable { | ||
|
||
@CommandLine.Option(names = {"-org", "--organization"}, description = "GitHub organization", required = true) | ||
String organization; | ||
|
||
@CommandLine.Option(names = {"-o", "--csv-output"}, description = "Output location for CSV", defaultValue = "github-output.csv") | ||
String output; | ||
|
||
@CommandLine.Option(names = {"-i", "--members-csv"}, description = "CSV of current known members", required = true) | ||
String membersCsv; | ||
|
||
@CommandLine.Option(names = {"-vpn", "--fail-if-no-vpn"}, description = "Throw an exception if can't connect to LDAP") | ||
boolean failNoVpn; | ||
|
||
@Inject | ||
CollectRedHatLdapSupplementaryListService collectRedHatLdapSupplementaryListService; | ||
|
||
@Override | ||
public void run() { | ||
try { | ||
collectRedHatLdapSupplementaryListService.run(organization, output, membersCsv, failNoVpn); | ||
} catch (IOException | LdapException | TemplateException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
...ain/java/com/garethahealy/githubstats/commands/users/GitHubMemberInRedHatLdapCommand.java
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,45 @@ | ||
package com.garethahealy.githubstats.commands.users; | ||
|
||
import com.garethahealy.githubstats.services.users.GitHubMemberInRedHatLdapService; | ||
import freemarker.template.TemplateException; | ||
import jakarta.enterprise.context.Dependent; | ||
import jakarta.inject.Inject; | ||
import org.apache.directory.api.ldap.model.exception.LdapException; | ||
import picocli.CommandLine; | ||
|
||
import java.io.IOException; | ||
|
||
@Dependent | ||
@CommandLine.Command(name = "github-member-in-ldap", mixinStandardHelpOptions = true, description = "Creates a single issue containing any users that are part of the GitHub Org but not in LDAP") | ||
public class GitHubMemberInRedHatLdapCommand implements Runnable { | ||
|
||
@CommandLine.Option(names = {"-org", "--organization"}, description = "GitHub organization", required = true) | ||
String organization; | ||
|
||
@CommandLine.Option(names = {"-repo", "--issue-repo"}, description = "Repo where the issues should be created, i.e.: 'org'", required = true) | ||
String orgRepo; | ||
|
||
@CommandLine.Option(names = {"-dry", "--dry-run"}, description = "Dry-run aka don't actually create the GitHub issue", required = true) | ||
boolean dryRun; | ||
|
||
@CommandLine.Option(names = {"-i", "--members-csv"}, description = "CSV of current known members", required = true) | ||
String membersCsv; | ||
|
||
@CommandLine.Option(names = {"-s", "--supplementary-csv"}, description = "CSV of current known members, generated by 'collect-members-from-ldap'", required = true) | ||
String supplementaryCsv; | ||
|
||
@CommandLine.Option(names = {"-vpn", "--fail-if-no-vpn"}, description = "Throw an exception if can't connect to LDAP") | ||
boolean failNoVpn; | ||
|
||
@Inject | ||
GitHubMemberInRedHatLdapService gitHubMemberInRedHatLdapService; | ||
|
||
@Override | ||
public void run() { | ||
try { | ||
gitHubMemberInRedHatLdapService.run(organization, orgRepo, dryRun, membersCsv, supplementaryCsv, failNoVpn); | ||
} catch (IOException | LdapException | TemplateException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/garethahealy/githubstats/model/MembersInfo.java
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,46 @@ | ||
package com.garethahealy.githubstats.model; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
@RegisterForReflection | ||
public class MembersInfo { | ||
public enum Headers { | ||
Timestamp, | ||
EmailAddress, | ||
WhatIsYourGitHubUsername | ||
} | ||
|
||
private final String timestamp; | ||
private final String emailAddress; | ||
private final String whatIsYourGitHubUsername; | ||
private String redHatUserId; | ||
|
||
public String getEmailAddress() { | ||
return emailAddress; | ||
} | ||
|
||
public String getRedHatUserId() { | ||
if (redHatUserId == null || redHatUserId.isEmpty()) { | ||
redHatUserId = emailAddress.split("@")[0]; | ||
} | ||
|
||
return redHatUserId; | ||
} | ||
|
||
public String getWhatIsYourGitHubUsername() { | ||
return whatIsYourGitHubUsername; | ||
} | ||
|
||
public MembersInfo(String timestamp, String emailAddress, String whatIsYourGitHubUsername) { | ||
this.timestamp = timestamp; | ||
this.emailAddress = emailAddress; | ||
this.whatIsYourGitHubUsername = whatIsYourGitHubUsername; | ||
} | ||
|
||
public List<String> toArray() { | ||
return Arrays.asList(timestamp, emailAddress, whatIsYourGitHubUsername); | ||
} | ||
} |
Oops, something went wrong.