This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch release-v0.18
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.18 by this push:
     new 19fd34323 cherry-pick update sprint's url field (#5981)
19fd34323 is described below

commit 19fd34323abbb8d2bdba4c184efdd126c3c4cf32
Author: Lynwee <[email protected]>
AuthorDate: Thu Aug 31 10:39:36 2023 +0800

    cherry-pick update sprint's url field (#5981)
    
    * fix(zentao): fix zentao projects's url, add possible prefix
    
    * fix(zentao): fix sprint's url field
    
    * fix(zentao): fix e2e test
    
    * fix(zentao): fix e2e test
    
    * fix(zentao): remove test zentao system's url
    
    * fix(zentao): fix e2e test error
    
    * fix(mod): go mod tidy
    
    * fix(mod): tidy and download
---
 backend/core/runner/basic_res.go                   |   2 +-
 backend/go.mod                                     | 177 ++++++++++-----------
 backend/go.sum                                     |  16 +-
 backend/plugins/zentao/e2e/account_test.go         |  21 ++-
 backend/plugins/zentao/e2e/bug_commits_test.go     |   1 +
 backend/plugins/zentao/e2e/bug_test.go             |   1 +
 backend/plugins/zentao/e2e/changelog_test.go       |   7 +-
 backend/plugins/zentao/e2e/execution_test.go       |   1 +
 .../e2e/snapshot_tables/execution_sprint.csv       |   4 +-
 backend/plugins/zentao/e2e/story_commits_test.go   |   1 +
 backend/plugins/zentao/e2e/story_test.go           |   1 +
 backend/plugins/zentao/e2e/task_commits_test.go    |   1 +
 backend/plugins/zentao/e2e/task_test.go            |   1 +
 .../plugins/zentao/tasks/execution_convertor.go    |  11 +-
 backend/plugins/zentao/tasks/project_convertor.go  |  20 +--
 backend/plugins/zentao/tasks/shared.go             |  16 ++
 backend/plugins/zentao/tasks/shared_test.go        |  43 +++++
 17 files changed, 197 insertions(+), 127 deletions(-)

