Skip to content

Commit 42b0502

Browse files
committed
f
1 parent 59fcfc2 commit 42b0502

File tree

2 files changed

+5
-58
lines changed

2 files changed

+5
-58
lines changed

cmd/buildtools/openebs.go

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ package main
22

33
import (
44
"fmt"
5-
"os"
6-
"os/exec"
7-
"path/filepath"
85
"strings"
96

107
"github.com/sirupsen/logrus"
@@ -191,54 +188,3 @@ func getAddonComponentUpstreamVersion(c *cli.Context, component addonComponent)
191188
func getAddonComponentImageTagMakefileVar(component addonComponent) string {
192189
return fmt.Sprintf("%s_IMAGE_TAG", strings.ReplaceAll(strings.ToUpper(component.name), "-", "_"))
193190
}
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-
}

cmd/buildtools/utils.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,15 @@ func ApkoLogin() error {
183183
return nil
184184
}
185185

186-
func ApkoBuildAndPublish(componentName string, packageVersion string) error {
187-
if err := RunCommand(
188-
"make",
186+
func ApkoBuildAndPublish(componentName string, packageVersion string, extraArgs ...string) error {
187+
args := []string{
189188
"apko-build-and-publish",
190189
fmt.Sprintf("IMAGE=%s/replicated/ec-%s:%s", os.Getenv("REGISTRY_SERVER"), componentName, packageVersion),
191190
fmt.Sprintf("APKO_CONFIG=%s", filepath.Join("deploy", "images", componentName, "apko.tmpl.yaml")),
192191
fmt.Sprintf("PACKAGE_VERSION=%s", packageVersion),
193-
); err != nil {
192+
}
193+
args = append(args, extraArgs...)
194+
if err := RunCommand("make", args...); err != nil {
194195
return err
195196
}
196197
return nil

0 commit comments

Comments
 (0)