Skip to content

Commit

Permalink
Don't put artifacts in a build/ subdirectory (#115)
Browse files Browse the repository at this point in the history
When the user says "--output mydir" they really expect the artifacts to
be in `mydir`, not in `mydir/build`.

See also:

- kairos-io/osbuilder#192 (comment)
- kairos-io/kairos-docs#311 (comment)

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
  • Loading branch information
jimmykarily authored Nov 15, 2024
1 parent cd35f2c commit 27eba1c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion deployer/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (d *Deployer) tmpRootFs() string {
}

func (d *Deployer) destination() string {
return d.Config.StateDir("build")
return d.Config.State
}

func (d *Deployer) isoFile() string {
Expand Down
2 changes: 1 addition & 1 deletion examples/airgap/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ docker run -v $PWD/config.yaml:/config.yaml \
--set "flavor=fedora" \
--set "repository=kairos-io/provider-kairos"

echo "Custom ISO ready at $PWD/build/build/kairos.iso.custom.iso"
echo "Custom ISO ready at $PWD/build/kairos.iso.custom.iso"
2 changes: 1 addition & 1 deletion examples/airgap/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ docker run -v $PWD/config.yaml:/config.yaml \
--cloud-config /config.yaml \
--set "state_dir=/tmp/auroraboot"

echo "Custom ISO ready at $PWD/build/build/kairos.iso"
echo "Custom ISO ready at $PWD/build/kairos.iso"
4 changes: 2 additions & 2 deletions tests/e2e/arm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var _ = Describe("ARM image generation", Label("arm"), func() {
Expect(out).To(ContainSubstring("done"), out)
Expect(out).To(ContainSubstring("build-arm-image"), out)
Expect(err).ToNot(HaveOccurred())
_, err = os.Stat(filepath.Join(tempDir, "build/build/disk.img"))
_, err = os.Stat(filepath.Join(tempDir, "build/disk.img"))
Expect(err).ToNot(HaveOccurred())
})

Expand All @@ -60,7 +60,7 @@ var _ = Describe("ARM image generation", Label("arm"), func() {
Expect(out).ToNot(ContainSubstring("build-arm-image"), out)
Expect(out).To(ContainSubstring("prepare_arm"), out)
Expect(err).ToNot(HaveOccurred())
_, err = os.Stat(filepath.Join(tempDir, "build/build/efi.img"))
_, err = os.Stat(filepath.Join(tempDir, "build/efi.img"))
Expect(err).ToNot(HaveOccurred())
})
})
Expand Down
18 changes: 9 additions & 9 deletions tests/e2e/disks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var _ = Describe("Disk image generation", Label("raw-disks"), func() {
Expect(out).To(ContainSubstring("extract-squashfs"), out)
Expect(out).ToNot(ContainSubstring("dump-source"), out)
Expect(err).ToNot(HaveOccurred(), out)
_, err = os.Stat(filepath.Join(tempDir, "build/build/disk.raw"))
_, err = os.Stat(filepath.Join(tempDir, "build/disk.raw"))
Expect(err).ToNot(HaveOccurred())
})

Expand All @@ -67,7 +67,7 @@ var _ = Describe("Disk image generation", Label("raw-disks"), func() {
Expect(out).To(ContainSubstring("extract-squashfs"), out)
Expect(out).ToNot(ContainSubstring("dump-source"), out)
Expect(err).ToNot(HaveOccurred(), out)
_, err = os.Stat(filepath.Join(tempDir, "build/build/disk.raw.gce"))
_, err = os.Stat(filepath.Join(tempDir, "build/disk.raw.gce"))
Expect(err).ToNot(HaveOccurred())
})

Expand All @@ -89,7 +89,7 @@ var _ = Describe("Disk image generation", Label("raw-disks"), func() {
Expect(out).To(ContainSubstring("extract-squashfs"), out)
Expect(out).ToNot(ContainSubstring("dump-source"), out)
Expect(err).ToNot(HaveOccurred(), out)
_, err = os.Stat(filepath.Join(tempDir, "build/build/disk.raw.vhd"))
_, err = os.Stat(filepath.Join(tempDir, "build/disk.raw.vhd"))
Expect(err).ToNot(HaveOccurred())
})

