-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows to identify chart changes before actually running lint or install commands. This can be useful in the following cases: * In a CI setup where kind clusters are spun up on the fly, this makes it possible to decide whether a cluster is necessary at all. A PR may only contain changes that are not relevant to any charts. * By knowing upfront which charts have changed, it is possible to load a per-chart CI configuration which would allows us to determine the number of nodes needed in a kind cluster. For most charts, one node is enough, but in certain scenarios, especially for StatefulSets, we may want to test with pod anti-affinity where replicas have to be spread across multiple nodes. Signed-off-by: Reinhard Nägele <unguiculus@gmail.com>
- Loading branch information
1 parent
1d3db54
commit d69c43e
Showing
13 changed files
with
119 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright The Helm Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/MakeNowJust/heredoc" | ||
"os" | ||
|
||
"github.com/helm/chart-testing/pkg/chart" | ||
"github.com/helm/chart-testing/pkg/config" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func newListChangedCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "list-changed", | ||
Aliases: []string{"ls-changed", "lsc"}, | ||
Short: "List changed charts", | ||
Long: heredoc.Doc(` | ||
"List changed charts based on configured charts directories, | ||
"remote, and target branch`), | ||
Run: listChanged, | ||
} | ||
|
||
flags := cmd.Flags() | ||
addCommonFlags(flags) | ||
return cmd | ||
} | ||
|
||
func listChanged(cmd *cobra.Command, args []string) { | ||
configuration, err := config.LoadConfiguration(cfgFile, cmd, false) | ||
if err != nil { | ||
fmt.Printf("Error loading configuration: %s\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
testing := chart.NewTesting(*configuration) | ||
chartDirs, err := testing.ComputeChangedChartDirectories() | ||
if err != nil { | ||
os.Exit(1) | ||
} | ||
|
||
for _, dir := range chartDirs { | ||
fmt.Println(dir) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## ct list-changed | ||
|
||
List changed charts | ||
|
||
### Synopsis | ||
|
||
"List changed charts based on configured charts directories, | ||
"remote, and target branch | ||
|
||
``` | ||
ct list-changed [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
--chart-dirs strings Directories containing Helm charts. May be specified multiple times | ||
or separate values with commas (default [charts]) | ||
--config string Config file | ||
--excluded-charts strings Charts that should be skipped. May be specified multiple times | ||
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") | ||
--target-branch string The name of the target branch used to identify changed charts (default "master") | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [ct](ct.md) - The Helm chart testing tool | ||
|
||
###### Auto generated by spf13/cobra on 31-Jan-2019 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters