From fbf23b4b9f3048aa674f7477e266d8bebb6ef0f3 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 9 Oct 2017 17:37:38 +0100 Subject: [PATCH] New option `linuxkit pkg build --force-dirty` Will tag as `-dirty` and prevent push etc even if the tree isn't actually dirty. Signed-off-by: Ian Campbell --- src/cmd/linuxkit/pkglib/pkglib.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cmd/linuxkit/pkglib/pkglib.go b/src/cmd/linuxkit/pkglib/pkglib.go index fad28fced..ee5a584a5 100644 --- a/src/cmd/linuxkit/pkglib/pkglib.go +++ b/src/cmd/linuxkit/pkglib/pkglib.go @@ -67,10 +67,12 @@ func NewFromCLI(fs *flag.FlagSet, args ...string) (Pkg, error) { // Other arguments var buildYML, hash, hashCommit, hashPath string + var dirty bool fs.StringVar(&buildYML, "build-yml", "build.yml", "Override the name of the yml file") fs.StringVar(&hash, "hash", "", "Override the image hash (default is to query git for the package's tree-sh)") fs.StringVar(&hashCommit, "hash-commit", "HEAD", "Override the git commit to use for the hash") fs.StringVar(&hashPath, "hash-path", "", "Override the directory to use for the image hash, must be a parent of the package dir (default is to use the package dir)") + fs.BoolVar(&dirty, "force-dirty", false, "Force the pkg to be considered dirty") fs.Parse(args) @@ -142,11 +144,13 @@ func NewFromCLI(fs *flag.FlagSet, args ...string) (Pkg, error) { } } - dirty, err := gitIsDirty(hashPath, hashCommit) + gitDirty, err := gitIsDirty(hashPath, hashCommit) if err != nil { return Pkg{}, err } + dirty = dirty || gitDirty + return Pkg{ image: pi.Image, org: pi.Org,