Skip to content

Commit

Permalink
Provisioner: Avoid cloning kbs repo
Browse files Browse the repository at this point in the history
Fixes: confidential-containers#1471
Signed-off-by: Kartik Joshi <kartikjoshi@microsoft.com>
  • Loading branch information
kartikjoshi21 committed Feb 12, 2024
1 parent 2005f51 commit f4ec427
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions test/provisioner/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -78,23 +77,6 @@ type InstallOverlay interface {
Edit(ctx context.Context, cfg *envconf.Config, properties map[string]string) error
}

func runCommand(command string, stdout io.Writer, stderr io.Writer, args ...string) error {
cmd := exec.Command(command, args...)
cmd.Stdout = stdout
cmd.Stderr = stderr

fmt.Printf("Running command: %s %v\n", command, args)

if err := cmd.Run(); err != nil {
err = fmt.Errorf(fmt.Sprintf("Error running command: %s %v - %s", command, args, err))

log.Errorf("%v", err)
return err
}

return nil
}

func saveToFile(filename string, content []byte) error {
// Save contents to file
err := os.WriteFile(filename, content, 0644)
Expand All @@ -105,13 +87,6 @@ func saveToFile(filename string, content []byte) error {
}

func NewKeyBrokerService(clusterName string) (*KeyBrokerService, error) {
// Clone kbs repo
repoURL := "https://github.com/confidential-containers/kbs"

if err := runCommand("git", os.Stdout, os.Stderr, "clone", repoURL); err != nil {
return nil, err
}

log.Info("creating key.bin")

// Create secret
Expand Down Expand Up @@ -420,16 +395,6 @@ func (p *KeyBrokerService) Delete(ctx context.Context, cfg *envconf.Config) erro
return err
}

// remove kbs repo
directoryPath := "kbs"

err = os.RemoveAll(directoryPath)
if err != nil {
err = fmt.Errorf("Error deleting directory: %w\n", err)
log.Errorf("%v", err)
return err
}

return nil
}

Expand Down

0 comments on commit f4ec427

Please sign in to comment.