Skip to content

fix(ci): convert ci is failing due to perms #439

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

Merged
merged 3 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions .github/workflows/convert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ jobs:
git clone https://github.com/alpinelinux/docker-alpine.git
chmod -R a+rwx docker-alpine
cd docker-alpine
mkdir -p /out
chmod -R a+rwx /out
TEMPDIR=$(mktemp -d)
stacker convert --docker-file Dockerfile --output-file stacker.yaml --substitute-file stacker-subs.yaml
stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine
stacker build -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine --substitute STACKER_VOL1="$TEMPDIR"
stacker publish -f stacker.yaml --substitute-file stacker-subs.yaml --substitute IMAGE=alpine --skip-tls --url docker://${REGISTRY_URL} --layer alpine --tag latest
rm -f stacker.yaml stacker-subs.yaml
stacker clean
Expand Down
33 changes: 17 additions & 16 deletions cmd/stacker/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

"github.com/urfave/cli"
cli "github.com/urfave/cli/v2"
"stackerbuild.io/stacker/pkg/squashfs"
"stackerbuild.io/stacker/pkg/stacker"
"stackerbuild.io/stacker/pkg/types"
Expand All @@ -20,53 +20,54 @@ var buildCmd = cli.Command{
func initBuildFlags() []cli.Flag {
return append(
initCommonBuildFlags(),
cli.StringFlag{
Name: "stacker-file, f",
Usage: "the input stackerfile",
Value: "stacker.yaml",
&cli.StringFlag{
Name: "stacker-file",
Aliases: []string{"f"},
Usage: "the input stackerfile",
Value: "stacker.yaml",
})
}

func initCommonBuildFlags() []cli.Flag {
return []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "no-cache",
Usage: "don't use the previous build cache",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "substitute",
Usage: "variable substitution in stackerfiles, FOO=bar format",
},
cli.StringFlag{
&cli.StringFlag{
Name: "substitute-file",
Usage: "file containing variable substitution in stackerfiles, 'FOO: bar' yaml format",
},
cli.StringFlag{
&cli.StringFlag{
Name: "on-run-failure",
Usage: "command to run inside container if run fails (useful for inspection)",
},
cli.BoolFlag{
&cli.BoolFlag{
Name: "shell-fail",
Usage: fmt.Sprintf("exec %s inside the container if run fails (alias for --on-run-failure=%s)", stacker.DefaultShell, stacker.DefaultShell),
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "layer-type",
Usage: "set the output layer type (supported values: tar, squashfs); can be supplied multiple times",
Value: &cli.StringSlice{"tar"},
Value: cli.NewStringSlice("tar"),
},
cli.BoolFlag{
&cli.BoolFlag{
Name: "no-squashfs-verity",
Usage: "do not append dm-verity data to squashfs archives",
},
cli.BoolFlag{
&cli.BoolFlag{
Name: "require-hash",
Usage: "require all remote imports to have a hash provided in stackerfiles",
},
cli.BoolFlag{
&cli.BoolFlag{
Name: "order-only",
Usage: "show the build order without running the actual build",
},
cli.StringFlag{
&cli.StringFlag{
Name: "annotations-namespace",
Usage: "set OCI annotations namespace in the OCI image manifest",
Value: "io.stackeroci",
Expand Down
2 changes: 1 addition & 1 deletion cmd/stacker/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/pkg/errors"
"github.com/pkg/xattr"
"github.com/urfave/cli"
cli "github.com/urfave/cli/v2"
"stackerbuild.io/stacker/pkg/log"
"stackerbuild.io/stacker/pkg/overlay"
"stackerbuild.io/stacker/pkg/stacker"
Expand Down
21 changes: 11 additions & 10 deletions cmd/stacker/chroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"

"github.com/pkg/errors"
"github.com/urfave/cli"
cli "github.com/urfave/cli/v2"
"stackerbuild.io/stacker/pkg/container"
"stackerbuild.io/stacker/pkg/log"
"stackerbuild.io/stacker/pkg/stacker"
Expand All @@ -18,12 +18,13 @@ var chrootCmd = cli.Command{
Aliases: []string{"exec"},
Action: doChroot,
Flags: []cli.Flag{
cli.StringFlag{
Name: "stacker-file, f",
Usage: "the input stackerfile",
Value: "stacker.yaml",
&cli.StringFlag{
Name: "stacker-file",
Aliases: []string{"f"},
Usage: "the input stackerfile",
Value: "stacker.yaml",
},
cli.StringSliceFlag{
&cli.StringSliceFlag{
Name: "substitute",
Usage: "variable substitution in stackerfiles, FOO=bar format",
},
Expand All @@ -45,14 +46,14 @@ func doChroot(ctx *cli.Context) error {
defer locks.Unlock()

tag := ""
if len(ctx.Args()) > 0 {
tag = ctx.Args()[0]
if ctx.Args().Len() > 0 {
tag = ctx.Args().Get(0)
}

cmd := stacker.DefaultShell

if len(ctx.Args()) > 1 {
cmd = ctx.Args()[1]
if ctx.Args().Len() > 1 {
cmd = ctx.Args().Get(1)
}

file := ctx.String("f")
Expand Down
4 changes: 2 additions & 2 deletions cmd/stacker/clean.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"

"github.com/pkg/errors"
"github.com/urfave/cli"
cli "github.com/urfave/cli/v2"
"stackerbuild.io/stacker/pkg/log"
"stackerbuild.io/stacker/pkg/stacker"
)
Expand All @@ -14,7 +14,7 @@ var cleanCmd = cli.Command{
Usage: "cleans up after a `stacker build`",
Action: doClean,
Flags: []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "all",
Usage: "no-op; this used to do soemthing, and is left in for compatibility",
},
Expand Down
29 changes: 16 additions & 13 deletions cmd/stacker/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"log"

"github.com/urfave/cli"
cli "github.com/urfave/cli/v2"
"stackerbuild.io/stacker/pkg/stacker"
)

Expand All @@ -18,20 +18,23 @@ var convertCmd = cli.Command{
func initConvertFlags() []cli.Flag {
return append(
initCommonConvertFlags(),
cli.StringFlag{
Name: "docker-file, i",
Usage: "the input Dockerfile",
Value: "Dockerfile",
&cli.StringFlag{
Name: "docker-file",
Aliases: []string{"i"},
Usage: "the input Dockerfile",
Value: "Dockerfile",
},
cli.StringFlag{
Name: "output-file, o",
Usage: "the output stacker file",
Value: "stacker.yaml",
&cli.StringFlag{
Name: "output-file",
Aliases: []string{"o"},
Usage: "the output stacker file",
Value: "stacker.yaml",
},
cli.StringFlag{
Name: "substitute-file, s",
Usage: "the output file containing detected substitutions",
Value: "stacker-subs.yaml",
&cli.StringFlag{
Name: "substitute-file",
Aliases: []string{"s"},
Usage: "the output file containing detected substitutions",
Value: "stacker-subs.yaml",
},
)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/stacker/gc.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/urfave/cli"
cli "github.com/urfave/cli/v2"
"stackerbuild.io/stacker/pkg/stacker"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/stacker/grab.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"

"github.com/pkg/errors"
"github.com/urfave/cli"
cli "github.com/urfave/cli/v2"
"stackerbuild.io/stacker/pkg/stacker"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/stacker/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/opencontainers/umoci"
"github.com/opencontainers/umoci/oci/casext"
"github.com/pkg/errors"
"github.com/urfave/cli"
cli "github.com/urfave/cli/v2"
stackeroci "stackerbuild.io/stacker/pkg/oci"
)

Expand Down
60 changes: 30 additions & 30 deletions cmd/stacker/internal_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"

"github.com/pkg/errors"
"github.com/urfave/cli"
cli "github.com/urfave/cli/v2"
"golang.org/x/sys/unix"
"stackerbuild.io/stacker/pkg/atomfs"
"stackerbuild.io/stacker/pkg/lib"
Expand All @@ -19,43 +19,43 @@ import (
var internalGoCmd = cli.Command{
Name: "internal-go",
Hidden: true,
Subcommands: []cli.Command{
cli.Command{
Subcommands: []*cli.Command{
&cli.Command{
Name: "cp",
Action: doCP,
},
cli.Command{
&cli.Command{
Name: "chmod",
Action: doChmod,
},
cli.Command{
&cli.Command{
Name: "chown",
Action: doChown,
},
cli.Command{
&cli.Command{
Name: "check-aa-profile",
Action: doCheckAAProfile,
},
/*
* these are not actually used by stacker, but are entrypoints
* to the code for use in the test suite.
*/
cli.Command{
&cli.Command{
Name: "testsuite-check-overlay",
Action: doTestsuiteCheckOverlay,
},
cli.Command{
&cli.Command{
Name: "copy",
Action: doImageCopy,
},
cli.Command{
&cli.Command{
Name: "atomfs",
Subcommands: []cli.Command{
cli.Command{
Subcommands: []*cli.Command{
&cli.Command{
Name: "mount",
Action: doAtomfsMount,
},
cli.Command{
&cli.Command{
Name: "umount",
Action: doAtomfsUmount,
},
Expand Down Expand Up @@ -95,52 +95,52 @@ func doTestsuiteCheckOverlay(ctx *cli.Context) error {
}

func doImageCopy(ctx *cli.Context) error {
if len(ctx.Args()) != 2 {
if ctx.Args().Len() != 2 {
return errors.Errorf("wrong number of args")
}

return lib.ImageCopy(lib.ImageCopyOpts{
Src: ctx.Args()[0],
Dest: ctx.Args()[1],
Src: ctx.Args().Get(0),
Dest: ctx.Args().Get(1),
Progress: os.Stdout,
})
}

func doCP(ctx *cli.Context) error {
if len(ctx.Args()) != 2 {
if ctx.Args().Len() != 2 {
return errors.Errorf("wrong number of args")
}

return lib.CopyThing(
ctx.Args()[0],
ctx.Args()[1],
ctx.Args().Get(0),
ctx.Args().Get(1),
)
}

func doChmod(ctx *cli.Context) error {
if len(ctx.Args()) != 2 {
if ctx.Args().Len() != 2 {
return errors.Errorf("wrong number of args")
}

return lib.Chmod(
ctx.Args()[0],
ctx.Args()[1],
ctx.Args().Get(0),
ctx.Args().Get(1),
)
}

func doChown(ctx *cli.Context) error {
if len(ctx.Args()) != 2 {
if ctx.Args().Len() != 2 {
return errors.Errorf("wrong number of args")
}

return lib.Chown(
ctx.Args()[0],
ctx.Args()[1],
ctx.Args().Get(0),
ctx.Args().Get(1),
)
}

func doCheckAAProfile(ctx *cli.Context) error {
toCheck := ctx.Args()[0]
toCheck := ctx.Args().Get(0)
command := fmt.Sprintf("changeprofile %s", toCheck)

runtime.LockOSThread()
Expand Down Expand Up @@ -170,12 +170,12 @@ func doCheckAAProfile(ctx *cli.Context) error {
}

func doAtomfsMount(ctx *cli.Context) error {
if len(ctx.Args()) != 2 {
if ctx.Args().Len() != 2 {
return errors.Errorf("wrong number of args for mount")
}

tag := ctx.Args()[0]
mountpoint := ctx.Args()[1]
tag := ctx.Args().Get(0)
mountpoint := ctx.Args().Get(1)

wd, err := os.Getwd()
if err != nil {
Expand All @@ -201,10 +201,10 @@ func doAtomfsMount(ctx *cli.Context) error {
}

func doAtomfsUmount(ctx *cli.Context) error {
if len(ctx.Args()) != 1 {
if ctx.Args().Len() != 1 {
return errors.Errorf("wrong number of args for umount")
}

mountpoint := ctx.Args()[0]
mountpoint := ctx.Args().Get(0)
return atomfs.Umount(mountpoint)
}
Loading