4848 binaries = map [string ]string {
4949 "arangodb-exporter-darwin-amd64" : "darwin/amd64/arangodb-exporter" ,
5050 "arangodb-exporter-linux-amd64" : "linux/amd64/arangodb-exporter" ,
51+ "arangodb-exporter-linux-arm" : "linux/arm/arangodb-exporter" ,
52+ "arangodb-exporter-linux-arm64" : "linux/arm64/arangodb-exporter" ,
5153 "arangodb-exporter-windows-amd64.exe" : "windows/amd64/arangodb-exporter.exe" ,
5254 }
5355)
@@ -66,10 +68,15 @@ func main() {
6668 ensureGithubToken ()
6769 checkCleanRepo ()
6870 version := bumpVersion (releaseType )
69- make ("clean ")
70- make ("build ")
71+ envVars := map [string ]string {
72+ "DOCKERNAMESPACE" : "arangodb" ,
73+ "IMAGETAG" : version ,
74+ "MANIFESTSUFFIX" : "-" ,
75+ }
76+ make ("clean ", envVars )
77+ make ("build ", envVars )
7178 createSHA256Sums ()
72- make ("docker ")
79+ make ("docker ", envVars )
7380 gitTag (version )
7481 githubCreateRelease (version )
7582 bumpVersion ("devel" )
@@ -99,8 +106,8 @@ func checkCleanRepo() {
99106 }
100107}
101108
102- func make (target string ) {
103- if err := run ("make" , target ); err != nil {
109+ func make (target string , envVars map [ string ] string ) {
110+ if err := run ("make" , [] string { target }, envVars ); err != nil {
104111 log .Fatalf ("Failed to make %s: %v\n " , target , err )
105112 }
106113}
@@ -140,19 +147,19 @@ func gitCommitAll(message string) {
140147 "--all" ,
141148 "-m" , message ,
142149 }
143- if err := run ("git" , args ... ); err != nil {
150+ if err := run ("git" , args , nil ); err != nil {
144151 log .Fatalf ("Failed to commit: %v\n " , err )
145152 }
146- if err := run ("git" , "push" ); err != nil {
153+ if err := run ("git" , [] string { "push" }, nil ); err != nil {
147154 log .Fatalf ("Failed to push commit: %v\n " , err )
148155 }
149156}
150157
151158func gitTag (version string ) {
152- if err := run ("git" , "tag" , version ); err != nil {
159+ if err := run ("git" , [] string { "tag" , version }, nil ); err != nil {
153160 log .Fatalf ("Failed to tag: %v\n " , err )
154161 }
155- if err := run ("git" , "push" , "--tags" ); err != nil {
162+ if err := run ("git" , [] string { "push" , "--tags" }, nil ); err != nil {
156163 log .Fatalf ("Failed to push tags: %v\n " , err )
157164 }
158165}
@@ -183,7 +190,7 @@ func githubCreateRelease(version string) {
183190 "--tag" , version ,
184191 "--draft" ,
185192 }
186- if err := run (ghRelease , args ... ); err != nil {
193+ if err := run (ghRelease , args , nil ); err != nil {
187194 log .Fatalf ("Failed to create github release: %v\n " , err )
188195 }
189196 // Upload binaries
@@ -202,7 +209,7 @@ func githubCreateRelease(version string) {
202209 "--name" , name ,
203210 "--file" , filepath .Join (binFolder , file ),
204211 }
205- if err := run (ghRelease , args ... ); err != nil {
212+ if err := run (ghRelease , args , nil ); err != nil {
206213 log .Fatalf ("Failed to upload asset '%s': %v\n " , name , err )
207214 }
208215 }
@@ -213,13 +220,19 @@ func githubCreateRelease(version string) {
213220 "--repo" , ghRepo ,
214221 "--tag" , version ,
215222 }
216- if err := run (ghRelease , args ... ); err != nil {
223+ if err := run (ghRelease , args , nil ); err != nil {
217224 log .Fatalf ("Failed to finalize github release: %v\n " , err )
218225 }
219226}
220227
221- func run (cmd string , args ... string ) error {
228+ func run (cmd string , args [] string , envVars map [ string ] string ) error {
222229 c := exec .Command (cmd , args ... )
230+ if envVars != nil {
231+ c .Env = append (c .Env , os .Environ ()... )
232+ for k , v := range envVars {
233+ c .Env = append (c .Env , fmt .Sprintf ("%s=%s" , k , v ))
234+ }
235+ }
223236 c .Stdout = os .Stdout
224237 c .Stderr = os .Stderr
225238 return c .Run ()
0 commit comments