mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 11:47:36 +08:00
Merge pull request #1006 from yangkaa/master-maven
Fix Bug: modified get maven setting logic
This commit is contained in:
commit
0a88a94f2b
@ -442,11 +442,14 @@ func (s *slugBuild) runBuildJob(re *Request) error {
|
||||
if mavenSettingName != "" && re.Lang.String() == code.JavaMaven.String() {
|
||||
if setting := jobc.GetJobController().GetLanguageBuildSetting(re.Ctx, code.JavaMaven, mavenSettingName); setting != "" {
|
||||
mavenSettingConfigName = setting
|
||||
}
|
||||
}
|
||||
if mavenSettingConfigName == "" {
|
||||
if settingName := jobc.GetJobController().GetDefaultLanguageBuildSetting(re.Ctx, code.JavaMaven); settingName != "" {
|
||||
mavenSettingConfigName = settingName
|
||||
} else {
|
||||
logrus.Warnf("maven setting config %s not found", mavenSettingName)
|
||||
}
|
||||
} else if settingName := jobc.GetJobController().GetDefaultLanguageBuildSetting(re.Ctx, code.JavaMaven); settingName != "" {
|
||||
mavenSettingConfigName = settingName
|
||||
}
|
||||
if mavenSettingConfigName != "" {
|
||||
podSpec.Volumes = append(podSpec.Volumes, corev1.Volume{
|
||||
|
@ -249,12 +249,22 @@ 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())
|
||||
logrus.Errorf("get default maven setting configmap failure %s", err.Error())
|
||||
return ""
|
||||
}
|
||||
if config != nil {
|
||||
for _, c := range config.Items {
|
||||
return c.Name
|
||||
}
|
||||
for _, c := range config.Items {
|
||||
return c.Name
|
||||
}
|
||||
// Use the first maven setting when there is no default Maven configuration
|
||||
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 ""
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user