-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
46 lines (39 loc) · 1.32 KB
/
main.go
File metadata and controls
46 lines (39 loc) · 1.32 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"log"
"os"
"github.com/drtbz/lector/exporters/azuretable"
"github.com/drtbz/lector/sources"
"github.com/drtbz/lector/sources/artifacthub"
ghsource "github.com/drtbz/lector/sources/github"
"github.com/google/go-github/v45/github"
)
func main() {
serviceClient := azuretable.ConnectionStringSetup(os.Getenv("AZTCON"))
if azuretable.Setup("lector", serviceClient) != nil {
log.Fatalf("Error Setting up Azure Tables")
}
aztClient := serviceClient.NewClient("lector")
ctx, client := ghsource.PATSetup("GHTOKEN")
repoList := sources.GetUpstream("_data/repolist.txt")
for _, v := range repoList {
if v.Source() == "github" {
re, _, err := ghsource.LatestRelease(client, ctx, v.Owner(), v.Repo())
if err != nil {
log.Fatal(err)
}
log.Printf("%v/%v: %v", v.Owner(), v.Repo(), github.Stringify(re.Name))
//azuretable.NewGHEntity(aztClient, v, github.Stringify(re.Name))
azuretable.Query(aztClient, v)
}
if v.Source() == "artifacthub" {
re, err := artifacthub.GetHelmPackage(v.Owner(), v.Repo())
if err != nil {
log.Fatal(err)
}
log.Printf("%v: Chart: %v, App: %v \n", re["name"], re["version"], re["app_version"])
//azuretable.NewAHEntity(aztClient, v, fmt.Sprintf("%v", re["version"]), fmt.Sprintf("%v", re["app_version"]))
azuretable.Query(aztClient, v)
}
}
}