diff --git a/backend/core/runner/basic_res.go b/backend/core/runner/basic_res.go
index a4c930ae9..7694d134d 100644
--- a/backend/core/runner/basic_res.go
+++ b/backend/core/runner/basic_res.go
@@ -33,7 +33,7 @@ import (
 var app_lock sync.Mutex
 var app_inited bool
 
-// CreateAppBasicRes returns a application level BasicRes instance based on 
.env/environment variables
+// CreateAppBasicRes returns an application level BasicRes instance based on 
.env/environment variables
 // it is useful because multiple places need BasicRes including `main.go` 
`directrun` and `worker`
 // keep in mind this function can be called only once
 func CreateAppBasicRes() context.BasicRes {
diff --git a/backend/go.mod b/backend/go.mod
index b13d81719..0da2df6e5 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -3,9 +3,7 @@ module github.com/apache/incubator-devlake
 go 1.20
 
 require (
-       github.com/aws/aws-sdk-go v1.44.242
        github.com/cockroachdb/errors v1.9.0
-       github.com/dgrijalva/jwt-go v3.2.0+incompatible
        github.com/gin-contrib/cors v1.3.1
        github.com/gin-gonic/gin v1.9.1
        github.com/go-errors/errors v1.4.2
@@ -13,20 +11,16 @@ require (
        github.com/go-playground/validator/v10 v10.14.1
        github.com/gocarina/gocsv v0.0.0-20220707092902-b9da1f06c77e
        github.com/google/uuid v1.3.0
-       github.com/iancoleman/strcase v0.2.0
-       github.com/jackc/pgx/v5 v5.3.1
-       github.com/jmespath/go-jmespath v0.4.0
+       github.com/jackc/pgx/v5 v5.3.1 // indirect
        github.com/lib/pq v1.10.2
        github.com/libgit2/git2go/v33 v33.0.6
        github.com/magiconair/properties v1.8.5
-       github.com/manifoldco/promptui v0.9.0
        github.com/merico-dev/graphql v0.0.0-20221027131946-77460a1fd4cd
-       github.com/mitchellh/hashstructure v1.1.0
        github.com/mitchellh/mapstructure v1.5.0
        github.com/panjf2000/ants/v2 v2.4.6
        github.com/robfig/cron/v3 v3.0.0
        github.com/sirupsen/logrus v1.8.1
-       github.com/spf13/afero v1.6.0
+       github.com/spf13/afero v1.6.0 // indirect
        github.com/spf13/cast v1.4.1
        github.com/spf13/cobra v1.5.0
        github.com/spf13/viper v1.8.1
@@ -36,7 +30,6 @@ require (
        github.com/swaggo/swag v1.16.1
        github.com/tidwall/gjson v1.14.3
        github.com/viant/afs v1.16.0
-       github.com/x-cray/logrus-prefixed-formatter v0.5.2
        go.temporal.io/api v1.7.1-0.20220223032354-6e6fe738916a
        go.temporal.io/sdk v1.14.0
        golang.org/x/crypto v0.9.0
@@ -50,100 +43,104 @@ require (
 )
 
 require (
+       github.com/KyleBanks/depth v1.2.1 // indirect
+       github.com/Microsoft/go-winio v0.5.0 // indirect
+       github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // 
indirect
+       github.com/acomagu/bufpipe v1.0.3 // indirect
        github.com/bytedance/sonic v1.9.1 // indirect
        github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // 
indirect
+       github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // 
indirect
+       github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // 
indirect
+       github.com/cockroachdb/redact v1.1.3 // indirect
+       github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
+       github.com/davecgh/go-spew v1.1.1 // indirect
+       github.com/emirpasic/gods v1.12.0 // indirect
+       github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // 
indirect
+       github.com/fsnotify/fsnotify v1.5.1 // indirect
        github.com/gabriel-vasile/mimetype v1.4.2 // indirect
+       github.com/getsentry/sentry-go v0.12.0 // indirect
+       github.com/gin-contrib/sse v0.1.0 // indirect
+       github.com/go-git/gcfg v1.5.0 // indirect
+       github.com/go-git/go-billy/v5 v5.3.1 // indirect
+       github.com/go-openapi/jsonpointer v0.19.6 // indirect
+       github.com/go-openapi/jsonreference v0.20.2 // indirect
+       github.com/go-openapi/spec v0.20.9 // indirect
+       github.com/go-openapi/swag v0.22.3 // indirect
+       github.com/go-playground/locales v0.14.1 // indirect
+       github.com/go-playground/universal-translator v0.18.1 // indirect
+       github.com/go-sql-driver/mysql v1.7.1 // indirect
        github.com/goccy/go-json v0.10.2 // indirect
+       github.com/gogo/googleapis v1.4.1 // indirect
+       github.com/gogo/protobuf v1.3.2 // indirect
+       github.com/gogo/status v1.1.0 // indirect
+       github.com/golang/mock v1.6.0 // indirect
+       github.com/golang/protobuf v1.5.2 // indirect
+       github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
+       github.com/hashicorp/hcl v1.0.0 // indirect
+       github.com/imdario/mergo v0.3.12 // indirect
+       github.com/inconshreveable/mousetrap v1.0.0 // indirect
+       github.com/jackc/pgpassfile v1.0.0 // indirect
+       github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // 
indirect
+       github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // 
indirect
+       github.com/jinzhu/inflection v1.0.0 // indirect
+       github.com/jinzhu/now v1.1.5 // indirect
+       github.com/josharian/intern v1.0.0 // indirect
+       github.com/json-iterator/go v1.1.12 // indirect
+       github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // 
indirect
        github.com/klauspost/cpuid/v2 v2.2.5 // indirect
+       github.com/kr/pretty v0.3.0 // indirect
+       github.com/kr/text v0.2.0 // indirect
+       github.com/leodido/go-urn v1.2.4 // indirect
+       github.com/mailru/easyjson v0.7.7 // indirect
+       github.com/mattn/go-colorable v0.1.11 // indirect
+       github.com/mattn/go-isatty v0.0.19 // indirect
+       github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
+       github.com/mitchellh/go-homedir v1.1.0 // indirect
+       github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // 
indirect
+       github.com/modern-go/reflect2 v1.0.2 // indirect
+       github.com/pborman/uuid v1.2.1 // indirect
+       github.com/pelletier/go-toml v1.9.3 // indirect
        github.com/pelletier/go-toml/v2 v2.0.8 // indirect
+       github.com/pkg/errors v0.9.1 // indirect
+       github.com/pmezard/go-difflib v1.0.0 // indirect
+       github.com/robfig/cron v1.2.0 // indirect
+       github.com/rogpeppe/go-internal v1.8.1 // indirect
+       github.com/russross/blackfriday/v2 v2.1.0 // indirect
+       github.com/sergi/go-diff v1.1.0 // indirect
+       github.com/spf13/jwalterweatherman v1.1.0 // indirect
+       github.com/spf13/pflag v1.0.6-0.20200504143853-81378bbcd8a1 // indirect
+       github.com/stretchr/objx v0.5.0 // indirect
+       github.com/subosito/gotenv v1.2.0 // indirect
+       github.com/tidwall/match v1.1.1 // indirect
+       github.com/tidwall/pretty v1.2.0 // indirect
        github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
+       github.com/ugorji/go/codec v1.2.11 // indirect
+       github.com/xanzy/ssh-agent v0.3.0 // indirect
+       go.uber.org/atomic v1.9.0 // indirect
        golang.org/x/arch v0.3.0 // indirect
+       golang.org/x/net v0.10.0 // indirect
+       golang.org/x/sys v0.8.0 // indirect
+       golang.org/x/term v0.8.0 // indirect
+       golang.org/x/text v0.9.0 // indirect
+       golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
+       golang.org/x/tools v0.9.3 // indirect
+       google.golang.org/appengine v1.6.7 // indirect
+       google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf // 
indirect
+       google.golang.org/grpc v1.44.0 // indirect
+       google.golang.org/protobuf v1.30.0 // indirect
+       gopkg.in/ini.v1 v1.62.0 // indirect
+       gopkg.in/warnings.v0 v0.1.2 // indirect
+       gopkg.in/yaml.v2 v2.4.0 // indirect
+       gopkg.in/yaml.v3 v3.0.1 // indirect
 )
 
 require (
-       github.com/KyleBanks/depth v1.2.1
-       github.com/Microsoft/go-winio v0.5.0
-       github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7
-       github.com/acomagu/bufpipe v1.0.3
-       github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
-       github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f
-       github.com/cockroachdb/redact v1.1.3
-       github.com/cpuguy83/go-md2man/v2 v2.0.2
-       github.com/davecgh/go-spew v1.1.1
-       github.com/emirpasic/gods v1.12.0
-       github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a
-       github.com/fsnotify/fsnotify v1.5.1
-       github.com/getsentry/sentry-go v0.12.0
-       github.com/gin-contrib/sse v0.1.0
-       github.com/go-git/gcfg v1.5.0
-       github.com/go-git/go-billy/v5 v5.3.1
-       github.com/go-openapi/jsonpointer v0.19.6
-       github.com/go-openapi/jsonreference v0.20.2
-       github.com/go-openapi/spec v0.20.9
-       github.com/go-openapi/swag v0.22.3
-       github.com/go-playground/locales v0.14.1
-       github.com/go-playground/universal-translator v0.18.1
-       github.com/go-sql-driver/mysql v1.7.1
-       github.com/gogo/googleapis v1.4.1
-       github.com/gogo/protobuf v1.3.2
-       github.com/gogo/status v1.1.0
        github.com/golang-jwt/jwt/v5 v5.0.0-rc.1
-       github.com/golang/mock v1.6.0
-       github.com/golang/protobuf v1.5.2
-       github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
-       github.com/hashicorp/hcl v1.0.0
-       github.com/imdario/mergo v0.3.12
-       github.com/inconshreveable/mousetrap v1.0.0
-       github.com/jackc/pgpassfile v1.0.0
-       github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a
-       github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
-       github.com/jinzhu/inflection v1.0.0
-       github.com/jinzhu/now v1.1.5
-       github.com/josharian/intern v1.0.0
-       github.com/json-iterator/go v1.1.12
-       github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351
-       github.com/kr/pretty v0.3.0
-       github.com/kr/text v0.2.0
-       github.com/leodido/go-urn v1.2.4
-       github.com/mailru/easyjson v0.7.7
-       github.com/mattn/go-colorable v0.1.11
-       github.com/mattn/go-isatty v0.0.19
-       github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d
-       github.com/mitchellh/go-homedir v1.1.0
-       github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
-       github.com/modern-go/reflect2 v1.0.2
-       github.com/pborman/uuid v1.2.1
-       github.com/pelletier/go-toml v1.9.3
-       github.com/pkg/errors v0.9.1
-       github.com/pmezard/go-difflib v1.0.0
-       github.com/robfig/cron v1.2.0
-       github.com/rogpeppe/go-internal v1.8.1
-       github.com/russross/blackfriday/v2 v2.1.0
-       github.com/sergi/go-diff v1.1.0
-       github.com/spf13/jwalterweatherman v1.1.0
-       github.com/spf13/pflag v1.0.6-0.20200504143853-81378bbcd8a1
-       github.com/stretchr/objx v0.5.0
-       github.com/subosito/gotenv v1.2.0
-       github.com/tidwall/match v1.1.1
-       github.com/tidwall/pretty v1.2.0
-       github.com/ugorji/go/codec v1.2.11
-       github.com/xanzy/ssh-agent v0.3.0
-       go.uber.org/atomic v1.9.0
+       github.com/iancoleman/strcase v0.3.0
+       github.com/manifoldco/promptui v0.9.0
+       github.com/mitchellh/hashstructure v1.1.0
+       github.com/x-cray/logrus-prefixed-formatter v0.5.2
        golang.org/x/mod v0.10.0
-       golang.org/x/net v0.10.0
-       golang.org/x/sys v0.8.0
-       golang.org/x/term v0.8.0
-       golang.org/x/text v0.9.0
-       golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
-       golang.org/x/tools v0.9.3
-       google.golang.org/appengine v1.6.7
-       google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf
-       google.golang.org/grpc v1.44.0
-       google.golang.org/protobuf v1.30.0
-       gopkg.in/ini.v1 v1.62.0
-       gopkg.in/warnings.v0 v0.1.2
-       gopkg.in/yaml.v2 v2.4.0
-       gopkg.in/yaml.v3 v3.0.1
 )
 
 //replace github.com/apache/incubator-devlake => ./
diff --git a/backend/go.sum b/backend/go.sum
index cbbfa50ae..4e74edcea 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -67,8 +67,6 @@ github.com/armon/go-metrics 
v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
 github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod 
h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
 github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 
h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
 github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod 
h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
-github.com/aws/aws-sdk-go v1.44.242 
h1:bb6Rqd7dxh1gTUoVXLJTNC2c+zNaHpLRlNKk0kGN3fc=
-github.com/aws/aws-sdk-go v1.44.242/go.mod 
h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
 github.com/aymerick/raymond 
v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod 
h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
 github.com/bgentry/speakeasy v0.1.0/go.mod 
h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
 github.com/bketelsen/crypt v0.0.4/go.mod 
h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
@@ -126,7 +124,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod 
h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
 github.com/denisenkom/go-mssqldb v0.9.0 
h1:RSohk2RsiZqLZ0zCjtfn3S4Gp4exhpBWHyQ7D0yGjAk=
 github.com/denisenkom/go-mssqldb v0.9.0/go.mod 
h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
 github.com/dgraph-io/badger v1.6.0/go.mod 
h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
-github.com/dgrijalva/jwt-go v3.2.0+incompatible 
h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
 github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod 
h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod 
h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
 github.com/dustin/go-humanize v1.0.0/go.mod 
h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@@ -345,8 +342,8 @@ github.com/hashicorp/serf v0.8.2/go.mod 
h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/J
 github.com/hpcloud/tail v1.0.0/go.mod 
h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod 
h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE=
 github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod 
h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE=
-github.com/iancoleman/strcase v0.2.0 
h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
-github.com/iancoleman/strcase v0.2.0/go.mod 
h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
+github.com/iancoleman/strcase v0.3.0 
h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
+github.com/iancoleman/strcase v0.3.0/go.mod 
h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod 
h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod 
h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/imdario/mergo v0.3.12 
h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
@@ -415,10 +412,6 @@ github.com/jinzhu/now v1.1.1/go.mod 
h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/
 github.com/jinzhu/now v1.1.2/go.mod 
h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
 github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
 github.com/jinzhu/now v1.1.5/go.mod 
h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
-github.com/jmespath/go-jmespath v0.4.0 
h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
-github.com/jmespath/go-jmespath v0.4.0/go.mod 
h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
-github.com/jmespath/go-jmespath/internal/testify v1.5.1 
h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
-github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod 
h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
 github.com/josharian/intern v1.0.0 
h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
 github.com/josharian/intern v1.0.0/go.mod 
h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
 github.com/json-iterator/go v1.1.6/go.mod 
h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@@ -534,7 +527,6 @@ github.com/mitchellh/hashstructure v1.1.0/go.mod 
h1:xUDAozZz0Wmdiufv0uyhnHkUTN6/
 github.com/mitchellh/iochan v1.0.0/go.mod 
h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
 github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod 
h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
 github.com/mitchellh/mapstructure v1.1.2/go.mod 
h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
-github.com/mitchellh/mapstructure v1.4.1 
h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag=
 github.com/mitchellh/mapstructure v1.4.1/go.mod 
h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
 github.com/mitchellh/mapstructure v1.5.0 
h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
 github.com/mitchellh/mapstructure v1.5.0/go.mod 
h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
@@ -847,7 +839,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod 
h1:p54w0d4576C0XHj96b
 golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod 
h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod 
h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
 golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod 
h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
-golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
 golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
 golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
 golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
@@ -949,7 +940,6 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod 
h1:oPkhp1MJrh7nUepCBc
 golang.org/x/sys v0.0.0-20220222200937-f2425489ef4c/go.mod 
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod 
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod 
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
@@ -957,7 +947,6 @@ golang.org/x/sys v0.8.0/go.mod 
h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod 
h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod 
h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod 
h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
-golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
 golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
 golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
@@ -970,7 +959,6 @@ golang.org/x/text v0.3.4/go.mod 
h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
-golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
 golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
 golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
 golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
diff --git a/backend/plugins/zentao/e2e/account_test.go 
b/backend/plugins/zentao/e2e/account_test.go
index 4204ee713..04ec31a6f 100644
--- a/backend/plugins/zentao/e2e/account_test.go
+++ b/backend/plugins/zentao/e2e/account_test.go
@@ -18,16 +18,32 @@ limitations under the License.
 package e2e
 
 import (
-       "testing"
-
+       gocontext "context"
        "github.com/apache/incubator-devlake/core/models/common"
        
"github.com/apache/incubator-devlake/core/models/domainlayer/crossdomain"
+       "github.com/apache/incubator-devlake/core/runner"
        "github.com/apache/incubator-devlake/helpers/e2ehelper"
+       helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
        "github.com/apache/incubator-devlake/plugins/zentao/impl"
        "github.com/apache/incubator-devlake/plugins/zentao/models"
        "github.com/apache/incubator-devlake/plugins/zentao/tasks"
+       "testing"
+       "time"
 )
 
+var basicContext = runner.CreateAppBasicRes()
+
+func getFakeAPIClient() *helper.ApiAsyncClient {
+       client, _ := helper.NewApiClient(gocontext.Background(),
+               "https://zentao.demo.haogs.cn/api.php/v1/";,
+               nil, time.Second*5, "",
+               basicContext,
+       )
+       return &helper.ApiAsyncClient{
+               ApiClient: client,
+       }
+}
+
 func TestZentaoAccountDataFlow(t *testing.T) {
 
        var zentao impl.Zentao
@@ -39,6 +55,7 @@ func TestZentaoAccountDataFlow(t *testing.T) {
                        ProjectId:    3,
                },
                AccountCache: tasks.NewAccountCache(dataflowTester.Dal, 1),
+               ApiClient:    getFakeAPIClient(),
        }
 
        // import raw data table
diff --git a/backend/plugins/zentao/e2e/bug_commits_test.go 
b/backend/plugins/zentao/e2e/bug_commits_test.go
index cc72f1021..0b5ab4b0e 100644
--- a/backend/plugins/zentao/e2e/bug_commits_test.go
+++ b/backend/plugins/zentao/e2e/bug_commits_test.go
@@ -38,6 +38,7 @@ func TestZentaoBugCommitsDataFlow(t *testing.T) {
                        ConnectionId: 1,
                        ProjectId:    22,
                },
+               ApiClient: getFakeAPIClient(),
        }
 
        // import _raw_zentao_api_bug_commits raw data table
diff --git a/backend/plugins/zentao/e2e/bug_test.go 
b/backend/plugins/zentao/e2e/bug_test.go
index c1397d408..cc8f16896 100644
--- a/backend/plugins/zentao/e2e/bug_test.go
+++ b/backend/plugins/zentao/e2e/bug_test.go
@@ -48,6 +48,7 @@ func TestZentaoBugDataFlow(t *testing.T) {
                },
                Bugs:         map[int64]struct{}{},
                AccountCache: tasks.NewAccountCache(dataflowTester.Dal, 1),
+               ApiClient:    getFakeAPIClient(),
        }
 
        // import raw data table
diff --git a/backend/plugins/zentao/e2e/changelog_test.go 
b/backend/plugins/zentao/e2e/changelog_test.go
index bd52b6603..b0d38ed40 100644
--- a/backend/plugins/zentao/e2e/changelog_test.go
+++ b/backend/plugins/zentao/e2e/changelog_test.go
@@ -43,9 +43,10 @@ func TestZentaoDbGetDataFlow(t *testing.T) {
                        ConnectionId: 1,
                        ProjectId:    0,
                },
-               Stories: map[int64]struct{}{},
-               Tasks:   map[int64]struct{}{10: {}, 11: {}, 14: {}},
-               Bugs:    map[int64]struct{}{1: {}, 2: {}, 3: {}, 4: {}},
+               Stories:   map[int64]struct{}{},
+               Tasks:     map[int64]struct{}{10: {}, 11: {}, 14: {}},
+               Bugs:      map[int64]struct{}{1: {}, 2: {}, 3: {}, 4: {}},
+               ApiClient: getFakeAPIClient(),
        }
 
        dataflowTester.ImportCsvIntoTabler("./raw_tables/zt_action.csv", 
models.ZentaoRemoteDbAction{})
diff --git a/backend/plugins/zentao/e2e/execution_test.go 
b/backend/plugins/zentao/e2e/execution_test.go
index 908d2ac5a..8fa7f8658 100644
--- a/backend/plugins/zentao/e2e/execution_test.go
+++ b/backend/plugins/zentao/e2e/execution_test.go
@@ -38,6 +38,7 @@ func TestZentaoExecutionDataFlow(t *testing.T) {
                        ConnectionId: 1,
                        ProjectId:    1,
                },
+               ApiClient: getFakeAPIClient(),
        }
 
        // import raw data table
diff --git a/backend/plugins/zentao/e2e/snapshot_tables/execution_sprint.csv 
b/backend/plugins/zentao/e2e/snapshot_tables/execution_sprint.csv
index 74bb7e65e..32e8e2b1b 100644
--- a/backend/plugins/zentao/e2e/snapshot_tables/execution_sprint.csv
+++ b/backend/plugins/zentao/e2e/snapshot_tables/execution_sprint.csv
@@ -1,3 +1,3 @@
 id,name,url,status,started_date,ended_date,completed_date,original_board_id
-zentao:ZentaoExecution:1:1,企业网站第一期,",7,1,",ACTIVE,,2022-06-01T00:00:00.000+00:00,,zentao:ZentaoProject:1:1
-zentao:ZentaoExecution:1:12,TR5,",1091,12,",CLOSED,2022-07-07T00:00:00.000+00:00,2022-11-03T00:00:00.000+00:00,,zentao:ZentaoProject:1:1
+zentao:ZentaoExecution:1:1,企业网站第一期,https://zentao.demo.haogs.cn/execution-view-1.html,ACTIVE,,2022-06-01T00:00:00.000+00:00,,zentao:ZentaoProject:1:1
+zentao:ZentaoExecution:1:12,TR5,https://zentao.demo.haogs.cn/execution-view-12.html,CLOSED,2022-07-07T00:00:00.000+00:00,2022-11-03T00:00:00.000+00:00,,zentao:ZentaoProject:1:1
diff --git a/backend/plugins/zentao/e2e/story_commits_test.go 
b/backend/plugins/zentao/e2e/story_commits_test.go
index 968c46e11..e3932d426 100644
--- a/backend/plugins/zentao/e2e/story_commits_test.go
+++ b/backend/plugins/zentao/e2e/story_commits_test.go
@@ -38,6 +38,7 @@ func TestZentaoStoryCommitsDataFlow(t *testing.T) {
                        ConnectionId: 1,
                        ProjectId:    1,
                },
+               ApiClient: getFakeAPIClient(),
        }
 
        // import _raw_zentao_api_story_commits raw data table
