Use the first one when there is no default Maven configuration

This commit is contained in:
yangk 2021-05-27 22:08:52 +08:00
parent 52263be06b
commit 290f8965c1

View File

@ -249,12 +249,21 @@ func (c *controller) GetDefaultLanguageBuildSetting(ctx context.Context, lang co
LabelSelector: "default=true",
})
if err != nil {
logrus.Errorf("get default maven setting configmap failure %s", err.Error())
}
if config != nil {
for _, c := range config.Items {
return c.Name
logrus.Errorf("get default maven setting configmap failure %s", err.Error())
allConfig, err := c.KubeClient.CoreV1().ConfigMaps(c.namespace).List(ctx, metav1.ListOptions{
LabelSelector: "configtype=mavensetting",
})
if err != nil {
logrus.Errorf("get all maven setting configmap failure %s", err.Error())
return ""
}
for _, ac := range allConfig.Items {
return ac.Name
}
return ""
}
for _, c := range config.Items {
return c.Name
}
return ""
}