Skip to content

Commit

Permalink
Embeds mirror.json (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalverra authored Nov 29, 2023
1 parent 11362fc commit cede79f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions mirror/mirror.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
package mirror

import (
_ "embed"
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"

"github.com/smartcontractkit/chainlink-testing-framework/k8s/config"
"github.com/smartcontractkit/chainlink-testing-framework/utils/projectpath"
)

// Reads the mirror.json file into memory
//
//go:embed mirror.json
var mirrorJSON []byte

// findImageByName takes the name to search for as a string.
// It returns the name and version of the name if found, or an empty string with an error otherwise.
func findImageByName(name string) (string, error) {
// Read the mirror json file from chainlink-testing-framework/mirror/mirror.json
data, err := os.ReadFile(filepath.Join(projectpath.MirrorDir, "mirror.json"))
if err != nil {
return "", err
}

// Unmarshal the JSON data into a slice of strings
var images []string
err = json.Unmarshal(data, &images)
err := json.Unmarshal(mirrorJSON, &images)
if err != nil {
return "", err
}
Expand Down

0 comments on commit cede79f

Please sign in to comment.