@@ -5,6 +5,11 @@ import (
5
5
"fmt"
6
6
"path/filepath"
7
7
8
+ "github.com/apex/log"
9
+ "github.com/google/go-github/v66/github"
10
+ "github.com/gregjones/httpcache"
11
+ "github.com/gregjones/httpcache/diskcache"
12
+
8
13
"github.com/ekristen/distillery/pkg/asset"
9
14
)
10
15
@@ -26,7 +31,7 @@ func (s *Kubernetes) GetRepo() string {
26
31
return s .Repo
27
32
}
28
33
func (s * Kubernetes ) GetApp () string {
29
- return fmt .Sprintf ("%s/%s" , s .Owner , s .Repo )
34
+ return fmt .Sprintf ("%s/%s" , s .Owner , s .AppName )
30
35
}
31
36
func (s * Kubernetes ) GetID () string {
32
37
return fmt .Sprintf ("%s-%s" , s .GetSource (), s .GetRepo ())
@@ -36,6 +41,28 @@ func (s *Kubernetes) GetDownloadsDir() string {
36
41
return filepath .Join (s .Options .Config .GetDownloadsPath (), s .GetSource (), s .GetOwner (), s .GetRepo (), s .Version )
37
42
}
38
43
44
+ // sourceRun - run the source specific logic (note this is duplicate because of the GetReleaseAssets override)
45
+ func (s * Kubernetes ) sourceRun (ctx context.Context ) error { //nolint:dupl
46
+ cacheFile := filepath .Join (s .Options .Config .GetMetadataPath (), fmt .Sprintf ("cache-%s" , s .GetID ()))
47
+
48
+ s .client = github .NewClient (httpcache .NewTransport (diskcache .New (cacheFile )).Client ())
49
+ githubToken := s .Options .Settings ["github-token" ].(string )
50
+ if githubToken != "" {
51
+ log .Debug ("auth token provided" )
52
+ s .client = s .client .WithAuthToken (githubToken )
53
+ }
54
+
55
+ if err := s .FindRelease (ctx ); err != nil {
56
+ return err
57
+ }
58
+
59
+ if err := s .GetReleaseAssets (ctx ); err != nil {
60
+ return err
61
+ }
62
+
63
+ return nil
64
+ }
65
+
39
66
func (s * Kubernetes ) GetReleaseAssets (_ context.Context ) error {
40
67
binName := fmt .Sprintf ("%s-%s-%s-%s" , s .AppName , s .Version , s .GetOS (), s .GetArch ())
41
68
s .Assets = append (s .Assets , & KubernetesAsset {
0 commit comments