Skip to content

Commit

Permalink
Merge branch 'main' into release-bot
Browse files Browse the repository at this point in the history
  • Loading branch information
pawan-mehta-dt authored Jan 27, 2025
2 parents d7a0bca + 564fe99 commit 8628903
Show file tree
Hide file tree
Showing 433 changed files with 39,283 additions and 10,942 deletions.
1 change: 1 addition & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ types:
- doc
- release
- misc
- sync
4 changes: 2 additions & 2 deletions .github/workflows/multiarch_new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
local image="$1"
local image_ref=$(echo $image | sed 's/:.*//')
# skipping the check for 'inception', 'postgres' , 'postgres_exporter' and 'workflow-controller' images
if [[ "$image_ref" == "inception" || "$image_ref" == "postgres" || "$image_ref" == "postgres_exporter" || "$image_ref" == "workflow-controller" ]]; then
# skipping the check for 'inception', 'postgres' , 'postgres_exporter', 'workflow-controller', 'casbin' and 'scoop' images
if [[ "$image_ref" == "inception" || "$image_ref" == "postgres" || "$image_ref" == "postgres_exporter" || "$image_ref" == "workflow-controller" || "$image_ref" == "casbin" || "$image_ref" == "scoop" ]]; then
return
fi
Expand Down
34 changes: 18 additions & 16 deletions .github/workflows/pr-issue-validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- 'main'
- 'release-**'
- 'develop'
- 'hotfix-v0**'
# paths-ignore:
# - 'docs/**'
# - '.github/'
Expand Down Expand Up @@ -53,7 +54,7 @@ jobs:
set -x
# Skip validation for documentation or chore PRs
if [[ "$TITLE" =~ ^(doc:|docs:|chore:|misc:|Release:|release:) ]]; then
if [[ "$TITLE" =~ ^(doc:|docs:|chore:|misc:|Release:|release:|Sync:|sync:) ]]; then
echo "Skipping validation for docs/chore PR."
echo "PR NUMBER-: $PRNUM "
gh pr edit $PRNUM --remove-label "PR:Issue-verification-failed"
Expand Down Expand Up @@ -140,32 +141,33 @@ jobs:
--header "authorization: Bearer ${{ secrets.GH_PR_VALIDATOR_TOKEN }}" \
"$issue_api_url"| jq '.state'|tr -d \")
fi
echo "Issue Status: $issue_status"

echo "Issue Number : $issue_num Status: $issue_status"
# Check if the issue is still open.
if [[ "$issue_status" == open ]]; then
echo "Issue #$issue_num is opened."
# if [[ "$issue_status" == open ]]; then
# echo "Issue #$issue_num is opened."
if [[ $forked == true ]]; then
echo "PR:Ready-to-Review, exiting gracefully"
exit 0
fi
# Remove the 'Issue-verification-failed' label (if present) and add 'Ready-to-Review'.
gh pr edit $PRNUM --remove-label "PR:Issue-verification-failed"
gh pr edit $PRNUM --add-label "PR:Ready-to-Review"
else
echo "Issue #$issue_num is closed. Please link an open issue to proceed."
if [[ $forked == true ]]; then
echo "PR:Ready-to-Review, exiting gracefully"
exit 0
fi
echo "PR:Ready-to-Review, exiting gracefully"
exit 0
# else
# echo "Issue #$issue_num is closed. Please link an open issue to proceed."
# if [[ $forked == true ]]; then
# echo "PR:Ready-to-Review, exiting gracefully"
# exit 0
# fi
# Add a comment to the PR indicating the issue is not linked correctly.
gh pr comment $PRNUM --body "PR is linked to a closed issue. Please link an open issue to proceed."
# gh pr comment $PRNUM --body "PR is linked to a closed issue. Please link an open issue to proceed."

