refactor(state): extract getMissingFileHandler method for clarity (#2133)
* refactor(state): extract getMissingFileHandler method for clarity Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
parent
bb6df72463
commit
8c123dcdda
|
|
@ -28,6 +28,8 @@ jobs:
|
|||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
- name: check disk usage
|
||||
run: df -h
|
||||
- uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
version: latest
|
||||
|
|
|
|||
|
|
@ -3210,7 +3210,7 @@ func (st *HelmState) ExpandedHelmfiles() ([]SubHelmfileSpec, error) {
|
|||
}
|
||||
if len(matches) == 0 {
|
||||
err := fmt.Errorf("no matches for path: %s", hf.Path)
|
||||
if *st.MissingFileHandler == "Error" {
|
||||
if *st.getMissingFileHandler() == "Error" {
|
||||
return nil, err
|
||||
}
|
||||
st.logger.Warnf("no matches for path: %s", hf.Path)
|
||||
|
|
@ -3298,6 +3298,19 @@ func (st *HelmState) getReleaseMissingFileHandler(release *ReleaseSpec) *string
|
|||
}
|
||||
}
|
||||
|
||||
// getMissingFileHandler returns the first non-nil MissingFileHandler in the following order:
|
||||
// - st.MissingFileHandler
|
||||
// - "Error"
|
||||
func (st *HelmState) getMissingFileHandler() *string {
|
||||
defaultMissingFileHandler := "Error"
|
||||
switch {
|
||||
case st.MissingFileHandler != nil:
|
||||
return st.MissingFileHandler
|
||||
default:
|
||||
return &defaultMissingFileHandler
|
||||
}
|
||||
}
|
||||
|
||||
func (st *HelmState) generateTemporaryReleaseValuesFiles(release *ReleaseSpec, values []any) ([]string, error) {
|
||||
generatedFiles := []string{}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue