Projects STRLCPY grype Commits f0a09c0b
🤬
  • Install skopeo during bootstrap (#1260)

    The "make integration" target assumes that skopeo will be available on
    PATH, but this wasn't documented. Install it during bootstrap when other
    utilities are installed. (See ./test/integration/utils_test.go:50).
    Include a sample skopeo policy.json, otherwise skopeo will look for a
    missing policy doc a /etc/containers/policy.json and exit with an error.
    The sample policy document matches the one included by default with
    "brew install skopeo".
    
    Signed-off-by: Will Murphy <[email protected]>
    Co-authored-by: Will Murphy <[email protected]>
  • Loading...
  • William Murphy committed with GitHub 1 year ago
    f0a09c0b
    1 parent aa52d673
  • ■ ■ ■ ■ ■ ■
    Makefile
    skipped 17 lines
    18 18  YAJSV_VERSION := v1.4.1
    19 19  QUILL_VERSION := v0.2.0
    20 20  GLOW_VERSION := v1.5.0
     21 +SKOPEO_VERSION := v1.12.0
    21 22   
    22 23  # Formatting variables ############################
    23 24  BOLD := $(shell tput -T linux bold)
    skipped 93 lines
    117 118   GOBIN="$(realpath $(TEMP_DIR))" go install github.com/rinchsan/gosimports/cmd/gosimports@$(GOSIMPORTS_VERSION)
    118 119   GOBIN="$(realpath $(TEMP_DIR))" go install github.com/neilpa/yajsv@$(YAJSV_VERSION)
    119 120   GOBIN="$(realpath $(TEMP_DIR))" go install github.com/charmbracelet/glow@$(GLOW_VERSION)
     121 + GOBIN="$(realpath $(TEMP_DIR))" CGO_ENABLED=0 GO_DYN_FLAGS="" go install -tags "containers_image_openpgp" github.com/containers/skopeo/cmd/skopeo@$(SKOPEO_VERSION)
    120 122   
    121 123  .PHONY: bootstrap-go
    122 124  bootstrap-go:
    skipped 233 lines
  • ■ ■ ■ ■ ■ ■
    test/integration/test-fixtures/skopeo-policy.json
     1 +{
     2 + "default": [
     3 + {
     4 + "type": "insecureAcceptAnything"
     5 + }
     6 + ],
     7 + "transports": {
     8 + "docker-daemon": {
     9 + "": [
     10 + {
     11 + "type": "insecureAcceptAnything"
     12 + }
     13 + ]
     14 + }
     15 + }
     16 +}
     17 + 
  • ■ ■ ■ ■ ■ ■
    test/integration/utils_test.go
    skipped 6 lines
    7 7   "os/exec"
    8 8   "path/filepath"
    9 9   "regexp"
     10 + "strings"
    10 11   "testing"
    11 12   
    12 13   "github.com/scylladb/go-set/strset"
    skipped 33 lines
    46 47  func saveImage(t testing.TB, imageName string, destPath string) {
    47 48   sourceImage := fmt.Sprintf("docker://docker.io/%s", imageName)
    48 49   destinationString := fmt.Sprintf("docker-archive:%s", destPath)
     50 + skopeoPath := filepath.Join(repoRoot(t), ".tmp", "skopeo")
     51 + policyPath := filepath.Join(repoRoot(t), "test", "integration", "test-fixtures", "skopeo-policy.json")
    49 52   
    50  - cmd := exec.Command("skopeo", "copy", "--override-os", "linux", sourceImage, destinationString)
     53 + skopeoCommand := []string{
     54 + "--policy", policyPath,
     55 + "copy", "--override-os", "linux", sourceImage, destinationString,
     56 + }
     57 + 
     58 + cmd := exec.Command(skopeoPath, skopeoCommand...)
    51 59   
    52 60   out, err := cmd.Output()
    53 61   if err != nil {
    skipped 48 lines
    102 110   return s
    103 111  }
    104 112   
     113 +func repoRoot(tb testing.TB) string {
     114 + tb.Helper()
     115 + root, err := exec.Command("git", "rev-parse", "--show-toplevel").Output()
     116 + if err != nil {
     117 + tb.Fatalf("unable to find repo root dir: %+v", err)
     118 + }
     119 + absRepoRoot, err := filepath.Abs(strings.TrimSpace(string(root)))
     120 + if err != nil {
     121 + tb.Fatal("unable to get abs path to repo root:", err)
     122 + }
     123 + return absRepoRoot
     124 +}
     125 + 
Please wait...
Page is in error, reload to recover