1
0
mirror of https://github.com/helm/chart-testing.git synced 2026-02-05 09:45:14 +01:00

Add since flag for changing the reference branch for git merge-base (#229)

This commit is contained in:
Marc Sensenich
2020-07-24 16:12:55 -04:00
committed by GitHub
parent 67ec12d315
commit 93b10e8e55
11 changed files with 15 additions and 7 deletions

View File

@@ -64,6 +64,7 @@ func addCommonFlags(flags *pflag.FlagSet) {
flags.StringVar(&cfgFile, "config", "", "Config file")
flags.String("remote", "origin", "The name of the Git remote used to identify changed charts")
flags.String("target-branch", "master", "The name of the target branch used to identify changed charts")
flags.String("since", "HEAD", "The Git reference used to identify changed charts")
flags.StringSlice("chart-dirs", []string{"charts"}, heredoc.Doc(`
Directories containing Helm charts. May be specified multiple times
or separate values with commas`))

View File

@@ -26,4 +26,4 @@ in given chart directories.
* [ct list-changed](ct_list-changed.md) - List changed charts
* [ct version](ct_version.md) - Print version information
###### Auto generated by spf13/cobra on 13-Dec-2019
###### Auto generated by spf13/cobra on 21-Apr-2020

View File

@@ -59,6 +59,7 @@ ct install [flags]
--release-label string The label to be used as a selector when inspecting resources created by charts.
This is only used if namespace is specified (default "app.kubernetes.io/instance")
--remote string The name of the Git remote used to identify changed charts (default "origin")
--since string The Git reference used to identify changed charts (default "HEAD")
--skip-missing-values When --upgrade has been passed, this flag will skip testing CI values files from the
previous chart revision if they have been deleted or renamed at the current chart
revision
@@ -71,4 +72,4 @@ ct install [flags]
* [ct](ct.md) - The Helm chart testing tool
###### Auto generated by spf13/cobra on 13-Dec-2019
###### Auto generated by spf13/cobra on 21-Apr-2020

View File

@@ -50,6 +50,7 @@ ct lint-and-install [flags]
--release-label string The label to be used as a selector when inspecting resources created by charts.
This is only used if namespace is specified (default "app.kubernetes.io/instance")
--remote string The name of the Git remote used to identify changed charts (default "origin")
--since string The Git reference used to identify changed charts (default "HEAD")
--skip-missing-values When --upgrade has been passed, this flag will skip testing CI values files from the
previous chart revision if they have been deleted or renamed at the current chart
revision
@@ -66,4 +67,4 @@ ct lint-and-install [flags]
* [ct](ct.md) - The Helm chart testing tool
###### Auto generated by spf13/cobra on 13-Dec-2019
###### Auto generated by spf13/cobra on 21-Apr-2020

View File

@@ -54,6 +54,7 @@ ct lint [flags]
is searched in the current directory, '$HOME/.ct', and '/etc/ct', in
that order
--remote string The name of the Git remote used to identify changed charts (default "origin")
--since string The Git reference used to identify changed charts (default "HEAD")
--target-branch string The name of the target branch used to identify changed charts (default "master")
--validate-chart-schema Enable schema validation of 'Chart.yaml' using Yamale (default: true) (default true)
--validate-maintainers Enable validation of maintainer account names in chart.yml (default: true).
@@ -65,4 +66,4 @@ ct lint [flags]
* [ct](ct.md) - The Helm chart testing tool
###### Auto generated by spf13/cobra on 13-Dec-2019
###### Auto generated by spf13/cobra on 21-Apr-2020

View File

@@ -21,6 +21,7 @@ ct list-changed [flags]
or separate values with commas
-h, --help help for list-changed
--remote string The name of the Git remote used to identify changed charts (default "origin")
--since string The Git reference used to identify changed charts (default "HEAD")
--target-branch string The name of the target branch used to identify changed charts (default "master")
```
@@ -28,4 +29,4 @@ ct list-changed [flags]
* [ct](ct.md) - The Helm chart testing tool
###### Auto generated by spf13/cobra on 13-Dec-2019
###### Auto generated by spf13/cobra on 21-Apr-2020

View File

@@ -20,4 +20,4 @@ ct version [flags]
* [ct](ct.md) - The Helm chart testing tool
###### Auto generated by spf13/cobra on 13-Dec-2019
###### Auto generated by spf13/cobra on 21-Apr-2020

View File

@@ -675,7 +675,7 @@ func (t *Testing) computeMergeBase() (string, error) {
if err != nil {
return "", errors.New("Must be in a git repository")
}
return t.git.MergeBase(fmt.Sprintf("%s/%s", t.config.Remote, t.config.TargetBranch), "HEAD")
return t.git.MergeBase(fmt.Sprintf("%s/%s", t.config.Remote, t.config.TargetBranch), t.config.Since)
}
// ComputeChangedChartDirectories takes the merge base of HEAD and the configured remote and target branch and computes a

View File

@@ -41,6 +41,7 @@ var (
type Configuration struct {
Remote string `mapstructure:"remote"`
TargetBranch string `mapstructure:"target-branch"`
Since string `mapstructure:"since"`
BuildId string `mapstructure:"build-id"`
LintConf string `mapstructure:"lint-conf"`
ChartYamlSchema string `mapstructure:"chart-yaml-schema"`

View File

@@ -1,6 +1,7 @@
{
"remote": "origin",
"target-branch": "master",
"since": "HEAD~1",
"build-id": "pr-42",
"lint-conf": "my-lint-conf.yaml",
"chart-yaml-schema": "my-chart-yaml-schema.yaml",

View File

@@ -1,5 +1,6 @@
remote: origin
target-branch: master
since: HEAD~1
build-id: pr-42
lint-conf: my-lint-conf.yaml
chart-yaml-schema: my-chart-yaml-schema.yaml