diff --git a/build.go b/build.go index 1c3ba49fc..2e980a786 100644 --- a/build.go +++ b/build.go @@ -8,7 +8,6 @@ import ( "os/exec" "os/user" "path" - "runtime" "strings" "time" @@ -210,8 +209,8 @@ func (b *Builder) updateOCIConfigForOutput(sf *types.Stackerfile, s types.Storag author := fmt.Sprintf("%s@%s", username, host) meta.Created = time.Now() - meta.Architecture = runtime.GOARCH - meta.OS = runtime.GOOS + meta.Architecture = *l.Arch + meta.OS = *l.OS meta.Author = author annotations, err := mutator.Annotations(context.Background()) diff --git a/cache_test.go b/cache_test.go index bb09249f5..a6df77f09 100644 --- a/cache_test.go +++ b/cache_test.go @@ -126,5 +126,5 @@ func TestCacheEntryChanged(t *testing.T) { // This test works because the type information is included in the // hashstructure hash above, so using a zero valued CacheEntry is // enough to capture changes in types. - assert.Equal(uint64(0x98ab47c70ff0b70), h) + assert.Equal(uint64(0x1ec739cbb7ee4e77), h) } diff --git a/doc/stacker_yaml.md b/doc/stacker_yaml.md index 11d69e715..7530fde0a 100644 --- a/doc/stacker_yaml.md +++ b/doc/stacker_yaml.md @@ -233,3 +233,14 @@ While `config` section supports a similar `labels`, it is more pertitent to the image runtime. On the other hand, `annotations` is intended to be image-specific metadata aligned with the [annotations in the image spec](https://github.com/opencontainers/image-spec/blob/main/annotations.md). + +##### `os` + +`os` is a user-specified string value indicating which _operating system_ this image is being +built for, for example, `linux`, `darwin`, etc. It is an optional field and it +defaults to the host operating system if not specified. + +##### `arch` +`arch` is a user-specified string value indicating which machine _architecture_ this image is being +built for, for example, `amd64`, `arm64`, etc. It is an optional field and it +defaults to the host machine architecture if not specified. diff --git a/test/multi-arch.bats b/test/multi-arch.bats new file mode 100644 index 000000000..3755b0d5f --- /dev/null +++ b/test/multi-arch.bats @@ -0,0 +1,44 @@ +load helpers + +function setup() { + stacker_setup +} + +function teardown() { + cleanup +} + +@test "multi-arch/os support" { + cat > stacker.yaml < stacker.yaml <