Skip to content

Commit

Permalink
Merge pull request #52 from koderover/release/v1.2.0
Browse files Browse the repository at this point in the history
zadig team push release 1.2.0
  • Loading branch information
landylee007 authored Jul 6, 2021
2 parents 2a0f244 + 5a4dc56 commit 2b73b6f
Show file tree
Hide file tree
Showing 393 changed files with 27,076 additions and 5,489 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
!/go.mod
!/go.sum
!/zadig-portal
!/third_party

2 changes: 2 additions & 0 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ The council will make a decision for the nomination. The candidate has to have d
- [piao100101](https://github.com/piao100101)
- [nanzm](https://github.com/nanzm)
- [solomon-cc](https://github.com/solomon-cc)


29 changes: 29 additions & 0 deletions cmd/hubagent/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Copyright 2021 The KodeRover Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
"log"

"github.com/koderover/zadig/pkg/microservice/hubagent/server"
)

func main() {
if err := server.Serve(); err != nil {
log.Fatal(err)
}
}
34 changes: 17 additions & 17 deletions pkg/tool/gitlab/client.go → cmd/hubserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package gitlab
package main

import (
"fmt"
"context"
"log"
"os/signal"
"syscall"

"github.com/xanzy/go-gitlab"
"github.com/koderover/zadig/pkg/microservice/hubserver/server"
)

type Client struct {
*gitlab.Client
}

func NewGitlabClient(address, accessToken string) (*Client, error) {
cli, err := gitlab.NewOAuthClient(accessToken, gitlab.WithBaseURL(address))
if err != nil {
return nil, fmt.Errorf("set base url failed, err:%v", err)
func main() {
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGINT)
go func() {
select {
case <-ctx.Done():
stop()
}
}()

if err := server.Serve(ctx); err != nil {
log.Fatal(err)
}

client := &Client{
Client: cli,
}

return client, nil
}
11 changes: 11 additions & 0 deletions docker/hub-agent.Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#golang-deps.Dockerfile.inc

RUN go build -v -o /hubagent ./cmd/hubagent/main.go

#alpine-base.Dockerfile.inc

WORKDIR /app

COPY --from=build /hubagent .

ENTRYPOINT ["/app/hubagent"]
11 changes: 11 additions & 0 deletions docker/hub-server.Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#golang-deps.Dockerfile.inc

RUN go build -v -o /hubserver ./cmd/hubserver/main.go

#alpine-base.Dockerfile.inc

WORKDIR /app

COPY --from=build /hubserver .

ENTRYPOINT ["/app/hubserver"]
1 change: 0 additions & 1 deletion examples/website/yaml/website-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ spec:
- port: 80
selector:
app: website-example
tier: frontend
---
apiVersion: apps/v1
kind: Deployment
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/bshuster-repo/logrus-logstash-hook v1.0.0 // indirect
github.com/bugsnag/bugsnag-go v2.1.0+incompatible // indirect
github.com/bugsnag/panicwrap v1.3.1 // indirect
github.com/cenkalti/backoff/v3 v3.0.0
github.com/coocood/freecache v1.1.0
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker v1.4.2-0.20200204220554-5f6d6f3f2203
Expand All @@ -24,14 +25,14 @@ require (
github.com/go-openapi/spec v0.19.5 // indirect
github.com/go-resty/resty/v2 v2.6.0
github.com/gofrs/uuid v4.0.0+incompatible // indirect
github.com/google/go-github/v35 v35.1.0
github.com/google/go-github/v35 v35.3.0
github.com/google/uuid v1.2.0
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.7.3
github.com/gorilla/websocket v1.4.2
github.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/go-multierror v1.1.1
github.com/jasonlvhit/gocron v0.0.0-20171226191223-3c914c8681c3
github.com/jinzhu/now v1.1.2
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
Expand All @@ -55,7 +56,7 @@ require (
github.com/swaggo/gin-swagger v1.3.0
github.com/swaggo/swag v1.5.1
github.com/ugorji/go v1.2.0 // indirect
github.com/xanzy/go-gitlab v0.44.0
github.com/xanzy/go-gitlab v0.50.0
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/yvasiyarov/go-metrics v0.0.0-20150112132944-c25f46c4b940 // indirect
github.com/yvasiyarov/gorelic v0.0.7 // indirect
Expand Down
23 changes: 14 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ github.com/bugsnag/bugsnag-go v2.1.0+incompatible/go.mod h1:2oa8nejYd4cQ/b0hMIop
github.com/bugsnag/panicwrap v1.3.1 h1:pmuhHlhbUV4OOrGDvoiMjHSZzwRcL+I9cIzYKiW4lII=
github.com/bugsnag/panicwrap v1.3.1/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c=
github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
Expand Down Expand Up @@ -382,12 +385,13 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-github/v29 v29.0.2 h1:opYN6Wc7DOz7Ku3Oh4l7prmkOMwEcQxpFtxdU8N8Pts=
github.com/google/go-github/v29 v29.0.2/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E=
github.com/google/go-github/v35 v35.1.0 h1:KkwZnKWQ/0YryvXjZlCN/3EGRJNp6VCZPKo+RG9mG28=
github.com/google/go-github/v35 v35.1.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs=
github.com/google/go-github/v35 v35.3.0 h1:fU+WBzuukn0VssbayTT+Zo3/ESKX9JYWjbZTLOTEyho=
github.com/google/go-github/v35 v35.3.0/go.mod h1:yWB7uCcVWaUbUP74Aq3whuMySRMatyRmq5U9FTNlbio=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
Expand Down Expand Up @@ -451,10 +455,11 @@ github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxC
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-retryablehttp v0.6.4 h1:BbgctKO892xEyOXnGiaAwIoSq1QZ/SS4AhjoAh9DnfY=
github.com/hashicorp/go-retryablehttp v0.6.4/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-retryablehttp v0.6.8 h1:92lWxgpa+fF3FozM4B3UZtHZMJX8T5XT+TFdCxsPyWs=
github.com/hashicorp/go-retryablehttp v0.6.8/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
Expand Down Expand Up @@ -614,6 +619,7 @@ github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7P
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
Expand Down Expand Up @@ -830,8 +836,8 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243 h1:R43TdZy32XXSXjJn7M/HhALJ9imq6ztLnChfYJpVDnM=
github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/xanzy/go-gitlab v0.44.0 h1:cEiGhqu7EpFGuei2a2etAwB+x6403E5CvpLn35y+GPs=
github.com/xanzy/go-gitlab v0.44.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=
github.com/xanzy/go-gitlab v0.50.0 h1:t7IoYTrnLSbdEZN7d8X/5zcr+ZM4TZQ2mXa8MqWlAZQ=
github.com/xanzy/go-gitlab v0.50.0/go.mod h1:Q+hQhV508bDPoBijv7YjK/Lvlb4PhVhJdKqXVQrUoAE=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c h1:u40Z8hqBAAQyv+vATcGgV0YCnDjqSL7/q/JyPhhJSPk=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc h1:n+nNi93yXLkJvKwXNP9d55HC7lGK4H/SRcwB5IaUZLo=
Expand Down Expand Up @@ -947,7 +953,6 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down
10 changes: 1 addition & 9 deletions image.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ IMAGE_TAG:=$(shell ./docker/image-tag)
VCS_REF:=$(shell git rev-parse HEAD)
TAG ?= ${DATE}-${IMAGE_TAG}

BASE_TARGETS = aslan warpdrive cron podexec jenkins-plugin predator-plugin


TARGETS =
ifndef ENTERPRISE_TARGETS
TARGETS = $(BASE_TARGETS)
else
TARGETS = $(ENTERPRISE_TARGETS)
endif
TARGETS = aslan warpdrive cron podexec jenkins-plugin predator-plugin hub-server hub-agent

ALL_IMAGES=$(TARGETS:=.image)
ALL_PUSHES=$(TARGETS:=.push)
Expand Down
12 changes: 12 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,15 @@ func LogFile() string {
func RequestLogFile() string {
return LogPath() + RequestLogName()
}

func AslanURL() string {
return viper.GetString(setting.ENVAslanURL)
}

func PoetryAPIServer() string {
return viper.GetString(setting.ENVPoetryAPIServer)
}

func PoetryAPIRootKey() string {
return viper.GetString(setting.ENVPoetryAPIRootKey)
}
7 changes: 6 additions & 1 deletion pkg/microservice/aslan/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package config

import (
"errors"
"fmt"
"strconv"
"strings"

Expand Down Expand Up @@ -125,7 +126,7 @@ func S3StoragePath() string {
}

func EnableGitCheck() bool {
return viper.GetString(setting.EnableGitCheck) == "true"
return true
}

func S3StorageAK() string {
Expand Down Expand Up @@ -253,3 +254,7 @@ func SonarRootToken() string {
func SonarInternalAddr() string {
return viper.GetString(setting.EnvSonarInternalAddr)
}

func WebHookURL() string {
return fmt.Sprintf("%s/api/aslan/webhook", AslanURL())
}
2 changes: 1 addition & 1 deletion pkg/microservice/aslan/core/build/handler/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

buildservice "github.com/koderover/zadig/pkg/microservice/aslan/core/build/service"
commonmodels "github.com/koderover/zadig/pkg/microservice/aslan/core/common/repository/models"
internalhandler "github.com/koderover/zadig/pkg/microservice/aslan/internal/handler"
internalhandler "github.com/koderover/zadig/pkg/shared/handler"
e "github.com/koderover/zadig/pkg/tool/errors"
"github.com/koderover/zadig/pkg/tool/log"
"github.com/koderover/zadig/pkg/types/permission"
Expand Down
12 changes: 6 additions & 6 deletions pkg/microservice/aslan/core/build/handler/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ package handler
import (
"github.com/gin-gonic/gin"

"github.com/koderover/zadig/pkg/microservice/aslan/middleware"
gin2 "github.com/koderover/zadig/pkg/middleware/gin"
"github.com/koderover/zadig/pkg/types/permission"
)

type Router struct{}

func (*Router) Inject(router *gin.RouterGroup) {
router.Use(middleware.Auth())
router.Use(gin2.Auth())

build := router.Group("build")
{
build.GET("/:name/:version", FindBuildModule)
build.GET("", ListBuildModules)
build.POST("", middleware.StoreProductName, middleware.IsHavePermission([]string{permission.BuildManageUUID}, permission.ContextKeyType), middleware.UpdateOperationLogStatus, CreateBuildModule)
build.PUT("", middleware.StoreProductName, middleware.IsHavePermission([]string{permission.BuildManageUUID}, permission.ContextKeyType), middleware.UpdateOperationLogStatus, UpdateBuildModule)
build.DELETE("", middleware.IsHavePermission([]string{permission.BuildDeleteUUID}, permission.QueryType), middleware.UpdateOperationLogStatus, DeleteBuildModule)
build.POST("/targets", middleware.IsHavePermission([]string{permission.BuildManageUUID}, permission.QueryType), middleware.UpdateOperationLogStatus, UpdateBuildTargets)
build.POST("", gin2.StoreProductName, gin2.IsHavePermission([]string{permission.BuildManageUUID}, permission.ContextKeyType), gin2.UpdateOperationLogStatus, CreateBuildModule)
build.PUT("", gin2.StoreProductName, gin2.IsHavePermission([]string{permission.BuildManageUUID}, permission.ContextKeyType), gin2.UpdateOperationLogStatus, UpdateBuildModule)
build.DELETE("", gin2.IsHavePermission([]string{permission.BuildDeleteUUID}, permission.QueryType), gin2.UpdateOperationLogStatus, DeleteBuildModule)
build.POST("/targets", gin2.IsHavePermission([]string{permission.BuildManageUUID}, permission.QueryType), gin2.UpdateOperationLogStatus, UpdateBuildTargets)
}

target := router.Group("targets")
Expand Down
2 changes: 1 addition & 1 deletion pkg/microservice/aslan/core/build/handler/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/gin-gonic/gin"

buildservice "github.com/koderover/zadig/pkg/microservice/aslan/core/build/service"
internalhandler "github.com/koderover/zadig/pkg/microservice/aslan/internal/handler"
internalhandler "github.com/koderover/zadig/pkg/shared/handler"
)

func ListDeployTarget(c *gin.Context) {
Expand Down
3 changes: 3 additions & 0 deletions pkg/microservice/aslan/core/build/service/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ func UpdateBuildTargets(name, productName string, targets []*commonmodels.Servic
return e.ErrUpdateBuildParam.AddErr(err)
}

//处理云主机服务组件逻辑
handleServiceTargets(name, productName, targets)

err := commonrepo.NewBuildColl().UpdateTargets(name, productName, targets)
if err != nil {
log.Errorf("[Build.UpdateServices] %s error: %v", name, err)
Expand Down
19 changes: 19 additions & 0 deletions pkg/microservice/aslan/core/build/service/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ func ListDeployTarget(productName string, log *zap.SugaredLogger) ([]*commonmode
}
}
}
case setting.PMDeployType:
target := fmt.Sprintf("%s-%s-%s", serviceTmpl.ProductName, serviceTmpl.ServiceName, serviceTmpl.ServiceName)
if _, ok := targetMap[target]; !ok {
targetMap[target] = true
ServiceObject := &commonmodels.ServiceModuleTarget{
ProductName: serviceTmpl.ProductName,
ServiceName: serviceTmpl.ServiceName,
ServiceModule: serviceTmpl.ServiceName,
}
if !buildTargets.Has(target) {
serviceObjects = append(serviceObjects, ServiceObject)
}
}
}
}
return serviceObjects, nil
Expand Down Expand Up @@ -121,6 +134,12 @@ func ListContainers(productName string, log *zap.SugaredLogger) ([]*commonmodels
ServiceModule: container.Name,
})
}
} else if service.Type == setting.PMDeployType {
containerList = append(containerList, &commonmodels.ServiceModuleTarget{
ProductName: service.ProductName,
ServiceName: service.ServiceName,
ServiceModule: service.ServiceName,
})
}
}
return containerList, nil
Expand Down
Loading

0 comments on commit 2b73b6f

Please sign in to comment.