Expand All @@ -111,7 +111,7 @@ var _ = Describe("Disk image generation", Label("raw-disks"), func() {
// Expect(out).To(ContainSubstring("extract-squashfs"), out)
// Expect(out).ToNot(ContainSubstring("dump-source"), out)
// Expect(err).ToNot(HaveOccurred(), out)
// _, err = os.Stat(filepath.Join(tempDir, "build/build/disk.raw.gce"))
// _, err = os.Stat(filepath.Join(tempDir, "build/disk.raw.gce"))
// Expect(err).ToNot(HaveOccurred())
// })
})
Expand Down Expand Up @@ -170,7 +170,7 @@ stages:
os.RemoveAll(tempDir)
})

It("generate a raw build/build/disk.raw (EFI) file", Label("efi"), func() {
It("generate a raw build/disk.raw (EFI) file", Label("efi"), func() {
image := "quay.io/kairos/opensuse:tumbleweed-core-amd64-generic-v3.2.1"
_, err := PullImage(image)
Expect(err).ToNot(HaveOccurred())
Expand All @@ -186,7 +186,7 @@ stages:
Expect(out).To(ContainSubstring("gen-raw-disk"), out)
Expect(out).To(ContainSubstring("dump-source"), out)
Expect(err).ToNot(HaveOccurred(), out)
_, err = os.Stat(filepath.Join(tempDir, "build/build/disk.raw"))
_, err = os.Stat(filepath.Join(tempDir, "build/disk.raw"))
Expect(err).ToNot(HaveOccurred())
})

Expand All @@ -207,7 +207,7 @@ stages:
Expect(out).To(ContainSubstring("convert-gce"), out)
Expect(out).To(ContainSubstring("dump-source"), out)
Expect(err).ToNot(HaveOccurred(), out)
_, err = os.Stat(filepath.Join(tempDir, "build/build/disk.raw.gce"))
_, err = os.Stat(filepath.Join(tempDir, "build/disk.raw.gce"))
Expect(err).ToNot(HaveOccurred())
})

Expand All @@ -228,7 +228,7 @@ stages:
Expect(out).To(ContainSubstring("convert-vhd"), out)
Expect(out).To(ContainSubstring("dump-source"), out)
Expect(err).ToNot(HaveOccurred(), out)
_, err = os.Stat(filepath.Join(tempDir, "build/build/disk.raw.vhd"))
_, err = os.Stat(filepath.Join(tempDir, "build/disk.raw.vhd"))
Expect(err).ToNot(HaveOccurred())
})

Expand All @@ -249,7 +249,7 @@ stages:
Expect(out).To(ContainSubstring("gen-raw-mbr-disk"), out)
Expect(out).To(ContainSubstring("dump-source"), out)
Expect(err).ToNot(HaveOccurred(), out)
_, err = os.Stat(filepath.Join(tempDir, "build/build/disk.raw"))
_, err = os.Stat(filepath.Join(tempDir, "build/disk.raw"))
Expect(err).ToNot(HaveOccurred())
})
})
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/iso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var _ = Describe("ISO image generation", Label("iso"), func() {
Expect(out).To(ContainSubstring("gen-iso"), out)
Expect(out).ToNot(ContainSubstring("build-arm-image"), out)
Expect(err).ToNot(HaveOccurred())
_, err = os.Stat(filepath.Join(tempDir, "build/build/kairos.iso"))
_, err = os.Stat(filepath.Join(tempDir, "build/kairos.iso"))
Expect(err).ToNot(HaveOccurred())
})

Expand Down Expand Up @@ -75,7 +75,7 @@ var _ = Describe("ISO image generation", Label("iso"), func() {
Expect(out).To(ContainSubstring("inject-cloud-config"), out)
Expect(out).ToNot(ContainSubstring("build-arm-image"), out)
Expect(err).ToNot(HaveOccurred())
_, err = os.Stat(filepath.Join(tempDir, "build/build/kairos.iso.custom.iso"))
_, err = os.Stat(filepath.Join(tempDir, "build/kairos.iso.custom.iso"))
Expect(err).ToNot(HaveOccurred())
})
})
Expand Down

0 comments on commit 27eba1c

Please sign in to comment.