Skip to content

Commit 0030dae

Browse files
feat: fetch tag commit SHA directly from Git repository
1 parent 606770a commit 0030dae

File tree

10 files changed

+201
-143
lines changed

10 files changed

+201
-143
lines changed

artifactory/artifactory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
func init() {
2929
log.SetOutput(os.Stdout)
3030
log.SetLevel(log.DebugLevel)
31-
defs, err := targets.ReadTargetsDefFromBytes([]byte(targetsJSON))
31+
defs, err := targets.ReadTargetsDefFromBytes([]byte(targetsJSON), "")
3232
if err != nil {
3333
panic(err)
3434
}

cmd/ebuild/run/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ func (s *serverRunner) runAPI(cmd *cobra.Command, args []string) {
4040
fmt.Printf("failed to migrate database: %s", err)
4141
os.Exit(1)
4242
}
43-
if defs, err := targets.ReadTargetsDef("./targets.json"); err != nil {
43+
if defs, err := targets.ReadTargetsDef("./targets.json", s.opts.SourceRepository); err != nil {
4444
fmt.Printf("failed to read targets: %s", err)
4545
os.Exit(1)
4646
} else {
4747
targets.SetTargets(defs)
4848
}
49-
go targets.Updater(time.Minute * 5)
49+
go targets.Updater(time.Minute*5, s.opts.SourceRepository)
5050
art, err := artifactory.NewFromConfig(s.ctx, s.opts)
5151
if err != nil {
5252
fmt.Printf("failed to create artifactory: %s", err)

config/options.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ func (o *CloudbuildOpts) BindAPIOpts(c *cobra.Command) {
169169
c.Flags().IPVarP(&o.HTTPBindAddress, "listen-ip", "l", net.IPv4zero, "HTTP listen IP")
170170
c.Flags().StringVarP(
171171
&o.DownloadURL, "download-url", "u", o.DownloadURL, "Artifact download URL")
172+
c.Flags().StringVar(
173+
&o.SourceRepository, "src-repo", o.SourceRepository, "Source repository")
172174
}
173175

174176
func (o *CloudbuildOpts) BindWorkerOpts(c *cobra.Command) {

go.mod

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,28 @@ require (
1010
github.com/aws/aws-sdk-go-v2/service/s3 v1.33.1
1111
github.com/gin-contrib/static v0.0.1
1212
github.com/gin-gonic/gin v1.9.1
13+
github.com/go-git/go-git/v6 v6.0.0-20250819122726-39261590f7f3
1314
github.com/ldez/go-git-cmd-wrapper/v2 v2.6.0
1415
github.com/mitchellh/mapstructure v1.5.0
1516
github.com/pkg/errors v0.9.1
1617
github.com/prometheus/client_golang v1.15.0
1718
github.com/satori/go.uuid v1.2.0
18-
github.com/sirupsen/logrus v1.9.0
19+
github.com/sirupsen/logrus v1.9.3
1920
github.com/spf13/cobra v1.7.0
2021
github.com/spf13/viper v1.15.0
21-
github.com/stretchr/testify v1.8.3
22+
github.com/stretchr/testify v1.10.0
2223
github.com/toorop/gin-logrus v0.0.0-20210225092905-2c785434f26f
23-
golang.org/x/crypto v0.36.0
24-
golang.org/x/exp v0.0.0-20230519143937-03e91628a987
24+
golang.org/x/crypto v0.41.0
25+
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b
2526
gorm.io/datatypes v1.2.0
2627
gorm.io/driver/postgres v1.5.0
2728
gorm.io/gorm v1.25.0
2829
)
2930

3031
require (
32+
dario.cat/mergo v1.0.1 // indirect
33+
github.com/Microsoft/go-winio v0.6.2 // indirect
34+
github.com/ProtonMail/go-crypto v1.3.0 // indirect
3135
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
3236
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 // indirect
3337
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 // indirect
@@ -46,16 +50,22 @@ require (
4650
github.com/bytedance/sonic v1.9.1 // indirect
4751
github.com/cespare/xxhash/v2 v2.2.0 // indirect
4852
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
53+
github.com/cloudflare/circl v1.6.1 // indirect
54+
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
4955
github.com/davecgh/go-spew v1.1.1 // indirect
56+
github.com/emirpasic/gods v1.18.1 // indirect
5057
github.com/fsnotify/fsnotify v1.6.0 // indirect
5158
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
5259
github.com/gin-contrib/sse v0.1.0 // indirect
60+
github.com/go-git/gcfg/v2 v2.0.2 // indirect
61+
github.com/go-git/go-billy/v6 v6.0.0-20250627091229-31e2a16eef30 // indirect
5362
github.com/go-playground/locales v0.14.1 // indirect
5463
github.com/go-playground/universal-translator v0.18.1 // indirect
5564
github.com/go-playground/validator/v10 v10.14.0 // indirect
5665
github.com/go-sql-driver/mysql v1.7.1 // indirect
5766
github.com/goccy/go-json v0.10.2 // indirect
58-
github.com/golang/protobuf v1.5.3 // indirect
67+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
68+
github.com/golang/protobuf v1.5.4 // indirect
5969
github.com/hashicorp/hcl v1.0.0 // indirect
6070
github.com/inconshreveable/mousetrap v1.1.0 // indirect
6171
github.com/jackc/pgpassfile v1.0.0 // indirect
@@ -65,6 +75,7 @@ require (
6575
github.com/jinzhu/inflection v1.0.0 // indirect
6676
github.com/jinzhu/now v1.1.5 // indirect
6777
github.com/json-iterator/go v1.1.12 // indirect
78+
github.com/kevinburke/ssh_config v1.2.0 // indirect
6879
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
6980
github.com/leodido/go-urn v1.2.4 // indirect
7081
github.com/magiconair/properties v1.8.7 // indirect
@@ -73,24 +84,25 @@ require (
7384
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
7485
github.com/modern-go/reflect2 v1.0.2 // indirect
7586
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
87+
github.com/pjbgf/sha1cd v0.4.0 // indirect
7688
github.com/pmezard/go-difflib v1.0.0 // indirect
7789
github.com/prometheus/client_model v0.3.0 // indirect
7890
github.com/prometheus/common v0.42.0 // indirect
7991
github.com/prometheus/procfs v0.9.0 // indirect
80-
github.com/rogpeppe/go-internal v1.9.0 // indirect
92+
github.com/sergi/go-diff v1.4.0 // indirect
8193
github.com/spf13/afero v1.9.3 // indirect
8294
github.com/spf13/cast v1.5.0 // indirect
8395
github.com/spf13/jwalterweatherman v1.1.0 // indirect
8496
github.com/spf13/pflag v1.0.5 // indirect
85-
github.com/stretchr/objx v0.5.0 // indirect
97+
github.com/stretchr/objx v0.5.2 // indirect
8698
github.com/subosito/gotenv v1.4.2 // indirect
8799
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
88100
github.com/ugorji/go/codec v1.2.11 // indirect
89101
golang.org/x/arch v0.3.0 // indirect
90-
golang.org/x/net v0.38.0 // indirect
91-
golang.org/x/sync v0.12.0 // indirect
92-
golang.org/x/sys v0.31.0 // indirect
93-
golang.org/x/text v0.23.0 // indirect
102+
golang.org/x/net v0.43.0 // indirect
103+
golang.org/x/sync v0.16.0 // indirect
104+
golang.org/x/sys v0.35.0 // indirect
105+
golang.org/x/text v0.28.0 // indirect
94106
google.golang.org/protobuf v1.33.0 // indirect
95107
gopkg.in/ini.v1 v1.67.0 // indirect
96108
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)