Skip to content

feat!: drop support for '->' artwork #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.yaml
Original file line number Diff line number Diff line change
@@ -79,7 +79,8 @@ build:
type: built
tag: build-env
binds:
- . -> /stacker-tree
- source: .
dest: /stacker-tree
run: |
#!/bin/sh
# golang wants somewhere to put its garbage
77 changes: 0 additions & 77 deletions pkg/types/layer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package types

import (
"encoding/json"
"fmt"
"io/fs"
"os"
@@ -192,82 +191,6 @@ type Bind struct {

type Binds []Bind

func (bs *Bind) MarshalJSON() ([]byte, error) {
var sb strings.Builder
if bs.Dest == "" {
sb.WriteString(fmt.Sprintf("%q", bs.Source))
} else {
var sbt strings.Builder
sbt.WriteString(fmt.Sprintf("%s -> %s", bs.Source, bs.Dest))
sb.WriteString(fmt.Sprintf("%q", sbt.String()))
}

return []byte(sb.String()), nil
}

func (bs *Binds) UnmarshalJSON(data []byte) error {
var rawBinds []string

if err := json.Unmarshal(data, &rawBinds); err != nil {
return err
}

*bs = Binds{}
for _, bind := range rawBinds {
parts := strings.Split(bind, "->")
if len(parts) != 1 && len(parts) != 2 {
return errors.Errorf("invalid bind mount %s", bind)
}

source := strings.TrimSpace(parts[0])
target := source

if len(parts) == 2 {
target = strings.TrimSpace(parts[1])
}

*bs = append(*bs, Bind{Source: source, Dest: target})
}

return nil
}

func (bs *Binds) UnmarshalYAML(unmarshal func(interface{}) error) error {
var data interface{}
err := unmarshal(&data)
if err != nil {
return errors.WithStack(err)
}

xform := func(s string) ([]string, error) {
return []string{s}, nil
}

rawBinds, err := getStringOrStringSlice(data, xform)
if err != nil {
return err
}

*bs = Binds{}
for _, bind := range rawBinds {
parts := strings.Split(bind, "->")
if len(parts) != 1 && len(parts) != 2 {
return errors.Errorf("invalid bind mount %s", bind)
}

source := strings.TrimSpace(parts[0])
target := source

if len(parts) == 2 {
target = strings.TrimSpace(parts[1])
}

*bs = append(*bs, Bind{Source: source, Dest: target})
}

return nil
}

type Layer struct {
From ImageSource `yaml:"from" json:"from"`
Imports Imports `yaml:"import" json:"import,omitempty"`