INNER CODE UNIT · Go

checkUpstream

werf/nelm · scripts/schemagen/main.go:194

func checkUpstream(ctx context.Context, client *http.Client, opts options) error {
	indexPath := filepath.Join(opts.outputDir, indexFileName)

	index := readExistingIndex(indexPath)
	if index == nil || index.CRDs == nil || index.Kubernetes == nil {
		return fmt.Errorf("%s is missing or incomplete, run: task generate:validation-schemas", indexPath)
	}

	var stale []string

	crdsCommit, err := resolveCommit(ctx, client, index.CRDs.UpstreamRepo, index.CRDs.UpstreamRef)
	if err != nil {
		return fmt.Errorf("resolve %s of %s: %w", index.CRDs.UpstreamRef, index.CRDs.UpstreamRepo, err)
	}

	if crdsCommit != index.CRDs.UpstreamCommit {
		stale = append(stale, fmt.Sprintf("the CRD catalog moved from %s to %s", index.CRDs.UpstreamCommit[:7], crdsCommit[:7]))
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…