@@ -2,9 +2,6 @@ package main
2
2
3
3
import (
4
4
"fmt"
5
- "os"
6
- "os/exec"
7
- "path/filepath"
8
5
"strings"
9
6
10
7
"github.com/sirupsen/logrus"
@@ -191,54 +188,3 @@ func getAddonComponentUpstreamVersion(c *cli.Context, component addonComponent)
191
188
func getAddonComponentImageTagMakefileVar (component addonComponent ) string {
192
189
return fmt .Sprintf ("%s_IMAGE_TAG" , strings .ReplaceAll (strings .ToUpper (component .name ), "-" , "_" ))
193
190
}
194
-
195
- func ApkoLogin () error {
196
- if err := RunCommand ("make" , "apko" ); err != nil {
197
- return fmt .Errorf ("make apko: %w" , err )
198
- }
199
- if os .Getenv ("REGISTRY_PASS" ) != "" {
200
- if err := RunCommand (
201
- "make" ,
202
- "apko-login" ,
203
- fmt .Sprintf ("REGISTRY=%s" , os .Getenv ("REGISTRY_SERVER" )),
204
- fmt .Sprintf ("USERNAME=%s" , os .Getenv ("REGISTRY_USER" )),
205
- fmt .Sprintf ("PASSWORD=%s" , os .Getenv ("REGISTRY_PASS" )),
206
- ); err != nil {
207
- return err
208
- }
209
- }
210
- return nil
211
- }
212
-
213
- func ApkoBuildAndPublish (componentName string , packageVersion string , extraArgs ... string ) error {
214
- args := []string {
215
- "apko-build-and-publish" ,
216
- fmt .Sprintf ("IMAGE=%s/replicated/ec-%s:%s" , os .Getenv ("REGISTRY_SERVER" ), componentName , packageVersion ),
217
- fmt .Sprintf ("APKO_CONFIG=%s" , filepath .Join ("deploy" , "images" , componentName , "apko.tmpl.yaml" )),
218
- fmt .Sprintf ("PACKAGE_VERSION=%s" , packageVersion ),
219
- }
220
- args = append (args , extraArgs ... )
221
- if err := RunCommand ("make" , args ... ); err != nil {
222
- return err
223
- }
224
- return nil
225
- }
226
-
227
- func GetDigestFromBuildFile () (string , error ) {
228
- contents , err := os .ReadFile ("build/digest" )
229
- if err != nil {
230
- return "" , fmt .Errorf ("read build file: %w" , err )
231
- }
232
- parts := strings .Split (string (contents ), "@" )
233
- if len (parts ) != 2 {
234
- return "" , fmt .Errorf ("incorrect number of parts in build file" )
235
- }
236
- return strings .TrimSpace (parts [1 ]), nil
237
- }
238
-
239
- func RunCommand (name string , args ... string ) error {
240
- cmd := exec .Command (name , args ... )
241
- cmd .Stdout = os .Stdout
242
- cmd .Stderr = os .Stderr
243
- return cmd .Run ()
244
- }
0 commit comments