Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:devtron-labs/devtron into extera…
Browse files Browse the repository at this point in the history
…l-fix-from-main
  • Loading branch information
ayu-devtron committed Nov 14, 2024
2 parents 7b36eeb + f7b3f9c commit 7d0b986
Show file tree
Hide file tree
Showing 88 changed files with 2,034 additions and 1,742 deletions.
14 changes: 9 additions & 5 deletions Wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ import (
"github.com/devtron-labs/devtron/pkg/asyncProvider"
"github.com/devtron-labs/devtron/pkg/attributes"
"github.com/devtron-labs/devtron/pkg/build"
pipeline6 "github.com/devtron-labs/devtron/pkg/build/pipeline"
"github.com/devtron-labs/devtron/pkg/bulkAction"
"github.com/devtron-labs/devtron/pkg/chart"
"github.com/devtron-labs/devtron/pkg/chart/gitOpsConfig"
Expand All @@ -132,6 +133,8 @@ import (
deployment2 "github.com/devtron-labs/devtron/pkg/deployment"
"github.com/devtron-labs/devtron/pkg/deployment/common"
git2 "github.com/devtron-labs/devtron/pkg/deployment/gitOps/git"
"github.com/devtron-labs/devtron/pkg/deployment/manifest/configMapAndSecret"
"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate"
"github.com/devtron-labs/devtron/pkg/deployment/manifest/publish"
"github.com/devtron-labs/devtron/pkg/deploymentGroup"
"github.com/devtron-labs/devtron/pkg/dockerRegistry"
Expand Down Expand Up @@ -209,7 +212,6 @@ func InitializeApp() (*App, error) {
workflow3.WorkflowWireSet,

devtronResource.DevtronResourceWireSet,

// -------wireset end ----------
// -------
gitSensor.GetConfig,
Expand Down Expand Up @@ -819,10 +821,10 @@ func InitializeApp() (*App, error) {
wire.Bind(new(history3.PrePostCdScriptHistoryService), new(*history3.PrePostCdScriptHistoryServiceImpl)),
history3.NewPrePostCiScriptHistoryServiceImpl,
wire.Bind(new(history3.PrePostCiScriptHistoryService), new(*history3.PrePostCiScriptHistoryServiceImpl)),
history3.NewDeploymentTemplateHistoryServiceImpl,
wire.Bind(new(history3.DeploymentTemplateHistoryService), new(*history3.DeploymentTemplateHistoryServiceImpl)),
history3.NewConfigMapHistoryServiceImpl,
wire.Bind(new(history3.ConfigMapHistoryService), new(*history3.ConfigMapHistoryServiceImpl)),
deploymentTemplate.NewDeploymentTemplateHistoryServiceImpl,
wire.Bind(new(deploymentTemplate.DeploymentTemplateHistoryService), new(*deploymentTemplate.DeploymentTemplateHistoryServiceImpl)),
configMapAndSecret.NewConfigMapHistoryServiceImpl,
wire.Bind(new(configMapAndSecret.ConfigMapHistoryService), new(*configMapAndSecret.ConfigMapHistoryServiceImpl)),
history3.NewPipelineStrategyHistoryServiceImpl,
wire.Bind(new(history3.PipelineStrategyHistoryService), new(*history3.PipelineStrategyHistoryServiceImpl)),
history3.NewGitMaterialHistoryServiceImpl,
Expand Down Expand Up @@ -903,6 +905,8 @@ func InitializeApp() (*App, error) {
wire.Bind(new(pipeline.CiBuildConfigService), new(*pipeline.CiBuildConfigServiceImpl)),
pipeline.NewCiTemplateServiceImpl,
wire.Bind(new(pipeline.CiTemplateService), new(*pipeline.CiTemplateServiceImpl)),
pipeline6.NewCiTemplateReadServiceImpl,
wire.Bind(new(pipeline6.CiTemplateReadService), new(*pipeline6.CiTemplateReadServiceImpl)),
router.NewGlobalCMCSRouterImpl,
wire.Bind(new(router.GlobalCMCSRouter), new(*router.GlobalCMCSRouterImpl)),
restHandler.NewGlobalCMCSRestHandlerImpl,
Expand Down
12 changes: 6 additions & 6 deletions api/appbean/AppDetail.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package appbean
import (
"github.com/devtron-labs/devtron/internal/sql/models"
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
bean2 "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
"github.com/devtron-labs/devtron/pkg/chartRepo/repository"
"github.com/devtron-labs/devtron/pkg/pipeline/bean"
"github.com/devtron-labs/devtron/pkg/pipeline/bean/CiPipeline"
)

type AppDetail struct {
Expand Down Expand Up @@ -62,11 +62,11 @@ type GitMaterial struct {
}

type DockerConfig struct {
DockerRegistry string `json:"dockerRegistry" validate:"required"`
DockerRepository string `json:"dockerRepository" validate:"required"`
CiBuildConfig *CiPipeline.CiBuildConfigBean `json:"ciBuildConfig"`
DockerBuildConfig *DockerBuildConfig `json:"dockerBuildConfig,omitempty"` // Deprecated, should use CiBuildConfig for development
CheckoutPath string `json:"checkoutPath"`
DockerRegistry string `json:"dockerRegistry" validate:"required"`
DockerRepository string `json:"dockerRepository" validate:"required"`
CiBuildConfig *bean2.CiBuildConfigBean `json:"ciBuildConfig"`
DockerBuildConfig *DockerBuildConfig `json:"dockerBuildConfig,omitempty"` // Deprecated, should use CiBuildConfig for development
CheckoutPath string `json:"checkoutPath"`
}

type DockerBuildConfig struct {
Expand Down
2 changes: 2 additions & 0 deletions api/k8s/capacity/k8sCapacityRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ func (handler *K8sCapacityRestHandlerImpl) GetClusterListRaw(w http.ResponseWrit
Id: cluster.Id,
Name: cluster.ClusterName,
ErrorInConnection: cluster.ErrorInConnecting,
IsVirtualCluster: cluster.IsVirtualCluster,
IsProd: cluster.IsProd,
}
clusterDetailList = append(clusterDetailList, clusterDetail)
}
Expand Down
12 changes: 6 additions & 6 deletions api/restHandler/CoreAppRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"errors"
"fmt"
app2 "github.com/devtron-labs/devtron/api/restHandler/app/pipeline/configure"
"github.com/devtron-labs/devtron/pkg/pipeline/bean/CiPipeline"
bean3 "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
"net/http"
"strconv"
"strings"
Expand Down Expand Up @@ -1323,9 +1323,9 @@ func (handler CoreAppRestHandlerImpl) createDockerConfig(appId int, dockerConfig
dockerBuildConfig := dockerConfig.DockerBuildConfig
if dockerBuildConfig != nil {
dockerConfig.CheckoutPath = dockerBuildConfig.GitCheckoutPath
dockerConfig.CiBuildConfig = &CiPipeline.CiBuildConfigBean{
CiBuildType: CiPipeline.SELF_DOCKERFILE_BUILD_TYPE,
DockerBuildConfig: &CiPipeline.DockerBuildConfig{
dockerConfig.CiBuildConfig = &bean3.CiBuildConfigBean{
CiBuildType: bean3.SELF_DOCKERFILE_BUILD_TYPE,
DockerBuildConfig: &bean3.DockerBuildConfig{
DockerfilePath: dockerBuildConfig.DockerfileRelativePath,
DockerBuildOptions: dockerBuildConfig.DockerBuildOptions,
Args: dockerBuildConfig.Args,
Expand Down Expand Up @@ -1546,7 +1546,7 @@ func (handler CoreAppRestHandlerImpl) createWorkflows(ctx context.Context, appId
//Creating CI pipeline starts
ciPipeline, err := handler.createCiPipeline(appId, userId, workflowId, workflow.CiPipeline)
if err != nil {
if err.Error() == CiPipeline.PIPELINE_NAME_ALREADY_EXISTS_ERROR {
if err.Error() == bean3.PIPELINE_NAME_ALREADY_EXISTS_ERROR {
handler.logger.Errorw("service err, DeleteAppWorkflow ", "err", err)
return err, http.StatusBadRequest
}
Expand Down Expand Up @@ -1683,7 +1683,7 @@ func (handler CoreAppRestHandlerImpl) createCiPipeline(appId int, userId int32,
ParentCiPipeline: ciPipelineData.ParentCiPipeline,
ParentAppId: ciPipelineData.ParentAppId,
LinkedCount: ciPipelineData.LinkedCount,
PipelineType: CiPipeline.PipelineType(ciPipelineData.PipelineType),
PipelineType: bean3.PipelineType(ciPipelineData.PipelineType),
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (
"encoding/json"
"errors"
"fmt"
bean2 "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
"golang.org/x/exp/maps"
"io"
"net/http"
"strconv"
"strings"

"github.com/devtron-labs/devtron/pkg/pipeline/bean/CiPipeline"
"github.com/devtron-labs/devtron/util/response/pagination"
"github.com/gorilla/schema"

Expand Down Expand Up @@ -441,8 +441,8 @@ func (handler *PipelineConfigRestHandlerImpl) PatchCiPipelines(w http.ResponseWr
ciConfigRequest := bean.CiConfigRequest{}
ciConfigRequest.DockerRegistry = emptyDockerRegistry
ciConfigRequest.AppId = patchRequest.AppId
ciConfigRequest.CiBuildConfig = &CiPipeline.CiBuildConfigBean{}
ciConfigRequest.CiBuildConfig.CiBuildType = CiPipeline.SKIP_BUILD_TYPE
ciConfigRequest.CiBuildConfig = &bean2.CiBuildConfigBean{}
ciConfigRequest.CiBuildConfig.CiBuildType = bean2.SKIP_BUILD_TYPE
ciConfigRequest.UserId = patchRequest.UserId
if patchRequest.CiPipeline == nil || patchRequest.CiPipeline.CiMaterial == nil {
handler.Logger.Errorw("Invalid patch ci-pipeline request", "request", patchRequest, "err", "invalid CiPipeline data")
Expand All @@ -463,7 +463,7 @@ func (handler *PipelineConfigRestHandlerImpl) PatchCiPipelines(w http.ResponseWr
}
createResp, err := handler.pipelineBuilder.PatchCiPipeline(&patchRequest)
if err != nil {
if err.Error() == CiPipeline.PIPELINE_NAME_ALREADY_EXISTS_ERROR {
if err.Error() == bean2.PIPELINE_NAME_ALREADY_EXISTS_ERROR {
handler.Logger.Errorw("service err, pipeline name already exist ", "err", err)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
Expand Down Expand Up @@ -2254,7 +2254,7 @@ func (handler *PipelineConfigRestHandlerImpl) GetSourceCiDownStreamInfo(w http.R
return
}

req := &CiPipeline.SourceCiDownStreamFilters{}
req := &bean2.SourceCiDownStreamFilters{}
err = decoder.Decode(req, r.URL.Query())
if err != nil {
handler.Logger.Errorw("request err, GetSourceCiDownStreamInfo", "err", err, "payload", req)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"context"
"encoding/json"
"fmt"
bean3 "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
"github.com/devtron-labs/devtron/pkg/chart/gitOpsConfig"
"github.com/devtron-labs/devtron/pkg/deployment/manifest/deployedAppMetrics"
"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate"
"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate/chartRef"
bean3 "github.com/devtron-labs/devtron/pkg/pipeline/bean/CiPipeline"
"io"
"net/http"
"strconv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package history

import (
"fmt"
"github.com/devtron-labs/devtron/pkg/deployment/manifest/configMapAndSecret"
"github.com/devtron-labs/devtron/pkg/deployment/manifest/deploymentTemplate"
"net/http"
"strconv"

Expand All @@ -44,8 +46,8 @@ type PipelineHistoryRestHandlerImpl struct {
userAuthService user.UserService
enforcer casbin.Enforcer
strategyHistoryService history2.PipelineStrategyHistoryService
deploymentTemplateHistoryService history2.DeploymentTemplateHistoryService
configMapHistoryService history2.ConfigMapHistoryService
deploymentTemplateHistoryService deploymentTemplate.DeploymentTemplateHistoryService
configMapHistoryService configMapAndSecret.ConfigMapHistoryService
prePostCiScriptHistoryService history2.PrePostCiScriptHistoryService
prePostCdScriptHistoryService history2.PrePostCdScriptHistoryService
enforcerUtil rbac.EnforcerUtil
Expand All @@ -54,8 +56,8 @@ type PipelineHistoryRestHandlerImpl struct {

func NewPipelineHistoryRestHandlerImpl(logger *zap.SugaredLogger, userAuthService user.UserService,
enforcer casbin.Enforcer, strategyHistoryService history2.PipelineStrategyHistoryService,
deploymentTemplateHistoryService history2.DeploymentTemplateHistoryService,
configMapHistoryService history2.ConfigMapHistoryService,
deploymentTemplateHistoryService deploymentTemplate.DeploymentTemplateHistoryService,
configMapHistoryService configMapAndSecret.ConfigMapHistoryService,
prePostCiScriptHistoryService history2.PrePostCiScriptHistoryService,
prePostCdScriptHistoryService history2.PrePostCdScriptHistoryService,
enforcerUtil rbac.EnforcerUtil,
Expand Down
2 changes: 1 addition & 1 deletion client/cron/CiTriggerCron.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/caarlos0/env"
repository2 "github.com/devtron-labs/devtron/internal/sql/repository"
"github.com/devtron-labs/devtron/pkg/bean"
pipelineConfigBean "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
"github.com/devtron-labs/devtron/pkg/pipeline"
pipelineConfigBean "github.com/devtron-labs/devtron/pkg/pipeline/bean/CiPipeline"
"github.com/devtron-labs/devtron/pkg/pipeline/repository"
repository3 "github.com/devtron-labs/devtron/pkg/plugin/repository"
cron2 "github.com/devtron-labs/devtron/util/cron"
Expand Down
28 changes: 14 additions & 14 deletions client/telemetry/TelemetryEventClientExtended.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"encoding/json"
cloudProviderIdentifier "github.com/devtron-labs/common-lib/cloud-provider-identifier"
client "github.com/devtron-labs/devtron/api/helm-app/gRPC"
"github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
"github.com/devtron-labs/devtron/pkg/deployment/gitOps/config"
"github.com/devtron-labs/devtron/pkg/pipeline/bean/CiPipeline"
cron3 "github.com/devtron-labs/devtron/util/cron"
"net/http"
"time"
Expand Down Expand Up @@ -387,16 +387,16 @@ func (impl *TelemetryEventClientImplExtended) SendSummaryEvent(eventType string)
}

payload.SelfDockerfileCount = selfDockerfileCount
payload.SelfDockerfileSuccessCount = successCount[CiPipeline.SELF_DOCKERFILE_BUILD_TYPE]
payload.SelfDockerfileFailureCount = failureCount[CiPipeline.SELF_DOCKERFILE_BUILD_TYPE]
payload.SelfDockerfileSuccessCount = successCount[bean.SELF_DOCKERFILE_BUILD_TYPE]
payload.SelfDockerfileFailureCount = failureCount[bean.SELF_DOCKERFILE_BUILD_TYPE]

payload.ManagedDockerfileCount = managedDockerfileCount
payload.ManagedDockerfileSuccessCount = successCount[CiPipeline.MANAGED_DOCKERFILE_BUILD_TYPE]
payload.ManagedDockerfileFailureCount = failureCount[CiPipeline.MANAGED_DOCKERFILE_BUILD_TYPE]
payload.ManagedDockerfileSuccessCount = successCount[bean.MANAGED_DOCKERFILE_BUILD_TYPE]
payload.ManagedDockerfileFailureCount = failureCount[bean.MANAGED_DOCKERFILE_BUILD_TYPE]

payload.BuildPackCount = buildpackCount
payload.BuildPackSuccessCount = successCount[CiPipeline.BUILDPACK_BUILD_TYPE]
payload.BuildPackFailureCount = failureCount[CiPipeline.BUILDPACK_BUILD_TYPE]
payload.BuildPackSuccessCount = successCount[bean.BUILDPACK_BUILD_TYPE]
payload.BuildPackFailureCount = failureCount[bean.BUILDPACK_BUILD_TYPE]

reqBody, err := json.Marshal(payload)
if err != nil {
Expand All @@ -420,24 +420,24 @@ func (impl *TelemetryEventClientImplExtended) SendSummaryEvent(eventType string)

func (impl *TelemetryEventClientImplExtended) getCiBuildTypeData() (int, int, int) {
countByBuildType := impl.ciBuildConfigService.GetCountByBuildType()
return countByBuildType[CiPipeline.SELF_DOCKERFILE_BUILD_TYPE], countByBuildType[CiPipeline.MANAGED_DOCKERFILE_BUILD_TYPE], countByBuildType[CiPipeline.BUILDPACK_BUILD_TYPE]
return countByBuildType[bean.SELF_DOCKERFILE_BUILD_TYPE], countByBuildType[bean.MANAGED_DOCKERFILE_BUILD_TYPE], countByBuildType[bean.BUILDPACK_BUILD_TYPE]
}

func (impl *TelemetryEventClientImplExtended) getCiBuildTypeVsStatusVsCount() (successCount map[CiPipeline.CiBuildType]int, failureCount map[CiPipeline.CiBuildType]int) {
successCount = make(map[CiPipeline.CiBuildType]int)
failureCount = make(map[CiPipeline.CiBuildType]int)
func (impl *TelemetryEventClientImplExtended) getCiBuildTypeVsStatusVsCount() (successCount map[bean.CiBuildType]int, failureCount map[bean.CiBuildType]int) {
successCount = make(map[bean.CiBuildType]int)
failureCount = make(map[bean.CiBuildType]int)
buildTypeAndStatusVsCount := impl.ciWorkflowRepository.FindBuildTypeAndStatusDataOfLast1Day()
for _, buildTypeCount := range buildTypeAndStatusVsCount {
if buildTypeCount == nil {
continue
}
if buildTypeCount.Type == "" {
buildTypeCount.Type = string(CiPipeline.SELF_DOCKERFILE_BUILD_TYPE)
buildTypeCount.Type = string(bean.SELF_DOCKERFILE_BUILD_TYPE)
}
if buildTypeCount.Status == "Succeeded" {
successCount[CiPipeline.CiBuildType(buildTypeCount.Type)] = buildTypeCount.Count
successCount[bean.CiBuildType(buildTypeCount.Type)] = buildTypeCount.Count
} else {
failureCount[CiPipeline.CiBuildType(buildTypeCount.Type)] = buildTypeCount.Count
failureCount[bean.CiBuildType(buildTypeCount.Type)] = buildTypeCount.Count
}
}
return successCount, failureCount
Expand Down
2 changes: 1 addition & 1 deletion cmd/external-app/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
github.com/go-pg/pg v6.15.1+incompatible
github.com/go-resty/resty/v2 v2.7.0
github.com/gogo/protobuf v1.3.2
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang-jwt/jwt/v4 v4.5.1
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/google/cel-go v0.17.8
Expand Down Expand Up @@ -90,7 +90,7 @@ require (
k8s.io/client-go v0.29.7
k8s.io/helm v2.12.3+incompatible
k8s.io/kubectl v0.29.7
k8s.io/kubernetes v1.29.6
k8s.io/kubernetes v1.29.10
k8s.io/metrics v0.29.7
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/yaml v1.4.0
Expand Down Expand Up @@ -288,7 +288,7 @@ require gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect

replace (
github.com/argoproj/argo-workflows/v3 v3.5.10 => github.com/devtron-labs/argo-workflows/v3 v3.5.10
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20241024135802-b4888f54a136
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20241114074942-28eb96763c64
github.com/go-check/check => github.com/go-check/check v0.0.0-20180628173108-788fd7840127
github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.5.5
k8s.io/api => k8s.io/api v0.29.7
Expand Down
Loading

0 comments on commit 7d0b986

Please sign in to comment.