/
build-charts.go
42 lines (35 loc) · 963 Bytes
/
build-charts.go
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
//go:generate go run .
package main
import (
"context"
"log"
"net/http"
"os"
"github.com/giantswarm/microerror"
"github.com/google/go-github/v39/github"
"golang.org/x/oauth2"
"github.com/giantswarm/apiextensions/v5/pkg/crd"
)
func main() {
ctx := context.Background()
httpClient := http.DefaultClient
if githubToken := os.Getenv("GITHUB_TOKEN"); githubToken != "" {
token := oauth2.Token{AccessToken: githubToken}
ts := oauth2.StaticTokenSource(&token)
httpClient = oauth2.NewClient(ctx, ts)
}
renderer := crd.Renderer{
GithubClient: github.NewClient(httpClient),
LocalCRDDirectory: "../config/crd",
OutputDirectory: "../helm",
Patches: patches,
UpstreamAssets: upstreamReleaseAssets,
RemoteRepositories: remoteRepositories,
}
for _, provider := range []string{"common", "aws", "azure", "kvm"} {
err := renderer.Render(ctx, provider)
if err != nil {
log.Fatal(microerror.JSON(err))
}
}
}