github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/initializer/init_problems.go (about)

     1  /*
     2  Copyright 2020 The Skaffold Authors
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package initializer
    18  
    19  import (
    20  	"regexp"
    21  
    22  	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants"
    23  	sErrors "github.com/GoogleContainerTools/skaffold/pkg/skaffold/errors"
    24  	"github.com/GoogleContainerTools/skaffold/proto/v1"
    25  )
    26  
    27  var (
    28  	problems = []sErrors.Problem{
    29  		{
    30  			Regexp:     re(".*creating tagger.*"),
    31  			ErrCode:    proto.StatusCode_INIT_CREATE_TAGGER_ERROR,
    32  			Suggestion: sErrors.ReportIssueSuggestion,
    33  		},
    34  		{
    35  			Regexp:      re(".*The control plane node must be running for this command.*"),
    36  			ErrCode:     proto.StatusCode_INIT_MINIKUBE_NOT_RUNNING_ERROR,
    37  			Description: func(error) string { return "minikube is probably not running" },
    38  			Suggestion: func(_ interface{}) []*proto.Suggestion {
    39  				return []*proto.Suggestion{{
    40  					SuggestionCode: proto.SuggestionCode_START_MINIKUBE,
    41  					Action:         `Try running "minikube start"`,
    42  				}}
    43  			},
    44  		},
    45  		{
    46  			Regexp:     re(".*creating builder.*"),
    47  			ErrCode:    proto.StatusCode_INIT_CREATE_BUILDER_ERROR,
    48  			Suggestion: sErrors.ReportIssueSuggestion,
    49  		},
    50  		{
    51  			Regexp:     re(".*unexpected artifact type.*"),
    52  			ErrCode:    proto.StatusCode_INIT_CREATE_ARTIFACT_DEP_ERROR,
    53  			Suggestion: sErrors.ReportIssueSuggestion,
    54  		},
    55  		{
    56  			Regexp:     re(".*expanding test file paths.*"),
    57  			ErrCode:    proto.StatusCode_INIT_CREATE_TEST_DEP_ERROR,
    58  			Suggestion: sErrors.ReportIssueSuggestion,
    59  		},
    60  		{
    61  			Regexp:     re(".*creating deployer: something went wrong"),
    62  			ErrCode:    proto.StatusCode_INIT_CREATE_DEPLOYER_ERROR,
    63  			Suggestion: sErrors.ReportIssueSuggestion,
    64  		},
    65  		{
    66  			Regexp:     re(".*creating watch trigger.*"),
    67  			ErrCode:    proto.StatusCode_INIT_CREATE_WATCH_TRIGGER_ERROR,
    68  			Suggestion: sErrors.ReportIssueSuggestion,
    69  		},
    70  		{
    71  			Regexp:     re(".* initializing cache.*"),
    72  			ErrCode:    proto.StatusCode_INIT_CACHE_ERROR,
    73  			Suggestion: sErrors.ReportIssueSuggestion,
    74  		},
    75  	}
    76  )
    77  
    78  // re is a shortcut around regexp.MustCompile
    79  func re(s string) *regexp.Regexp {
    80  	return regexp.MustCompile(s)
    81  }
    82  
    83  func init() {
    84  	sErrors.AddPhaseProblems(constants.Init, problems)
    85  }