Skip to content

Commit

Permalink
Merge pull request #162 from DamianZaremba/fix-config-archs-support
Browse files Browse the repository at this point in the history
Fix config `archs` support
  • Loading branch information
kaniini authored Apr 3, 2022
2 parents c3aa34a + 59398a7 commit ee094e7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
12 changes: 12 additions & 0 deletions examples/alpine-386_amd64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
contents:
repositories:
- https://dl-cdn.alpinelinux.org/alpine/edge/main
packages:
- alpine-base

entrypoint:
command: /bin/sh -l

archs:
- amd64
- 386
11 changes: 11 additions & 0 deletions examples/alpine-amd64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
contents:
repositories:
- https://dl-cdn.alpinelinux.org/alpine/edge/main
packages:
- alpine-base

entrypoint:
command: /bin/sh -l

archs:
- amd64
10 changes: 10 additions & 0 deletions pkg/build/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ type Architecture struct{ s string }

func (a Architecture) String() string { return a.s }

func (a *Architecture) UnmarshalYAML(unmarshal func(interface{}) error) error {
var buf string
if err := unmarshal(&buf); err != nil {
return err
}

a.s = ParseArchitecture(buf).s
return nil
}

var (
_386 = Architecture{"386"}
amd64 = Architecture{"amd64"}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func PublishCmd(ctx context.Context, outputRefs string, archs []types.Architectu
workDir := bc.Options.WorkDir
imgs := map[types.Architecture]coci.SignedImage{}

for _, arch := range archs {
for _, arch := range bc.ImageConfiguration.Archs {
arch := arch
bc := *bc

Expand Down

0 comments on commit ee094e7

Please sign in to comment.