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 <ijc@docker.com>
This commit is contained in:
Ian Campbell 2017-10-09 17:37:38 +01:00
parent 12e6a85661
commit fbf23b4b9f

View File

@ -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,