Skip to content

Commit 420567d

Browse files
Thomas Vendettasstarcher
authored andcommitted
Add --print-computed-version flag to write version to STDOUT.
Closes #2
1 parent cb3c538 commit 420567d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ You can install a specific release version:
1717

1818
* helm release CHART - Would determine the next tag for the chart and update the Chart.yaml
1919
* helm release CHART -t 12345 - Would update Chart.yaml and modify values.yaml images.tag to equal 12345
20+
* helm release CHART --print-computed-version - Would determine the next tag and print it to STDOUT
2021

2122
## Release Logic
2223

cmd/root.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
var cfgFile string
1515
var tag string
1616
var tagPath string
17+
var printComputedVersion bool
1718

1819
// rootCmd represents the base command when called without any subcommands
1920
var rootCmd = &cobra.Command{
@@ -37,6 +38,12 @@ var rootCmd = &cobra.Command{
3738
if err != nil {
3839
return err
3940
}
41+
42+
if printComputedVersion {
43+
_, err = os.Stdout.WriteString(*version)
44+
return err
45+
}
46+
4047
log.Infof("updating the Chart.yaml to version %s", *version)
4148

4249
chart.UpdateChartVersion(*version)
@@ -73,6 +80,7 @@ func init() {
7380
// when this action is called directly.
7481
rootCmd.Flags().StringVarP(&tag, "tag", "t", "", "Sets the docker image tag in values.yaml")
7582
rootCmd.Flags().StringVar(&tagPath, "path", helm.DefaultTagPath, "Sets the path to the image tag to modify in values.yaml")
83+
rootCmd.Flags().BoolVar(&printComputedVersion, "print-computed-version", false, "Print the computed version string to stdout")
7684
}
7785

7886
// initConfig reads in config file and ENV variables if set.

0 commit comments

Comments
 (0)