mirror of
https://github.com/containers/skopeo.git
synced 2026-05-17 20:42:29 +00:00
Merge pull request #27 from rhatdan/name
Remove all --name and --root options
This commit is contained in:
@@ -8,15 +8,6 @@ import (
|
||||
|
||||
var (
|
||||
addFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "name",
|
||||
Usage: "`name or ID` of the working container",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "root",
|
||||
Usage: "root `directory` of working container, Default: EnvVar(BUILDAHROOT)",
|
||||
EnvVar: "BUILDAHROOT",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "dest",
|
||||
Usage: "destination `directory` (if absolute) or subdirectory of the working directory (if relative) in the working container's filesystem",
|
||||
@@ -29,29 +20,23 @@ var (
|
||||
|
||||
func addAndCopyCmd(c *cli.Context, extractLocalArchives bool) error {
|
||||
args := c.Args()
|
||||
name := ""
|
||||
if c.IsSet("name") {
|
||||
name = c.String("name")
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("container ID must be specified")
|
||||
}
|
||||
root := c.String("root")
|
||||
name := args[0]
|
||||
args = args.Tail()
|
||||
|
||||
dest := ""
|
||||
if c.IsSet("dest") {
|
||||
dest = c.String("dest")
|
||||
}
|
||||
if name == "" && root == "" {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("either a container name or --root, or some combination, must be specified")
|
||||
}
|
||||
name = args[0]
|
||||
args = args.Tail()
|
||||
}
|
||||
|
||||
store, err := getStore(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
builder, err := openBuilder(store, name, root)
|
||||
builder, err := openBuilder(store, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading build container %q: %v", name, err)
|
||||
}
|
||||
|
||||
@@ -11,23 +11,10 @@ import (
|
||||
|
||||
var (
|
||||
commitFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "name",
|
||||
Usage: "`name or ID` of the working container",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "root",
|
||||
Usage: "root `directory` of the working container",
|
||||
EnvVar: "BUILDAHROOT",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "disable-compression",
|
||||
Usage: "don't compress layers",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "output",
|
||||
Usage: "`name` of output image to write",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "signature-policy",
|
||||
Usage: "`pathname` of signature policy file (not usually used)",
|
||||
@@ -38,16 +25,19 @@ var (
|
||||
|
||||
func commitCmd(c *cli.Context) error {
|
||||
args := c.Args()
|
||||
name := ""
|
||||
if c.IsSet("name") {
|
||||
name = c.String("name")
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("container ID must be specified")
|
||||
}
|
||||
root := c.String("root")
|
||||
name := args[0]
|
||||
args = args.Tail()
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("an image name must be specified")
|
||||
}
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments specified")
|
||||
}
|
||||
image := args[0]
|
||||
|
||||
output := ""
|
||||
if c.IsSet("output") {
|
||||
output = c.String("output")
|
||||
}
|
||||
signaturePolicy := ""
|
||||
if c.IsSet("signature-policy") {
|
||||
signaturePolicy = c.String("signature-policy")
|
||||
@@ -56,34 +46,19 @@ func commitCmd(c *cli.Context) error {
|
||||
if !c.IsSet("disable-compression") || !c.Bool("disable-compression") {
|
||||
compress = archive.Gzip
|
||||
}
|
||||
if name == "" && root == "" {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("either a container name or --root, or some combination, must be specified")
|
||||
}
|
||||
name = args[0]
|
||||
args = args.Tail()
|
||||
}
|
||||
if output == "" {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("an image name or the --output flag must be specified")
|
||||
}
|
||||
output = args[0]
|
||||
args = args.Tail()
|
||||
}
|
||||
|
||||
store, err := getStore(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
builder, err := openBuilder(store, name, root)
|
||||
builder, err := openBuilder(store, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading build container %q: %v", name, err)
|
||||
}
|
||||
|
||||
dest, err := alltransports.ParseImageName(output)
|
||||
dest, err := alltransports.ParseImageName(image)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing target image name %q: %v", output, err)
|
||||
return fmt.Errorf("error parsing target image name %q: %v", image, err)
|
||||
}
|
||||
|
||||
options := buildah.CommitOptions{
|
||||
@@ -92,7 +67,7 @@ func commitCmd(c *cli.Context) error {
|
||||
}
|
||||
err = builder.Commit(dest, options)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error committing container %q to %q: %v", builder.Container, output, err)
|
||||
return fmt.Errorf("error committing container %q to %q: %v", builder.Container, image, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -32,7 +32,7 @@ func getStore(c *cli.Context) (storage.Store, error) {
|
||||
return store, err
|
||||
}
|
||||
|
||||
func openBuilder(store storage.Store, name, root string) (builder *buildah.Builder, err error) {
|
||||
func openBuilder(store storage.Store, name string) (builder *buildah.Builder, err error) {
|
||||
if name != "" {
|
||||
builder, err = buildah.OpenBuilder(store, name)
|
||||
if os.IsNotExist(err) {
|
||||
@@ -42,9 +42,6 @@ func openBuilder(store storage.Store, name, root string) (builder *buildah.Build
|
||||
builder, err = buildah.ImportBuilder(store, options)
|
||||
}
|
||||
}
|
||||
if root != "" {
|
||||
builder, err = buildah.OpenBuilderByPath(store, root)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error reading build container: %v", err)
|
||||
}
|
||||
|
||||
@@ -18,15 +18,6 @@ const (
|
||||
|
||||
var (
|
||||
configFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "name",
|
||||
Usage: "`name or ID` of the working container",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "root",
|
||||
Usage: "root `directory` of the working container",
|
||||
EnvVar: "BUILDAHROOT",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "author",
|
||||
Usage: "image author contact `information`",
|
||||
@@ -167,25 +158,20 @@ func updateConfig(builder *buildah.Builder, c *cli.Context) {
|
||||
|
||||
func configCmd(c *cli.Context) error {
|
||||
args := c.Args()
|
||||
name := ""
|
||||
if c.IsSet("name") {
|
||||
name = c.String("name")
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("container ID must be specified")
|
||||
}
|
||||
root := c.String("root")
|
||||
if name == "" && root == "" {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("either a container name or --root, or some combination, must be specified")
|
||||
}
|
||||
name = args[0]
|
||||
args = args.Tail()
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments specified")
|
||||
}
|
||||
name := args[0]
|
||||
|
||||
store, err := getStore(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
builder, err := openBuilder(store, name, root)
|
||||
builder, err := openBuilder(store, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading build container %q: %v", name, err)
|
||||
}
|
||||
|
||||
@@ -7,41 +7,25 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
deleteFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "name",
|
||||
Usage: "`name or ID` of the working container",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "root",
|
||||
Usage: "root `directory` of the working container",
|
||||
EnvVar: "BUILDAHROOT",
|
||||
},
|
||||
}
|
||||
deleteDescription = "Deletes a working container, unmounting it if necessary"
|
||||
)
|
||||
|
||||
func deleteCmd(c *cli.Context) error {
|
||||
args := c.Args()
|
||||
name := ""
|
||||
if c.IsSet("name") {
|
||||
name = c.String("name")
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("container ID must be specified")
|
||||
}
|
||||
root := c.String("root")
|
||||
if name == "" && root == "" {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("either a container name or --root, or some combination, must be specified")
|
||||
}
|
||||
name = args[0]
|
||||
args = args.Tail()
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments specified")
|
||||
}
|
||||
name := args[0]
|
||||
|
||||
store, err := getStore(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
builder, err := openBuilder(store, name, root)
|
||||
builder, err := openBuilder(store, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading build container %q: %v", name, err)
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ func main() {
|
||||
Name: "mount",
|
||||
Usage: "Mount a working container's filesystem root",
|
||||
Description: mountDescription,
|
||||
Flags: mountFlags,
|
||||
Action: mountCmd,
|
||||
ArgsUsage: "CONTAINER-NAME-OR-ID",
|
||||
},
|
||||
@@ -96,7 +95,6 @@ func main() {
|
||||
Aliases: []string{"unmount"},
|
||||
Usage: "Unmount a working container's filesystem root",
|
||||
Description: umountDescription,
|
||||
Flags: umountFlags,
|
||||
Action: umountCmd,
|
||||
ArgsUsage: "CONTAINER-NAME-OR-ID",
|
||||
},
|
||||
@@ -144,7 +142,6 @@ func main() {
|
||||
Name: "delete",
|
||||
Usage: "Delete a working container",
|
||||
Description: deleteDescription,
|
||||
Flags: deleteFlags,
|
||||
Action: deleteCmd,
|
||||
ArgsUsage: "CONTAINER-NAME-OR-ID",
|
||||
},
|
||||
|
||||
@@ -7,41 +7,25 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
mountFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "name",
|
||||
Usage: "`name or ID` of the working container",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "root",
|
||||
Usage: "root `directory` of the working container",
|
||||
EnvVar: "BUILDAHROOT",
|
||||
},
|
||||
}
|
||||
mountDescription = "Mounts a working container's root filesystem for manipulation"
|
||||
)
|
||||
|
||||
func mountCmd(c *cli.Context) error {
|
||||
args := c.Args()
|
||||
name := ""
|
||||
if c.IsSet("name") {
|
||||
name = c.String("name")
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("container ID must be specified")
|
||||
}
|
||||
root := c.String("root")
|
||||
if name == "" && root == "" {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("either a container name or --root, or some combination, must be specified")
|
||||
}
|
||||
name = args[0]
|
||||
args = args.Tail()
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments specified")
|
||||
}
|
||||
name := args[0]
|
||||
|
||||
store, err := getStore(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
builder, err := openBuilder(store, name, root)
|
||||
builder, err := openBuilder(store, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading build container %q: %v", name, err)
|
||||
}
|
||||
|
||||
@@ -13,15 +13,6 @@ import (
|
||||
|
||||
var (
|
||||
runFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "name",
|
||||
Usage: "`name or ID` of the working container",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "root",
|
||||
Usage: "root `directory` of the working container",
|
||||
EnvVar: "BUILDAHROOT",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "runtime",
|
||||
Usage: "`path` to an alternate runtime",
|
||||
@@ -37,12 +28,12 @@ var (
|
||||
|
||||
func runCmd(c *cli.Context) error {
|
||||
args := c.Args()
|
||||
name := ""
|
||||
if c.IsSet("name") {
|
||||
name = c.String("name")
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("container ID must be specified")
|
||||
}
|
||||
name := args[0]
|
||||
args = args.Tail()
|
||||
|
||||
root := c.String("root")
|
||||
runtime := ""
|
||||
if c.IsSet("runtime") {
|
||||
runtime = c.String("runtime")
|
||||
@@ -54,20 +45,13 @@ func runCmd(c *cli.Context) error {
|
||||
if c.IsSet("runtime") {
|
||||
runtime = c.String("runtime")
|
||||
}
|
||||
if name == "" && root == "" {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("either a container name or --root, or some combination, must be specified")
|
||||
}
|
||||
name = args[0]
|
||||
args = args.Tail()
|
||||
}
|
||||
|
||||
store, err := getStore(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
builder, err := openBuilder(store, name, root)
|
||||
builder, err := openBuilder(store, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading build container %q: %v", name, err)
|
||||
}
|
||||
|
||||
@@ -7,41 +7,25 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
umountFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "name",
|
||||
Usage: "`name or ID` of the working container",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "root",
|
||||
Usage: "root `directory` of the working container",
|
||||
EnvVar: "BUILDAHROOT",
|
||||
},
|
||||
}
|
||||
umountDescription = "Unmounts a working container's root filesystem"
|
||||
)
|
||||
|
||||
func umountCmd(c *cli.Context) error {
|
||||
args := c.Args()
|
||||
name := ""
|
||||
if c.IsSet("name") {
|
||||
name = c.String("name")
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("container ID must be specified")
|
||||
}
|
||||
root := c.String("root")
|
||||
if name == "" && root == "" {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("either a container name or --root, or some combination, must be specified")
|
||||
}
|
||||
name = args[0]
|
||||
args = args.Tail()
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("too many arguments specified")
|
||||
}
|
||||
name := args[0]
|
||||
|
||||
store, err := getStore(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
builder, err := openBuilder(store, name, root)
|
||||
builder, err := openBuilder(store, name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading build container %q: %v", name, err)
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ container1=`buildah from --image ${1:-ubuntu}`
|
||||
read
|
||||
: "[1m Mount that working container, and capture the mountpoint [0m"
|
||||
read
|
||||
echo '[mountpoint1=`buildah mount --name $container1`]'
|
||||
mountpoint1=`buildah mount --name $container1`
|
||||
echo '[mountpoint1=`buildah mount $container1`]'
|
||||
mountpoint1=`buildah mount $container1`
|
||||
read
|
||||
: "[1m Add a file to the container [0m"
|
||||
read
|
||||
@@ -24,7 +24,7 @@ echo yay > $mountpoint1/file-in-root
|
||||
read
|
||||
: "[1m Produce an image from the container [0m"
|
||||
read
|
||||
buildah commit --name "$container1" --output containers-storage:${2:-first-new-image}
|
||||
buildah commit "$container1" --output containers-storage:${2:-first-new-image}
|
||||
read
|
||||
: "[1m Verify that our new image is there [0m"
|
||||
read
|
||||
@@ -32,8 +32,8 @@ ocic image list
|
||||
read
|
||||
: "[1m Unmount our working container and delete it [0m"
|
||||
read
|
||||
buildah umount --name "$container1"
|
||||
buildah delete --name "$container1"
|
||||
buildah umount "$container1"
|
||||
buildah delete "$container1"
|
||||
read
|
||||
: "[1m Now try it with ocid not running! [0m"
|
||||
read
|
||||
@@ -46,8 +46,8 @@ container2=`buildah from --image=${2:-first-new-image}`
|
||||
read
|
||||
: "[1m Mount that new working container, and capture the mountpoint [0m"
|
||||
read
|
||||
echo '[mountpoint2=`buildah mount --name $container2`]'
|
||||
mountpoint2=`buildah mount --name $container2`
|
||||
echo '[mountpoint2=`buildah mount $container2`]'
|
||||
mountpoint2=`buildah mount $container2`
|
||||
read
|
||||
: "[1m That file we added to the image is there, right? [0m"
|
||||
read
|
||||
@@ -60,12 +60,12 @@ echo yay > $mountpoint2/another-file-in-root
|
||||
read
|
||||
: "[1m Produce an image from the new container[0m"
|
||||
read
|
||||
buildah commit --name "$container2" --output containers-storage:${3:-second-new-image}
|
||||
buildah commit "$container2" --output containers-storage:${3:-second-new-image}
|
||||
read
|
||||
: "[1m Unmount our new working container and delete it [0m"
|
||||
read
|
||||
buildah umount --name "$container2"
|
||||
buildah delete --name "$container2"
|
||||
buildah umount "$container2"
|
||||
buildah delete "$container2"
|
||||
read
|
||||
: "[1m Verify that our new new image is there[0m"
|
||||
read
|
||||
|
||||
@@ -18,8 +18,8 @@ container1=`buildah from --pull --image ${1:-alpine}`
|
||||
read
|
||||
: "[1m Mount that working container, and capture the mountpoint [0m"
|
||||
read
|
||||
echo '[mountpoint1=`buildah mount --name $container1`]'
|
||||
mountpoint1=`buildah mount --name $container1`
|
||||
echo '[mountpoint1=`buildah mount $container1`]'
|
||||
mountpoint1=`buildah mount $container1`
|
||||
read
|
||||
: "[1m List random files in the container [0m"
|
||||
read
|
||||
@@ -28,38 +28,38 @@ find $mountpoint1 -name "random*"
|
||||
read
|
||||
: "[1m Ensure the default destination for copying files is / [0m"
|
||||
read
|
||||
echo '[buildah config --name $container1 --workingdir /]'
|
||||
buildah config --name $container1 --workingdir /
|
||||
echo '[buildah config $container1 --workingdir /]'
|
||||
buildah config $container1 --workingdir /
|
||||
read
|
||||
: "[1m Add a file to the container [0m"
|
||||
read
|
||||
echo '[dd if=/dev/urandom of=random1 bs=512 count=1]'
|
||||
echo '[buildah copy --name $container1 random1]'
|
||||
echo '[buildah copy $container1 random1]'
|
||||
dd if=/dev/urandom of=random1 bs=512 count=1
|
||||
buildah copy --name $container1 random1
|
||||
buildah copy $container1 random1
|
||||
read
|
||||
: "[1m Change the default destination for copying files [0m"
|
||||
read
|
||||
echo '[buildah config --name $container1 --workingdir /tmp]'
|
||||
buildah config --name $container1 --workingdir /tmp
|
||||
echo '[buildah config $container1 --workingdir /tmp]'
|
||||
buildah config $container1 --workingdir /tmp
|
||||
read
|
||||
: "[1m Add another new file to the container [0m"
|
||||
read
|
||||
echo '[dd if=/dev/urandom of=random2 bs=512 count=1]'
|
||||
echo '[buildah copy --name $container1 random2]'
|
||||
echo '[buildah copy $container1 random2]'
|
||||
dd if=/dev/urandom of=random2 bs=512 count=1
|
||||
buildah copy --name $container1 random2
|
||||
buildah copy $container1 random2
|
||||
read
|
||||
: "[1m Copy a subdirectory with some files in it [0m"
|
||||
read
|
||||
echo '[mkdir -p randomsubdir]'
|
||||
echo '[dd if=/dev/urandom of=randomsubdir/random3 bs=512 count=1]'
|
||||
echo '[dd if=/dev/urandom of=randomsubdir/random4 bs=512 count=1]'
|
||||
echo '[buildah copy --name $container1 randomsubdir]'
|
||||
echo '[buildah copy $container1 randomsubdir]'
|
||||
mkdir -p randomsubdir
|
||||
dd if=/dev/urandom of=randomsubdir/random3 bs=512 count=1
|
||||
dd if=/dev/urandom of=randomsubdir/random4 bs=512 count=1
|
||||
buildah copy --name $container1 randomsubdir
|
||||
buildah copy $container1 randomsubdir
|
||||
read
|
||||
: "[1m List some of the container's contents [0m"
|
||||
read
|
||||
@@ -74,14 +74,14 @@ read
|
||||
: "[1m Copy that tarball to the container [0m"
|
||||
read
|
||||
echo '[mkdir -p $mountpoint1/tmpwatch]'
|
||||
echo '[buildah copy --name $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2]'
|
||||
echo '[buildah copy $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2]'
|
||||
mkdir -p $mountpoint1/tmpwatch
|
||||
buildah copy --name $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2
|
||||
buildah copy $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2
|
||||
read
|
||||
: "[1m Download another tarball to the container [0m"
|
||||
read
|
||||
echo '[buildah copy --name $container1 --dest /tmpwatch https://releases.pagure.org/newt/newt-0.52.19.tar.gz]'
|
||||
buildah copy --name $container1 --dest /tmpwatch https://releases.pagure.org/newt/newt-0.52.19.tar.gz
|
||||
echo '[buildah copy $container1 --dest /tmpwatch https://releases.pagure.org/newt/newt-0.52.19.tar.gz]'
|
||||
buildah copy $container1 --dest /tmpwatch https://releases.pagure.org/newt/newt-0.52.19.tar.gz
|
||||
read
|
||||
: "[1m List the contents of the target directory [0m"
|
||||
read
|
||||
@@ -90,8 +90,8 @@ find $mountpoint1/tmpwatch
|
||||
read
|
||||
: "[1m Now 'add' the downloaded tarball to the container [0m"
|
||||
read
|
||||
echo '[buildah add --name $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2]'
|
||||
buildah add --name $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2
|
||||
echo '[buildah add $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2]'
|
||||
buildah add $container1 --dest /tmpwatch tmpwatch-2.9.17.tar.bz2
|
||||
read
|
||||
: "[1m List the contents of the target directory again [0m"
|
||||
read
|
||||
@@ -100,5 +100,5 @@ find $mountpoint1/tmpwatch
|
||||
read
|
||||
: "[1m Clean up, because I ran this like fifty times while testing [0m"
|
||||
read
|
||||
echo '[buildah delete --name $container1]'
|
||||
buildah delete --name $container1
|
||||
echo '[buildah delete $container1]'
|
||||
buildah delete $container1
|
||||
|
||||
168
tests/add.bats
168
tests/add.bats
@@ -3,95 +3,95 @@
|
||||
load helpers
|
||||
|
||||
@test "add-local-plain" {
|
||||
createrandom ${TESTDIR}/randomfile
|
||||
createrandom ${TESTDIR}/other-randomfile
|
||||
createrandom ${TESTDIR}/randomfile
|
||||
createrandom ${TESTDIR}/other-randomfile
|
||||
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount --name=$cid)
|
||||
mkdir $root/subdir $root/other-subdir
|
||||
# Copy a file to the working directory
|
||||
buildah config --workingdir=/ --name=$cid
|
||||
buildah add --name=$cid ${TESTDIR}/randomfile
|
||||
# Copy a file to a specific subdirectory
|
||||
buildah add --name=$cid --dest=/subdir ${TESTDIR}/randomfile
|
||||
# Copy a file two files to a specific subdirectory
|
||||
buildah add --name=$cid --dest=/other-subdir ${TESTDIR}/randomfile ${TESTDIR}/other-randomfile
|
||||
# Copy a file two files to a specific location, which fails because it's not a directory.
|
||||
run buildah add --name=$cid --dest=/notthereyet-subdir ${TESTDIR}/randomfile ${TESTDIR}/other-randomfile
|
||||
[ $status -ne 0 ]
|
||||
run buildah add --name=$cid --dest=/randomfile ${TESTDIR}/randomfile ${TESTDIR}/other-randomfile
|
||||
[ $status -ne 0 ]
|
||||
# Copy a file to a different working directory
|
||||
buildah config --workingdir=/cwd --name=$cid
|
||||
buildah add --name=$cid ${TESTDIR}/randomfile
|
||||
buildah unmount --name=$cid
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json --name=$cid --output=containers-storage:new-image
|
||||
buildah delete --name=$cid
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount $cid)
|
||||
mkdir $root/subdir $root/other-subdir
|
||||
# Copy a file to the working directory
|
||||
buildah config --workingdir=/ $cid
|
||||
buildah add $cid ${TESTDIR}/randomfile
|
||||
# Copy a file to a specific subdirectory
|
||||
buildah add --dest=/subdir $cid ${TESTDIR}/randomfile
|
||||
# Copy a file two files to a specific subdirectory
|
||||
buildah add --dest=/other-subdir $cid ${TESTDIR}/randomfile ${TESTDIR}/other-randomfile
|
||||
# Copy a file two files to a specific location, which fails because it's not a directory.
|
||||
run buildah add --dest=/notthereyet-subdir ${TESTDIR}/randomfile ${TESTDIR}/other-randomfile $cid
|
||||
[ $status -ne 0 ]
|
||||
run buildah add --dest=/randomfile ${TESTDIR}/randomfile $cid ${TESTDIR}/other-randomfile
|
||||
[ $status -ne 0 ]
|
||||
# Copy a file to a different working directory
|
||||
buildah config --workingdir=/cwd $cid
|
||||
buildah add $cid ${TESTDIR}/randomfile
|
||||
buildah unmount $cid
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid containers-storage:new-image
|
||||
buildah delete $cid
|
||||
|
||||
newcid=$(buildah from --image new-image)
|
||||
newroot=$(buildah mount --name=$newcid)
|
||||
test -s $newroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/randomfile
|
||||
test -s $newroot/subdir/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/subdir/randomfile
|
||||
test -s $newroot/other-subdir/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/other-subdir/randomfile
|
||||
test -s $newroot/other-subdir/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $newroot/other-subdir/other-randomfile
|
||||
test -d $newroot/cwd
|
||||
test -s $newroot/cwd/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/cwd/randomfile
|
||||
buildah delete --name=$newcid
|
||||
newcid=$(buildah from --image new-image)
|
||||
newroot=$(buildah mount $newcid)
|
||||
test -s $newroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/randomfile
|
||||
test -s $newroot/subdir/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/subdir/randomfile
|
||||
test -s $newroot/other-subdir/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/other-subdir/randomfile
|
||||
test -s $newroot/other-subdir/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $newroot/other-subdir/other-randomfile
|
||||
test -d $newroot/cwd
|
||||
test -s $newroot/cwd/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/cwd/randomfile
|
||||
buildah delete $newcid
|
||||
}
|
||||
|
||||
@test "add-local-archive" {
|
||||
createrandom ${TESTDIR}/randomfile
|
||||
createrandom ${TESTDIR}/other-randomfile
|
||||
createrandom ${TESTDIR}/randomfile
|
||||
createrandom ${TESTDIR}/other-randomfile
|
||||
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount --name=$cid)
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/random1
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/random2
|
||||
tar -c -C ${TESTDIR} -f ${TESTDIR}/tarball1.tar random1 random2
|
||||
mkdir ${TESTDIR}/tarball2
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball2/tarball2.random1
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball2/tarball2.random2
|
||||
tar -c -C ${TESTDIR} -z -f ${TESTDIR}/tarball2.tar.gz tarball2
|
||||
mkdir ${TESTDIR}/tarball3
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball3/tarball3.random1
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball3/tarball3.random2
|
||||
tar -c -C ${TESTDIR} -j -f ${TESTDIR}/tarball3.tar.bz2 tarball3
|
||||
mkdir ${TESTDIR}/tarball4
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball4/tarball4.random1
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball4/tarball4.random2
|
||||
tar -c -C ${TESTDIR} -j -f ${TESTDIR}/tarball4.tar.bz2 tarball4
|
||||
# Add the files to the working directory, which should extract them all.
|
||||
buildah config --workingdir=/ --name=$cid
|
||||
buildah add --name=$cid ${TESTDIR}/tarball1.tar
|
||||
buildah add --name=$cid ${TESTDIR}/tarball2.tar.gz
|
||||
buildah add --name=$cid ${TESTDIR}/tarball3.tar.bz2
|
||||
buildah add $cid ${TESTDIR}/tarball4.tar.bz2
|
||||
buildah unmount --name=$cid
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json --name=$cid --output=containers-storage:new-image
|
||||
buildah delete --name=$cid
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount $cid)
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/random1
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/random2
|
||||
tar -c -C ${TESTDIR} -f ${TESTDIR}/tarball1.tar random1 random2
|
||||
mkdir ${TESTDIR}/tarball2
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball2/tarball2.random1
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball2/tarball2.random2
|
||||
tar -c -C ${TESTDIR} -z -f ${TESTDIR}/tarball2.tar.gz tarball2
|
||||
mkdir ${TESTDIR}/tarball3
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball3/tarball3.random1
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball3/tarball3.random2
|
||||
tar -c -C ${TESTDIR} -j -f ${TESTDIR}/tarball3.tar.bz2 tarball3
|
||||
mkdir ${TESTDIR}/tarball4
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball4/tarball4.random1
|
||||
dd if=/dev/urandom bs=1024 count=4 of=${TESTDIR}/tarball4/tarball4.random2
|
||||
tar -c -C ${TESTDIR} -j -f ${TESTDIR}/tarball4.tar.bz2 tarball4
|
||||
# Add the files to the working directory, which should extract them all.
|
||||
buildah config --workingdir=/ $cid
|
||||
buildah add $cid ${TESTDIR}/tarball1.tar
|
||||
buildah add $cid ${TESTDIR}/tarball2.tar.gz
|
||||
buildah add $cid ${TESTDIR}/tarball3.tar.bz2
|
||||
buildah add $cid ${TESTDIR}/tarball4.tar.bz2
|
||||
buildah unmount $cid
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid containers-storage:new-image
|
||||
buildah delete $cid
|
||||
|
||||
newcid=$(buildah from --image new-image)
|
||||
newroot=$(buildah mount --name=$newcid)
|
||||
test -s $newroot/random1
|
||||
cmp ${TESTDIR}/random1 $newroot/random1
|
||||
test -s $newroot/random2
|
||||
cmp ${TESTDIR}/random2 $newroot/random2
|
||||
test -s $newroot/tarball2/tarball2.random1
|
||||
cmp ${TESTDIR}/tarball2/tarball2.random1 $newroot/tarball2/tarball2.random1
|
||||
test -s $newroot/tarball2/tarball2.random2
|
||||
cmp ${TESTDIR}/tarball2/tarball2.random2 $newroot/tarball2/tarball2.random2
|
||||
test -s $newroot/tarball3/tarball3.random1
|
||||
cmp ${TESTDIR}/tarball3/tarball3.random1 $newroot/tarball3/tarball3.random1
|
||||
test -s $newroot/tarball3/tarball3.random2
|
||||
cmp ${TESTDIR}/tarball3/tarball3.random2 $newroot/tarball3/tarball3.random2
|
||||
test -s $newroot/tarball4/tarball4.random1
|
||||
cmp ${TESTDIR}/tarball4/tarball4.random1 $newroot/tarball4/tarball4.random1
|
||||
test -s $newroot/tarball4/tarball4.random2
|
||||
cmp ${TESTDIR}/tarball4/tarball4.random2 $newroot/tarball4/tarball4.random2
|
||||
buildah delete --name=$newcid
|
||||
newcid=$(buildah from --image new-image)
|
||||
newroot=$(buildah mount $newcid)
|
||||
test -s $newroot/random1
|
||||
cmp ${TESTDIR}/random1 $newroot/random1
|
||||
test -s $newroot/random2
|
||||
cmp ${TESTDIR}/random2 $newroot/random2
|
||||
test -s $newroot/tarball2/tarball2.random1
|
||||
cmp ${TESTDIR}/tarball2/tarball2.random1 $newroot/tarball2/tarball2.random1
|
||||
test -s $newroot/tarball2/tarball2.random2
|
||||
cmp ${TESTDIR}/tarball2/tarball2.random2 $newroot/tarball2/tarball2.random2
|
||||
test -s $newroot/tarball3/tarball3.random1
|
||||
cmp ${TESTDIR}/tarball3/tarball3.random1 $newroot/tarball3/tarball3.random1
|
||||
test -s $newroot/tarball3/tarball3.random2
|
||||
cmp ${TESTDIR}/tarball3/tarball3.random2 $newroot/tarball3/tarball3.random2
|
||||
test -s $newroot/tarball4/tarball4.random1
|
||||
cmp ${TESTDIR}/tarball4/tarball4.random1 $newroot/tarball4/tarball4.random1
|
||||
test -s $newroot/tarball4/tarball4.random2
|
||||
cmp ${TESTDIR}/tarball4/tarball4.random2 $newroot/tarball4/tarball4.random2
|
||||
buildah delete $newcid
|
||||
}
|
||||
|
||||
132
tests/basic.bats
132
tests/basic.bats
@@ -3,93 +3,93 @@
|
||||
load helpers
|
||||
|
||||
@test "from" {
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
buildah delete --name=$cid
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine)
|
||||
buildah delete --name=$cid
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine i-love-naming-things)
|
||||
buildah delete --name=i-love-naming-things
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
buildah delete $cid
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine)
|
||||
buildah delete $cid
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine i-love-naming-things)
|
||||
buildah delete i-love-naming-things
|
||||
}
|
||||
|
||||
@test "from-defaultpull" {
|
||||
cid=$(buildah from --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
buildah delete $cid
|
||||
cid=$(buildah from --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
buildah delete $cid
|
||||
}
|
||||
|
||||
@test "from-nopull" {
|
||||
run buildah from --pull=false --signature-policy ${TESTSDIR}/policy.json --image alpine
|
||||
[ "$status" -eq 1 ]
|
||||
run buildah from --pull=false --signature-policy ${TESTSDIR}/policy.json --image alpine
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "mount" {
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount --name=$cid)
|
||||
buildah unmount --name=$cid
|
||||
root=$(buildah mount $cid)
|
||||
buildah unmount $cid
|
||||
buildah delete --name=$cid
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount $cid)
|
||||
buildah unmount $cid
|
||||
root=$(buildah mount $cid)
|
||||
buildah unmount $cid
|
||||
buildah delete $cid
|
||||
}
|
||||
|
||||
@test "by-name" {
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine --name=alpine-working-image-for-test)
|
||||
root=$(buildah mount --name=alpine-working-image-for-test)
|
||||
buildah unmount --name=alpine-working-image-for-test
|
||||
buildah delete --name=alpine-working-image-for-test
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine alpine-working-image-for-test)
|
||||
root=$(buildah mount alpine-working-image-for-test)
|
||||
buildah unmount alpine-working-image-for-test
|
||||
buildah delete alpine-working-image-for-test
|
||||
}
|
||||
|
||||
@test "by-root" {
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount --name=$cid)
|
||||
buildah unmount --root=$root
|
||||
buildah delete --root=$root
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount $cid)
|
||||
buildah unmount $cid
|
||||
buildah delete $cid
|
||||
}
|
||||
|
||||
@test "commit" {
|
||||
createrandom ${TESTDIR}/randomfile
|
||||
createrandom ${TESTDIR}/other-randomfile
|
||||
createrandom ${TESTDIR}/randomfile
|
||||
createrandom ${TESTDIR}/other-randomfile
|
||||
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount --name=$cid)
|
||||
cp ${TESTDIR}/randomfile $root/randomfile
|
||||
buildah unmount --name=$cid
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json --name=$cid --output=containers-storage:new-image
|
||||
buildah delete --name=$cid
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount $cid)
|
||||
cp ${TESTDIR}/randomfile $root/randomfile
|
||||
buildah unmount $cid
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid containers-storage:new-image
|
||||
buildah delete $cid
|
||||
|
||||
newcid=$(buildah from --image new-image)
|
||||
newroot=$(buildah mount --name=$newcid)
|
||||
test -s $newroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/randomfile
|
||||
cp ${TESTDIR}/other-randomfile $newroot/other-randomfile
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json --name=$newcid --output=containers-storage:other-new-image
|
||||
# Not an allowed ordering of arguments and flags. Check that it's rejected.
|
||||
run buildah commit --signature-policy ${TESTSDIR}/policy.json $newcid --output=containers-storage:rejected-new-image
|
||||
[ "$status" -eq 1 ]
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json --output=containers-storage:another-new-image $newcid
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json $newcid containers-storage:yet-another-new-image
|
||||
buildah unmount --name=$newcid
|
||||
buildah delete --name=$newcid
|
||||
newcid=$(buildah from --image new-image)
|
||||
newroot=$(buildah mount $newcid)
|
||||
test -s $newroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/randomfile
|
||||
cp ${TESTDIR}/other-randomfile $newroot/other-randomfile
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json $newcid containers-storage:other-new-image
|
||||
# Not an allowed ordering of arguments and flags. Check that it's rejected.
|
||||
run buildah commit $newcid --signature-policy ${TESTSDIR}/policy.json containers-storage:rejected-new-image
|
||||
[ "$status" -eq 1 ]
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json $newcid containers-storage:another-new-image
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json $newcid containers-storage:yet-another-new-image
|
||||
buildah unmount $newcid
|
||||
buildah delete $newcid
|
||||
|
||||
othernewcid=$(buildah from --image other-new-image)
|
||||
othernewroot=$(buildah mount --name=$othernewcid)
|
||||
test -s $othernewroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $othernewroot/randomfile
|
||||
test -s $othernewroot/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $othernewroot/other-randomfile
|
||||
buildah delete --name=$othernewcid
|
||||
othernewcid=$(buildah from --image other-new-image)
|
||||
othernewroot=$(buildah mount $othernewcid)
|
||||
test -s $othernewroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $othernewroot/randomfile
|
||||
test -s $othernewroot/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $othernewroot/other-randomfile
|
||||
buildah delete $othernewcid
|
||||
|
||||
anothernewcid=$(buildah from --image another-new-image)
|
||||
anothernewroot=$(buildah mount --name=$anothernewcid)
|
||||
test -s $anothernewroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $anothernewroot/randomfile
|
||||
test -s $anothernewroot/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $anothernewroot/other-randomfile
|
||||
buildah delete --name=$anothernewcid
|
||||
anothernewcid=$(buildah from --image another-new-image)
|
||||
anothernewroot=$(buildah mount $anothernewcid)
|
||||
test -s $anothernewroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $anothernewroot/randomfile
|
||||
test -s $anothernewroot/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $anothernewroot/other-randomfile
|
||||
buildah delete $anothernewcid
|
||||
|
||||
yetanothernewcid=$(buildah from --image yet-another-new-image)
|
||||
yetanothernewroot=$(buildah mount --name=$yetanothernewcid)
|
||||
test -s $yetanothernewroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $yetanothernewroot/randomfile
|
||||
test -s $yetanothernewroot/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $yetanothernewroot/other-randomfile
|
||||
buildah delete --name=$yetanothernewcid
|
||||
yetanothernewcid=$(buildah from --image yet-another-new-image)
|
||||
yetanothernewroot=$(buildah mount $yetanothernewcid)
|
||||
test -s $yetanothernewroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $yetanothernewroot/randomfile
|
||||
test -s $yetanothernewroot/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $yetanothernewroot/other-randomfile
|
||||
buildah delete $yetanothernewcid
|
||||
}
|
||||
|
||||
@@ -3,23 +3,23 @@
|
||||
load helpers
|
||||
|
||||
@test "copy-local-plain" {
|
||||
createrandom ${TESTDIR}/randomfile
|
||||
createrandom ${TESTDIR}/other-randomfile
|
||||
createrandom ${TESTDIR}/randomfile
|
||||
createrandom ${TESTDIR}/other-randomfile
|
||||
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount --name=$cid)
|
||||
buildah config --name=$cid --workingdir /
|
||||
buildah copy --name=$cid ${TESTDIR}/randomfile
|
||||
buildah copy $cid ${TESTDIR}/other-randomfile
|
||||
buildah unmount --name=$cid
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json --name=$cid --output=containers-storage:new-image
|
||||
buildah delete --name=$cid
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount $cid)
|
||||
buildah config --workingdir / $cid
|
||||
buildah copy $cid ${TESTDIR}/randomfile
|
||||
buildah copy $cid ${TESTDIR}/other-randomfile
|
||||
buildah unmount $cid
|
||||
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid containers-storage:new-image
|
||||
buildah delete $cid
|
||||
|
||||
newcid=$(buildah from --image new-image)
|
||||
newroot=$(buildah mount --name=$newcid)
|
||||
test -s $newroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/randomfile
|
||||
test -s $newroot/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $newroot/other-randomfile
|
||||
buildah delete --name=$newcid
|
||||
newcid=$(buildah from --image new-image)
|
||||
newroot=$(buildah mount $newcid)
|
||||
test -s $newroot/randomfile
|
||||
cmp ${TESTDIR}/randomfile $newroot/randomfile
|
||||
test -s $newroot/other-randomfile
|
||||
cmp ${TESTDIR}/other-randomfile $newroot/other-randomfile
|
||||
buildah delete $newcid
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ load helpers
|
||||
fi
|
||||
createrandom ${TESTDIR}/randomfile
|
||||
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json --image alpine)
|
||||
root=$(buildah mount --name=$cid)
|
||||
buildah config --name=$cid --workingdir /tmp
|
||||
run buildah --debug=false run --name=$cid pwd
|
||||
root=$(buildah mount $cid)
|
||||
buildah config $cid --workingdir /tmp
|
||||
run buildah --debug=false run $cid pwd
|
||||
output=$(echo "$output" | tr -d '\r')
|
||||
[ "$output" = /tmp ]
|
||||
buildah config --name=$cid --workingdir /root
|
||||
buildah config $cid --workingdir /root
|
||||
run buildah --debug=false run $cid pwd
|
||||
output=$(echo "$output" | tr -d '\r')
|
||||
[ "$output" = /root ]
|
||||
@@ -21,6 +21,6 @@ load helpers
|
||||
buildah run $cid cp /tmp/randomfile /tmp/other-randomfile
|
||||
test -s $root/tmp/other-randomfile
|
||||
cmp ${TESTDIR}/randomfile $root/tmp/other-randomfile
|
||||
buildah unmount --name=$cid
|
||||
buildah delete --name=$cid
|
||||
buildah unmount $cid
|
||||
buildah delete $cid
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user