diff --git a/backend/plugins/zentao/e2e/story_test.go 
b/backend/plugins/zentao/e2e/story_test.go
index c02b8dfcf..baf06e887 100644
--- a/backend/plugins/zentao/e2e/story_test.go
+++ b/backend/plugins/zentao/e2e/story_test.go
@@ -48,6 +48,7 @@ func TestZentaoStoryDataFlow(t *testing.T) {
                },
                Stories:      map[int64]struct{}{},
                AccountCache: tasks.NewAccountCache(dataflowTester.Dal, 1),
+               ApiClient:    getFakeAPIClient(),
        }
 
        // import raw data table
diff --git a/backend/plugins/zentao/e2e/task_commits_test.go 
b/backend/plugins/zentao/e2e/task_commits_test.go
index eb1e79bf5..ff85f961b 100644
--- a/backend/plugins/zentao/e2e/task_commits_test.go
+++ b/backend/plugins/zentao/e2e/task_commits_test.go
@@ -38,6 +38,7 @@ func TestZentaoTaskCommitsDataFlow(t *testing.T) {
                        ConnectionId: 1,
                        ProjectId:    48,
                },
+               ApiClient: getFakeAPIClient(),
        }
 
        // import _raw_zentao_api_task_commits raw data table
diff --git a/backend/plugins/zentao/e2e/task_test.go 
b/backend/plugins/zentao/e2e/task_test.go
index 79f39cdef..1a2fbbe8d 100644
--- a/backend/plugins/zentao/e2e/task_test.go
+++ b/backend/plugins/zentao/e2e/task_test.go
@@ -51,6 +51,7 @@ func TestZentaoTaskDataFlow(t *testing.T) {
                },
                Tasks:        map[int64]struct{}{},
                AccountCache: tasks.NewAccountCache(dataflowTester.Dal, 1),
