Download this file
| 1 | package release |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "crypto/ed25519" |
| 6 | "os" |
| 7 | |
| 8 | "github.com/carlosframework/platform/internal/registry" |
| 9 | ) |
| 10 | |
| 11 | func StageSignedHead(ctx context.Context, s Store, pub ed25519.PublicKey, ratchet *DigestRatchet, optDir string, rt registry.Route) (*ChannelPointer, *Manifest, error) { |
| 12 | p, err := Channel(ctx, s, pub, rt.Account, rt.App, rt.Channel) |
| 13 | if err != nil { |
| 14 | return nil, nil, err |
| 15 | } |
| 16 | if err := ratchet.Admit(rt.Account, p); err != nil { |
| 17 | return nil, nil, err |
| 18 | } |
| 19 | m, err := ensureStagedDigest(ctx, s, optDir, rt.Account, rt.App, p.Version, rt.Host, p.DigestOf(p.Version), stageCheck{}) |
| 20 | if err != nil { |
| 21 | return nil, nil, err |
| 22 | } |
| 23 | if m == nil || m.Kind != "binary" || m.Artifacts[adoptPlatform].SHA256 == "" { |
| 24 | return nil, nil, os.ErrPermission |
| 25 | } |
| 26 | return p, m, nil |
| 27 | } |
| 28 | |