Skip to content

Commit

Permalink
Add a -date_version option that sets the publish version to vYYYYMMDD (
Browse files Browse the repository at this point in the history
  • Loading branch information
elicriffield authored Jul 3, 2024
1 parent c5b3876 commit a9d6521
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cli_tools/gce_image_publish/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var (
sourceProject = flag.String("source_project", "", "project to source images from, should not be used with source_gcs_path, will override SourceProject in template")
publishVersion = flag.String("publish_version", "", "version for published image if different from source")
publishProject = flag.String("publish_project", "", "project to publish images to, will override PublishProject in template")
dateVersion = flag.Bool("date_version", false, "will use vYYYYMMDD for publish version, should not be used with -publish_version")
skipDup = flag.Bool("skip_duplicates", false, "skip publishing any images that already exist, should not be used along with -replace")
noRoot = flag.Bool("no_root", false, "with -source_gcs_path, append .tar.gz instead of /root.tar.gz")
replace = flag.Bool("replace", false, "replace any images that already exist, should not be used along with -skip_duplicates")
Expand Down Expand Up @@ -121,11 +122,17 @@ func main() {
fmt.Println("Cannot set both -skip_duplicates and -replace")
os.Exit(1)
}

if *dateVersion && *publishVersion != "" {
fmt.Println("Cannot set both -date_version and -publish_version")
os.Exit(1)
}
if len(flag.Args()) == 0 {
fmt.Println("Not enough args, first arg needs to be the path to a publish template.")
os.Exit(1)
}
if *dateVersion {
*publishVersion = "v" + time.Now().UTC().Format("20060102")
}
var regex *regexp.Regexp
if *filter != "" {
var err error
Expand Down

0 comments on commit a9d6521

Please sign in to comment.