+               ApiClient:    getFakeAPIClient(),
        }
 
        // import raw data table
diff --git a/backend/plugins/zentao/tasks/execution_convertor.go 
b/backend/plugins/zentao/tasks/execution_convertor.go
index 9324e8eec..e24225c6d 100644
--- a/backend/plugins/zentao/tasks/execution_convertor.go
+++ b/backend/plugins/zentao/tasks/execution_convertor.go
@@ -18,6 +18,7 @@ limitations under the License.
 package tasks
 
 import (
+       "fmt"
        "reflect"
 
        "github.com/apache/incubator-devlake/core/dal"
@@ -43,6 +44,7 @@ var ConvertExecutionMeta = plugin.SubTaskMeta{
 func ConvertExecutions(taskCtx plugin.SubTaskContext) errors.Error {
        data := taskCtx.GetData().(*ZentaoTaskData)
        db := taskCtx.GetDal()
+       logger := taskCtx.GetLogger()
        executionIdGen := didgen.NewDomainIdGenerator(&models.ZentaoExecution{})
        projectIdGen := didgen.NewDomainIdGenerator(&models.ZentaoProject{})
        cursor, err := db.Cursor(
@@ -52,6 +54,12 @@ func ConvertExecutions(taskCtx plugin.SubTaskContext) 
errors.Error {
        if err != nil {
                return err
        }
+
+       homePage, getZentaoHomePageErr := 
getZentaoHomePage(data.ApiClient.GetEndpoint())
+       if getZentaoHomePageErr != nil {
+               logger.Error(getZentaoHomePageErr, "get zentao homepage")
+               return errors.Default.WrapRaw(getZentaoHomePageErr)
+       }
        defer cursor.Close()
        convertor, err := api.NewDataConverter(api.DataConverterArgs{
                InputRowType: reflect.TypeOf(models.ZentaoExecution{}),
@@ -82,13 +90,14 @@ func ConvertExecutions(taskCtx plugin.SubTaskContext) 
errors.Error {
                                        Id: 
executionIdGen.Generate(toolExecution.ConnectionId, toolExecution.Id),
                                },
                                Name:            toolExecution.Name,
-                               Url:             toolExecution.Path,
+                               Url:             
fmt.Sprintf("%s/execution-view-%d.html", homePage, toolExecution.Id),
                                Status:          domainStatus,
                                StartedDate:     
toolExecution.RealBegan.ToNullableTime(),
                                EndedDate:       
toolExecution.PlanEnd.ToNullableTime(),
                                CompletedDate:   
toolExecution.RealEnd.ToNullableTime(),
                                OriginalBoardID: 
projectIdGen.Generate(toolExecution.ConnectionId, data.Options.ProjectId),
                        }
+
                        boardSprint := &ticket.BoardSprint{
                                BoardId:  sprint.OriginalBoardID,
                                SprintId: sprint.Id,
diff --git a/backend/plugins/zentao/tasks/project_convertor.go 
b/backend/plugins/zentao/tasks/project_convertor.go
index 2c392854a..b09ef9405 100644
--- a/backend/plugins/zentao/tasks/project_convertor.go
+++ b/backend/plugins/zentao/tasks/project_convertor.go
@@ -19,9 +19,6 @@ package tasks
 
 import (
        "fmt"
-       "net/url"
-       "reflect"
-
        "github.com/apache/incubator-devlake/core/dal"
        "github.com/apache/incubator-devlake/core/errors"
        "github.com/apache/incubator-devlake/core/models/domainlayer"
@@ -30,6 +27,7 @@ import (
        "github.com/apache/incubator-devlake/core/plugin"
        "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
        "github.com/apache/incubator-devlake/plugins/zentao/models"
+       "reflect"
 )
 
 const RAW_PROJECT_TABLE = "zentao_api_projects"
@@ -57,16 +55,10 @@ func ConvertProjects(taskCtx plugin.SubTaskContext) 
errors.Error {
                return err
        }
        defer cursor.Close()
-       var protocol, host string
-       endpoint := data.ApiClient.ApiClient.GetEndpoint()
-       if endpoint != "" {
-               endpointURL, err := url.Parse(endpoint)
-               if err != nil {
-                       logger.Error(err, "parse: %s", endpoint)
-               } else {
-                       protocol = endpointURL.Scheme
-                       host = endpointURL.Host
-               }
+       homePage, getZentaoHomePageErr := 
getZentaoHomePage(data.ApiClient.GetEndpoint())
+       if getZentaoHomePageErr != nil {
+               logger.Error(getZentaoHomePageErr, "get zentao homepage")
+               return errors.Default.WrapRaw(getZentaoHomePageErr)
        }
        convertor, err := api.NewDataConverter(api.DataConverterArgs{
                InputRowType: reflect.TypeOf(models.ZentaoProject{}),
@@ -87,7 +79,7 @@ func ConvertProjects(taskCtx plugin.SubTaskContext) 
errors.Error {
                                Description: toolProject.Description,
                                CreatedDate: 
toolProject.OpenedDate.ToNullableTime(),
                                Type:        "scrum",
-                               Url:         
fmt.Sprintf("%s://%s/project-index-%d.html", protocol, host, 
data.Options.ProjectId),
+                               Url:         
fmt.Sprintf("%s/project-index-%d.html", homePage, data.Options.ProjectId),
                        }
                        results := make([]interface{}, 0)
                        results = append(results, domainBoard)
diff --git a/backend/plugins/zentao/tasks/shared.go 
b/backend/plugins/zentao/tasks/shared.go
index f02c7f885..158a7709d 100644
--- a/backend/plugins/zentao/tasks/shared.go
+++ b/backend/plugins/zentao/tasks/shared.go
@@ -339,3 +339,19 @@ func extractIdFromLogComment(logCommentType string, 
comment string) ([]string, e
        }
        return ret, nil
 }
+
+// getZentaoHomePage receive endpoint like 
"http://54.158.1.10:30001/api.php/v1/"; and return zentao's homepage like 
"http://54.158.1.10:30001/";
+func getZentaoHomePage(endpoint string) (string, error) {
+       if endpoint == "" {
+               return "", errors.Default.New("empty endpoint")
+       }
+       endpointURL, err := url.Parse(endpoint)
+       if err != nil {
+               return "", err
+       } else {
+               protocol := endpointURL.Scheme
+               host := endpointURL.Host
+               zentaoPath, _, _ := strings.Cut(endpointURL.Path, "/api.php/v1")
+               return fmt.Sprintf("%s://%s%s", protocol, host, zentaoPath), nil
+       }
+}
diff --git a/backend/plugins/zentao/tasks/shared_test.go 
b/backend/plugins/zentao/tasks/shared_test.go
index 3dfc5d8eb..3bec1ca23 100644
--- a/backend/plugins/zentao/tasks/shared_test.go
+++ b/backend/plugins/zentao/tasks/shared_test.go
@@ -152,3 +152,46 @@ func Test_extractIdFromLogComment(t *testing.T) {
                })
        }
 }
+
+func Test_getZentaoWebURL(t *testing.T) {
+       type args struct {
+               endpoint string
+       }
+       tests := []struct {
+               name    string
+               args    args
+               want    string
+               wantErr bool
+       }{
+               {
+                       name:    "without-zentao",
+                       args:    args{endpoint: 
"http://54.158.1.10:30001/api.php/v1/"},
+                       want:    "http://54.158.1.10:30001";,
+                       wantErr: false,
+               },
+               {
+                       name:    "with-zentao",
+                       args:    args{endpoint: 
"http://54.158.1.10:30001/zentao/api.php/v1/"},
+                       want:    "http://54.158.1.10:30001/zentao";,
+                       wantErr: false,
+               },
+               {
+                       name:    "with-others",
+                       args:    args{endpoint: 
"http://54.158.1.10:30001/abc/api.php/v1/"},
+                       want:    "http://54.158.1.10:30001/abc";,
+                       wantErr: false,
+               },
+       }
+       for _, tt := range tests {
+               t.Run(tt.name, func(t *testing.T) {
+                       got, err := getZentaoHomePage(tt.args.endpoint)
+                       if (err != nil) != tt.wantErr {
+                               t.Errorf("getZentaoHomePage() error = %v, 
wantErr %v", err, tt.wantErr)
+                               return
+                       }
+                       if got != tt.want {
+                               t.Errorf("getZentaoHomePage() got = %v, want 
%v", got, tt.want)
+                       }
+               })
+       }
+}

Reply via email to