This is an automated email from the ASF dual-hosted git repository.
warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 7f51470aa fix: support jenkins v100 upgrade (#4099)
7f51470aa is described below
commit 7f51470aa35e5d054717bde2f91be3cfbda50b48
Author: Likyh <[email protected]>
AuthorDate: Wed Jan 4 19:31:45 2023 +0800
fix: support jenkins v100 upgrade (#4099)
* fix: support jenkins v100 upgrade
* fix: for linter
* fix: for review
---
config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts | 4 ++--
config-ui/src/pages/blueprint/detail/panel/configuration.tsx | 2 +-
services/blueprint_makeplan_v200.go | 6 ++++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts
b/config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts
index 0424be954..5ee905338 100644
--- a/config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts
+++ b/config-ui/src/error/components/bp-upgrade/use-bp-upgrade.ts
@@ -16,7 +16,7 @@
*
*/
-import { useState, useMemo } from 'react';
+import { useMemo, useState } from 'react';
import { operator } from '@/utils';
@@ -118,7 +118,7 @@ export const useBPUpgrade = ({ id, onResetError }:
UseBPUpgradeProps) => {
const upgradeConnection = async (connection: any) => {
const { plugin, connectionId } = connection;
- const scopeList = await Promise.all(connection.scope.map((sc: any) =>
upgradeScope(plugin, connectionId, sc)));
+ const scopeList = await Promise.all((connection.scope ?? []).map((sc: any)
=> upgradeScope(plugin, connectionId, sc)));
return {
plugin,
connectionId,
diff --git a/config-ui/src/pages/blueprint/detail/panel/configuration.tsx
b/config-ui/src/pages/blueprint/detail/panel/configuration.tsx
index 1649e2679..3a4b7ee1c 100644
--- a/config-ui/src/pages/blueprint/detail/panel/configuration.tsx
+++ b/config-ui/src/pages/blueprint/detail/panel/configuration.tsx
@@ -64,7 +64,7 @@ export const Configuration = ({ blueprint, operating,
onUpdate, onRefresh }: Pro
name: plugin.name,
connectionId: cs.connectionId,
entities: plugin.entities,
- selectedEntites: cs.scopes[0].entities,
+ selectedEntites: cs.scopes?.[0].entities ?? [],
plugin: cs.plugin,
scope: cs.scopes,
};
diff --git a/services/blueprint_makeplan_v200.go
b/services/blueprint_makeplan_v200.go
index eed7b53a2..655155965 100644
--- a/services/blueprint_makeplan_v200.go
+++ b/services/blueprint_makeplan_v200.go
@@ -89,8 +89,10 @@ func genPlanJsonV200(
sourcePlans := make([]core.PipelinePlan, len(connections))
scopes := make([]core.Scope, 0, len(connections))
for i, connection := range connections {
- if len(connection.Scopes) == 0 && connection.Plugin !=
`webhook` {
- return nil, nil,
errors.Default.New(fmt.Sprintf("connections[%d].scope is empty", i))
+ if len(connection.Scopes) == 0 && connection.Plugin !=
`webhook` && connection.Plugin != `jenkins` {
+ // webhook needn't scopes
+ // jenkins may upgrade from v100 and its' scope is empty
+ return nil, nil,
errors.Default.New(fmt.Sprintf("connections[%d].scopes is empty", i))
}
plugin, err := core.GetPlugin(connection.Plugin)
if err != nil {