# Add the 'Issue-verification-failed' label and remove 'Ready-to-Review'.
gh pr edit $PRNUM --add-label "PR:Issue-verification-failed"
gh pr edit $PRNUM --remove-label "PR:Ready-to-Review"
exit 1
fi
# gh pr edit $PRNUM --add-label "PR:Issue-verification-failed"
# gh pr edit $PRNUM --remove-label "PR:Ready-to-Review"
# exit 1
#fi
else
echo "Issue not found. Invalid URL or issue number."
# Add a comment to the PR indicating the issue is not linked correctly.
Expand Down
3 changes: 2 additions & 1 deletion App.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main
import (
"context"
"crypto/tls"
"errors"
"fmt"
"github.com/devtron-labs/common-lib/middlewares"
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
Expand Down Expand Up @@ -137,7 +138,7 @@ func (app *App) Start() {
err = server.ListenAndServe()
}
//err := http.ListenAndServe(fmt.Sprintf(":%d", port), auth.Authorizer(app.Enforcer, app.sessionManager)(app.MuxRouter.Router))
if err != nil {
if err != nil && !errors.Is(err, http.ErrServerClosed) {
app.Logger.Errorw("error in startup", "err", err)
os.Exit(2)
}
Expand Down
27 changes: 15 additions & 12 deletions Wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/devtron-labs/devtron/api/infraConfig"
"github.com/devtron-labs/devtron/api/k8s"
"github.com/devtron-labs/devtron/api/module"
"github.com/devtron-labs/devtron/api/resourceScan"
"github.com/devtron-labs/devtron/api/restHandler"
"github.com/devtron-labs/devtron/api/restHandler/app/appInfo"
appList2 "github.com/devtron-labs/devtron/api/restHandler/app/appList"
Expand Down Expand Up @@ -81,9 +82,11 @@ import (
"github.com/devtron-labs/devtron/client/argocdServer/certificate"
cluster2 "github.com/devtron-labs/devtron/client/argocdServer/cluster"
"github.com/devtron-labs/devtron/client/argocdServer/connection"
"github.com/devtron-labs/devtron/client/argocdServer/repoCredsK8sClient"
repocreds "github.com/devtron-labs/devtron/client/argocdServer/repocreds"
repository2 "github.com/devtron-labs/devtron/client/argocdServer/repository"
session2 "github.com/devtron-labs/devtron/client/argocdServer/session"
"github.com/devtron-labs/devtron/client/argocdServer/version"
"github.com/devtron-labs/devtron/client/cron"
"github.com/devtron-labs/devtron/client/dashboard"
eClient "github.com/devtron-labs/devtron/client/events"
Expand Down Expand Up @@ -116,7 +119,6 @@ import (
repository9 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository"
deployment3 "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deployment"
"github.com/devtron-labs/devtron/pkg/appWorkflow"
"github.com/devtron-labs/devtron/pkg/argoRepositoryCreds"
"github.com/devtron-labs/devtron/pkg/asyncProvider"
"github.com/devtron-labs/devtron/pkg/attributes"
"github.com/devtron-labs/devtron/pkg/build"
Expand All @@ -141,7 +143,8 @@ import (
"github.com/devtron-labs/devtron/pkg/generateManifest"
"github.com/devtron-labs/devtron/pkg/gitops"
"github.com/devtron-labs/devtron/pkg/imageDigestPolicy"
infraConfigService "github.com/devtron-labs/devtron/pkg/infraConfig"
repository11 "github.com/devtron-labs/devtron/pkg/infraConfig/repository"
infraConfigService "github.com/devtron-labs/devtron/pkg/infraConfig/service"
"github.com/devtron-labs/devtron/pkg/infraConfig/units"
"github.com/devtron-labs/devtron/pkg/kubernetesResourceAuditLogs"
repository7 "github.com/devtron-labs/devtron/pkg/kubernetesResourceAuditLogs/repository"
Expand All @@ -165,7 +168,6 @@ import (
workflow3 "github.com/devtron-labs/devtron/pkg/workflow"
"github.com/devtron-labs/devtron/pkg/workflow/dag"
util2 "github.com/devtron-labs/devtron/util"
"github.com/devtron-labs/devtron/util/argo"
cron2 "github.com/devtron-labs/devtron/util/cron"
"github.com/devtron-labs/devtron/util/rbac"
"github.com/google/wire"
Expand Down Expand Up @@ -210,6 +212,7 @@ func InitializeApp() (*App, error) {
imageTagging.WireSet,
devtronResource.DevtronResourceWireSet,
policyGovernance.PolicyGovernanceWireSet,
resourceScan.ScanningResultWireSet,

// -------wireset end ----------
// -------
Expand Down Expand Up @@ -275,8 +278,8 @@ func InitializeApp() (*App, error) {
wire.Bind(new(dashboardEvent.DashboardTelemetryRouter),
new(*dashboardEvent.DashboardTelemetryRouterImpl)),

infraConfigService.NewInfraProfileRepositoryImpl,
wire.Bind(new(infraConfigService.InfraConfigRepository), new(*infraConfigService.InfraConfigRepositoryImpl)),
repository11.NewInfraProfileRepositoryImpl,
wire.Bind(new(repository11.InfraConfigRepository), new(*repository11.InfraConfigRepositoryImpl)),

units.NewUnits,
infraConfigService.NewInfraConfigServiceImpl,
Expand Down Expand Up @@ -446,8 +449,8 @@ func InitializeApp() (*App, error) {
wire.Bind(new(repository8.ImageTaggingRepository), new(*repository8.ImageTaggingRepositoryImpl)),
imageTagging.NewImageTaggingServiceImpl,
wire.Bind(new(imageTagging.ImageTaggingService), new(*imageTagging.ImageTaggingServiceImpl)),
argocdServer.NewVersionServiceImpl,
wire.Bind(new(argocdServer.VersionService), new(*argocdServer.VersionServiceImpl)),
version.NewVersionServiceImpl,
wire.Bind(new(version.VersionService), new(*version.VersionServiceImpl)),

router.NewGitProviderRouterImpl,
wire.Bind(new(router.GitProviderRouter), new(*router.GitProviderRouterImpl)),
Expand Down Expand Up @@ -798,9 +801,9 @@ func InitializeApp() (*App, error) {

connection.NewArgoCDConnectionManagerImpl,
wire.Bind(new(connection.ArgoCDConnectionManager), new(*connection.ArgoCDConnectionManagerImpl)),
argo.NewArgoUserServiceImpl,
wire.Bind(new(argo.ArgoUserService), new(*argo.ArgoUserServiceImpl)),
//util2.GetEnvironmentVariables,
//argo.NewArgoUserServiceImpl,
//wire.Bind(new(argo.ArgoUserService), new(*argo.ArgoUserServiceImpl)),
////util2.GetEnvironmentVariables,
// AuthWireSet,

cron.NewCdApplicationStatusUpdateHandlerImpl,
Expand Down Expand Up @@ -947,8 +950,8 @@ func InitializeApp() (*App, error) {
common.NewDeploymentConfigServiceImpl,
wire.Bind(new(common.DeploymentConfigService), new(*common.DeploymentConfigServiceImpl)),

argoRepositoryCreds.NewRepositorySecret,
wire.Bind(new(argoRepositoryCreds.RepositorySecret), new(*argoRepositoryCreds.RepositorySecretImpl)),
repoCredsK8sClient.NewRepositorySecret,
wire.Bind(new(repoCredsK8sClient.RepositoryCreds), new(*repoCredsK8sClient.RepositorySecretImpl)),

repocreds.NewServiceClientImpl,
wire.Bind(new(repocreds.ServiceClient), new(*repocreds.ServiceClientImpl)),
Expand Down
25 changes: 10 additions & 15 deletions api/appStore/InstalledAppRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ import (
"encoding/json"
"errors"
"fmt"
bean2 "github.com/devtron-labs/devtron/api/bean/AppView"
client "github.com/devtron-labs/devtron/api/helm-app/gRPC"
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode"
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deploymentTypeChange"
"github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/resource"
util3 "github.com/devtron-labs/devtron/pkg/appStore/util"
"github.com/devtron-labs/devtron/pkg/bean"
"github.com/devtron-labs/devtron/pkg/cluster/read"
"gopkg.in/go-playground/validator.v9"
"net/http"
"reflect"
"strconv"
"strings"
"time"

bean2 "github.com/devtron-labs/devtron/api/bean"
"github.com/devtron-labs/devtron/api/restHandler/common"
"github.com/devtron-labs/devtron/client/argocdServer/application"
"github.com/devtron-labs/devtron/client/cron"
Expand All @@ -50,7 +51,6 @@ import (
"github.com/devtron-labs/devtron/pkg/auth/user"
"github.com/devtron-labs/devtron/pkg/cluster"
"github.com/devtron-labs/devtron/util"
"github.com/devtron-labs/devtron/util/argo"
"github.com/devtron-labs/devtron/util/rbac"
"github.com/devtron-labs/devtron/util/response"
"github.com/go-pg/pg"
Expand Down Expand Up @@ -88,11 +88,11 @@ type InstalledAppRestHandlerImpl struct {
appStoreDeploymentService service.AppStoreDeploymentService
appStoreDeploymentDBService service.AppStoreDeploymentDBService
helmAppClient client.HelmAppClient
argoUserService argo.ArgoUserService
cdApplicationStatusUpdateHandler cron.CdApplicationStatusUpdateHandler
installedAppRepository repository.InstalledAppRepository
appCrudOperationService app2.AppCrudOperationService
installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService
clusterReadService read.ClusterReadService
}

func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService user.UserService,
Expand All @@ -102,11 +102,13 @@ func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService u
chartGroupService chartGroup.ChartGroupService, validator *validator.Validate, clusterService cluster.ClusterService,
acdServiceClient application.ServiceClient, appStoreDeploymentService service.AppStoreDeploymentService,
appStoreDeploymentDBService service.AppStoreDeploymentDBService,
helmAppClient client.HelmAppClient, argoUserService argo.ArgoUserService,
helmAppClient client.HelmAppClient,

cdApplicationStatusUpdateHandler cron.CdApplicationStatusUpdateHandler,
installedAppRepository repository.InstalledAppRepository,
appCrudOperationService app2.AppCrudOperationService,
installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService) *InstalledAppRestHandlerImpl {
installedAppDeploymentTypeChangeService deploymentTypeChange.InstalledAppDeploymentTypeChangeService,
clusterReadService read.ClusterReadService) *InstalledAppRestHandlerImpl {
return &InstalledAppRestHandlerImpl{
Logger: Logger,
userAuthService: userAuthService,
Expand All @@ -122,11 +124,11 @@ func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService u
appStoreDeploymentService: appStoreDeploymentService,
appStoreDeploymentDBService: appStoreDeploymentDBService,
helmAppClient: helmAppClient,
argoUserService: argoUserService,
cdApplicationStatusUpdateHandler: cdApplicationStatusUpdateHandler,
installedAppRepository: installedAppRepository,
appCrudOperationService: appCrudOperationService,
installedAppDeploymentTypeChangeService: installedAppDeploymentTypeChangeService,
clusterReadService: clusterReadService,
}
}
func (handler *InstalledAppRestHandlerImpl) FetchAppOverview(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -550,7 +552,7 @@ func (impl *InstalledAppRestHandlerImpl) DefaultComponentInstallation(w http.Res
return
}
impl.Logger.Errorw("request payload, DefaultComponentInstallation", "clusterId", clusterId)
cluster, err := impl.clusterService.FindById(clusterId)
cluster, err := impl.clusterReadService.FindById(clusterId)
if err != nil {
impl.Logger.Errorw("service err, DefaultComponentInstallation", "error", err, "clusterId", clusterId)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
Expand Down Expand Up @@ -648,13 +650,6 @@ func (handler *InstalledAppRestHandlerImpl) DeleteArgoInstalledAppWithNonCascade
return
}
//rback block ends here
acdToken, err := handler.argoUserService.GetLatestDevtronArgoCdUserToken()
if err != nil {
handler.Logger.Errorw("error in getting acd token", "err", err)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
ctx := context.WithValue(r.Context(), "token", acdToken)
request := &appStoreBean.InstallAppVersionDTO{}
request.InstalledAppId = installedAppId
request.AppName = installedApp.AppName
Expand All @@ -668,7 +663,7 @@ func (handler *InstalledAppRestHandlerImpl) DeleteArgoInstalledAppWithNonCascade
request.Namespace = installedApp.Namespace
request.AcdPartialDelete = true

request, err = handler.appStoreDeploymentService.DeleteInstalledApp(ctx, request)
request, err = handler.appStoreDeploymentService.DeleteInstalledApp(r.Context(), request)
if err != nil {
handler.Logger.Errorw("service err, DeleteInstalledApp", "err", err, "installAppId", installedAppId)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
Expand Down
32 changes: 2 additions & 30 deletions api/appStore/deployment/AppStoreDeploymentRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin"
"github.com/devtron-labs/devtron/pkg/auth/user"
util2 "github.com/devtron-labs/devtron/util"
"github.com/devtron-labs/devtron/util/argo"
"github.com/devtron-labs/devtron/util/rbac"
"github.com/go-pg/pg"
"github.com/gorilla/mux"
Expand Down Expand Up @@ -64,7 +63,6 @@ type AppStoreDeploymentRestHandlerImpl struct {
appStoreDeploymentDBService service.AppStoreDeploymentDBService
validator *validator.Validate
helmAppService service2.HelmAppService
argoUserService argo.ArgoUserService
installAppService EAMode.InstalledAppDBService
attributesService attributes.AttributesService
}
Expand All @@ -73,8 +71,8 @@ func NewAppStoreDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthSer
enforcer casbin.Enforcer, enforcerUtil rbac.EnforcerUtil, enforcerUtilHelm rbac.EnforcerUtilHelm,
appStoreDeploymentService service.AppStoreDeploymentService,
appStoreDeploymentDBService service.AppStoreDeploymentDBService,
validator *validator.Validate, helmAppService service2.HelmAppService,
argoUserService argo.ArgoUserService,
validator *validator.Validate,
helmAppService service2.HelmAppService,
installAppService EAMode.InstalledAppDBService, attributesService attributes.AttributesService) *AppStoreDeploymentRestHandlerImpl {
return &AppStoreDeploymentRestHandlerImpl{
Logger: Logger,
Expand All @@ -86,7 +84,6 @@ func NewAppStoreDeploymentRestHandlerImpl(Logger *zap.SugaredLogger, userAuthSer
appStoreDeploymentDBService: appStoreDeploymentDBService,
validator: validator,
helmAppService: helmAppService,
argoUserService: argoUserService,
installAppService: installAppService,
attributesService: attributesService,
}
Expand Down Expand Up @@ -165,16 +162,7 @@ func (handler AppStoreDeploymentRestHandlerImpl) InstallApp(w http.ResponseWrite
}
if util2.IsBaseStack() || util2.IsHelmApp(request.AppOfferingMode) {
ctx = context.WithValue(r.Context(), "token", token)
} else {
acdToken, err := handler.argoUserService.GetLatestDevtronArgoCdUserToken()
if err != nil {
handler.Logger.Errorw("error in getting acd token", "err", err)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
ctx = context.WithValue(r.Context(), "token", acdToken)
}

defer cancel()
res, err := handler.appStoreDeploymentService.InstallApp(&request, ctx)
if err != nil {
Expand Down Expand Up @@ -348,14 +336,6 @@ func (handler AppStoreDeploymentRestHandlerImpl) DeleteInstalledApp(w http.Respo
}
if util2.IsBaseStack() || util2.IsHelmApp(request.AppOfferingMode) {
ctx = context.WithValue(r.Context(), "token", token)
} else {
acdToken, err := handler.argoUserService.GetLatestDevtronArgoCdUserToken()
if err != nil {
handler.Logger.Errorw("error in getting acd token", "err", err)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
ctx = context.WithValue(r.Context(), "token", acdToken)
}

request, err = handler.appStoreDeploymentService.DeleteInstalledApp(ctx, request)
Expand Down Expand Up @@ -476,14 +456,6 @@ func (handler AppStoreDeploymentRestHandlerImpl) UpdateInstalledApp(w http.Respo
}
if util2.IsBaseStack() || util2.IsHelmApp(request.AppOfferingMode) {
ctx = context.WithValue(r.Context(), "token", token)
} else {
acdToken, err := handler.argoUserService.GetLatestDevtronArgoCdUserToken()
if err != nil {
handler.Logger.Errorw("error in getting acd token", "err", err)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
ctx = context.WithValue(r.Context(), "token", acdToken)
}
res, err := handler.appStoreDeploymentService.UpdateInstalledApp(ctx, &request)
if err != nil {
Expand Down
Loading

0 comments on commit 8628903

Please sign in to comment.