Skip to content

Commit

Permalink
main merge
Browse files Browse the repository at this point in the history
  • Loading branch information
iamayushm committed Jun 8, 2024
2 parents 42a532a + 9feb81d commit 25186b7
Show file tree
Hide file tree
Showing 95 changed files with 2,010 additions and 525 deletions.
1 change: 1 addition & 0 deletions .gitbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ redirects:
global-configurations/api-token: user-guide/global-configurations/authorization/api-tokens.md
user-guide/creating-application/workflow/ci-pipeline2: user-guide/creating-application/workflow/ci-pipeline.md
user-guide/clusters: user-guide/resource-browser.md
usage/clusters: user-guide/resource-browser.md
88 changes: 88 additions & 0 deletions CHANGELOG/release-notes-v0.7.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
## v0.7.0

## Bugs
- fix: extra labels propagation made env driven (#5274)
- fix: App clone config map fix (#5268)
- fix: latest version in default cluster and on UI (#5259)
- fix: update CVE's severity and store multiple same CVE's in multiple packages (#5168)
- fix: fixing force push for gitops (#5152)
- fix: extra labels propagation based on k8s label regex matching (#5216)
- fix: invalid runner status (#5189)
- fix: revert changes from main (#5206)
- fix: apps and jobs permission (#5110)
- fix: added Copyright (#5172)
- fix:removed unused env var (#5174)
- fix: Handling all cases for 5xx (#5100)
- fix: trivy scan step command fix (#5162)
- fix: added extra args in trivy cmds (#5146)
- fix: proxyRouter empty data err panic handling (#5147)
- fix: handling side-effects for displaying external helm apps with same name across diff namespaces and clusters (#4951)
- fix: fatal log removed (#5043)
- fix: added a check for restricting managers to assign superadmin through permission groups (#5025)
- fix: SHOW_DOCKER_BUILD_ARGS variable not working as expected (#5117)
- fix: dependabot version upgrade (#5089)
- fix: containers are missing from app-details page in argocd app (#4973)
- fix:resolved PR review comments also remove check for virtual cluster (#5095)
- fix:handled namespace case if deleted by kubectl (#5081)
- fix: oci chart were getting deployed through gitops (#5088)
- fix: argocd config update fix (#5074)
- fix: handle 5xx in fetch resource tree api and cd-trigger (#5050)
- fix: gitops update updated (#5055)
- fix: App create api validations (#5019)
- fix: git material saved in transaction (#5040)
- fix: panic while pulling images (#5036)
- fix: terminal stuck in connecting state (#4989)
- fix: handle for wrong format of k8s version in semvercompare func in cronjob template charts (#5016)
- fix: Dockerfile ubuntu version (#5022)
- fix: application status changes to HIBERNATING, when hibernation fails due to some reason (#5005)
- fix: deleted api token can be reused if created again with same name (#4978)
- fix: Kubelink Requests getting Failed for gRPC method GetAppDetails (#5012)
- fix: terminate sync if in progress (#4946)
- fix: grpc error handling for TemplateChart req (#4980)
- fix: removed redundant import (#5004)
- fix: image promotion sql script (#4996)
- fix: image-approval-migartion fix (#4994)
- fix: ci-cd count per day in telemetry data (#4931)
## Enhancements
- feat: notifier behind nats (#5185)
- feat: cd pipeline deployment history refactoring (#5200)
- feat: wire nil test in pre ci pipeline (#4858)
- feat: added recovery counter metrics (#5124)
- feat: auto remediation (#5137)
- feat: support for ca cert in trivy (#5064)
- feat: validation for pipeline Type (#4670)
- feat: propagate labels such as envName and projectName (#5063)
- feat: Plugin to trigger Devtron Job (#5053)
- feat: CD Trigger Plugin (#4810)
- feat: Introduction to feasibility in Deployment (#4862)
## Documentation
- doc: Created Resource Watcher Doc (#5193)
- doc: Modified Portforward Section to Kubectl Section (#5236)
- doc: Added enhancements to security doc (#5203)
- docs: update readme to include multi arch flag (#4998)
- docs: config.md updatation for new flag (#5061)
- doc: Fixes in Documentation for May Month (#5150)
- doc: Created Resource Watcher Doc (#5193)
- doc: Modified Portforward Section to Kubectl Section (#5236)
- doc: Added enhancements to security doc (#5203)
- docs: update readme to include multi arch flag (#4998)
- docs: config.md updatation for new flag (#5061)
- doc: Added kubectl port-fwd section in RB (#5139)
- doc: Added Bitbucket Data Center in GitOps doc (#5075)
- doc: Image promotion policy (#4762)
- doc: Revamped Resource Browser Doc (#5035)
- doc: Added Bulk Restart in Application Groups doc (#5080)
- doc: Added new doc in the index (#5029)
- doc: Changes made in the doc according to the newer version (#5024)
- doc: Added Linked CI with Child Info + Runtime Build Parameters (#4991)
## Others
- chore: updated vendor (#5166)
- chore: gitops validation in api (#5082)
- chore: release v2 migration (#5126)
- chore: migration update for remote connection config (#5113)
- chore: added sql for release and release channels (#4898)
- chore: resource scan migration (#4977)
- chore: image promotion migration (#4992)
- misc: uniform GitHub action (#5069)


4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ helm install devtron devtron/devtron-operator --create-namespace --namespace dev

```

### Install Multi-Architecture Nodes (ARM and AMD)

To install Devtron on clusters with the multi-architecture nodes (ARM and AMD), append the Devtron installation command with ```--set installer.arch=multi-arch```

## :blue_heart: Technology

Devtron is built on some of the most trusted and loved technologies:
Expand Down
19 changes: 8 additions & 11 deletions Wire.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build wireinject
// +build wireinject

/*
* Copyright (c) 2024. Devtron Inc.
*
Expand All @@ -14,9 +17,6 @@
* limitations under the License.
*/

//go:build wireinject
// +build wireinject

package main

import (
Expand All @@ -39,6 +39,7 @@ import (
"github.com/devtron-labs/devtron/api/connector"
"github.com/devtron-labs/devtron/api/dashboardEvent"
"github.com/devtron-labs/devtron/api/deployment"
"github.com/devtron-labs/devtron/api/devtronResource"
"github.com/devtron-labs/devtron/api/externalLink"
client "github.com/devtron-labs/devtron/api/helm-app"
"github.com/devtron-labs/devtron/api/infraConfig"
Expand Down Expand Up @@ -121,8 +122,6 @@ import (
deployment2 "github.com/devtron-labs/devtron/pkg/deployment"
git2 "github.com/devtron-labs/devtron/pkg/deployment/gitOps/git"
"github.com/devtron-labs/devtron/pkg/deploymentGroup"
"github.com/devtron-labs/devtron/pkg/devtronResource"
repository9 "github.com/devtron-labs/devtron/pkg/devtronResource/repository"
"github.com/devtron-labs/devtron/pkg/dockerRegistry"
"github.com/devtron-labs/devtron/pkg/eventProcessor"
"github.com/devtron-labs/devtron/pkg/generateManifest"
Expand Down Expand Up @@ -195,6 +194,9 @@ func InitializeApp() (*App, error) {

eventProcessor.EventProcessorWireSet,
workflow3.WorkflowWireSet,

devtronResource.DevtronResourceWireSet,

// -------wireset end ----------
// -------
gitSensor.GetConfig,
Expand Down Expand Up @@ -748,6 +750,7 @@ func InitializeApp() (*App, error) {

app.NewAppCrudOperationServiceImpl,
wire.Bind(new(app.AppCrudOperationService), new(*app.AppCrudOperationServiceImpl)),
app.GetCrudOperationServiceConfig,
pipelineConfig.NewAppLabelRepositoryImpl,
wire.Bind(new(pipelineConfig.AppLabelRepository), new(*pipelineConfig.AppLabelRepositoryImpl)),

Expand Down Expand Up @@ -950,12 +953,6 @@ func InitializeApp() (*App, error) {
resourceQualifiers.NewQualifierMappingServiceImpl,
wire.Bind(new(resourceQualifiers.QualifierMappingService), new(*resourceQualifiers.QualifierMappingServiceImpl)),

repository9.NewDevtronResourceSearchableKeyRepositoryImpl,
wire.Bind(new(repository9.DevtronResourceSearchableKeyRepository), new(*repository9.DevtronResourceSearchableKeyRepositoryImpl)),

devtronResource.NewDevtronResourceSearchableKeyServiceImpl,
wire.Bind(new(devtronResource.DevtronResourceSearchableKeyService), new(*devtronResource.DevtronResourceSearchableKeyServiceImpl)),

argocdServer.NewArgoClientWrapperServiceImpl,
wire.Bind(new(argocdServer.ArgoClientWrapperService), new(*argocdServer.ArgoClientWrapperServiceImpl)),

Expand Down
5 changes: 3 additions & 2 deletions api/auth/user/UserAuthHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (handler UserAuthHandlerImpl) AddDefaultPolicyAndRoles(w http.ResponseWrite

}
func (handler UserAuthHandlerImpl) AuthVerification(w http.ResponseWriter, r *http.Request) {
verified, err := handler.userAuthService.AuthVerification(r)
verified, _, err := handler.userAuthService.AuthVerification(r)
if err != nil {
handler.logger.Errorw("service err, AuthVerification", "err", err)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
Expand All @@ -253,13 +253,14 @@ func (handler UserAuthHandlerImpl) AuthVerificationV2(w http.ResponseWriter, r *
isSuperAdmin = true
}
response := make(map[string]interface{})
verified, err := handler.userAuthService.AuthVerification(r)
verified, emailId, err := handler.userAuthService.AuthVerification(r)
if err != nil {
handler.logger.Errorw("service err, AuthVerification", "err", err)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
response["isSuperAdmin"] = isSuperAdmin
response["isVerified"] = verified
response["emailId"] = emailId
common.WriteJsonResp(w, nil, response, http.StatusOK)
}
125 changes: 125 additions & 0 deletions api/devtronResource/DevtronResourceHistoryRestHandler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
package devtronResource

import (
"fmt"
apiBean "github.com/devtron-labs/devtron/api/devtronResource/bean"
"github.com/devtron-labs/devtron/api/restHandler/common"
"github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin"
"github.com/devtron-labs/devtron/pkg/devtronResource"
"github.com/devtron-labs/devtron/pkg/devtronResource/adapter"
"github.com/devtron-labs/devtron/pkg/devtronResource/bean"
"github.com/devtron-labs/devtron/pkg/devtronResource/history/deployment/cdPipeline"
"github.com/devtron-labs/devtron/util/rbac"
"github.com/gorilla/schema"
"go.uber.org/zap"
"net/http"
)

type HistoryRestHandler interface {
GetDeploymentHistory(w http.ResponseWriter, r *http.Request)
GetDeploymentHistoryConfigList(w http.ResponseWriter, r *http.Request)
}

type HistoryRestHandlerImpl struct {
logger *zap.SugaredLogger
enforcer casbin.Enforcer
deploymentHistoryService cdPipeline.DeploymentHistoryService
apiReqDecoderService devtronResource.APIReqDecoderService
enforcerUtil rbac.EnforcerUtil
}

func NewHistoryRestHandlerImpl(logger *zap.SugaredLogger,
enforcer casbin.Enforcer,
deploymentHistoryService cdPipeline.DeploymentHistoryService,
apiReqDecoderService devtronResource.APIReqDecoderService,
enforcerUtil rbac.EnforcerUtil) *HistoryRestHandlerImpl {
return &HistoryRestHandlerImpl{
logger: logger,
enforcer: enforcer,
deploymentHistoryService: deploymentHistoryService,
apiReqDecoderService: apiReqDecoderService,
enforcerUtil: enforcerUtil,
}
}

func (handler *HistoryRestHandlerImpl) GetDeploymentHistory(w http.ResponseWriter, r *http.Request) {
kind, _, _, caughtError := getKindSubKindVersion(w, r)
if caughtError || kind != bean.DevtronResourceCdPipeline.ToString() {
common.WriteJsonResp(w, fmt.Errorf(apiBean.RequestInvalidKindVersionErrMessage), nil, http.StatusBadRequest)
return
}
v := r.URL.Query()
var decoder = schema.NewDecoder()
decoder.IgnoreUnknownKeys(true)
queryParams := apiBean.GetHistoryQueryParams{}
err := decoder.Decode(&queryParams, v)
if err != nil {
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
decodedReqBean, err := handler.apiReqDecoderService.GetFilterCriteriaParamsForDeploymentHistory(queryParams.FilterCriteria)
if err != nil {
handler.logger.Errorw("error in getting filter criteria params", "err", err, "filterCriteria", queryParams.FilterCriteria)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}

// RBAC START
token := r.Header.Get("token")
resourceName := handler.enforcerUtil.GetAppRBACNameByAppId(decodedReqBean.AppId)
if ok := handler.enforcer.Enforce(token, casbin.ResourceApplications, casbin.ActionGet, resourceName); !ok {
common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
return
}
// RBAC END

resp, err := handler.deploymentHistoryService.
GetCdPipelineDeploymentHistory(adapter.GetCDDeploymentHistoryListReq(&queryParams, decodedReqBean))
if err != nil {
handler.logger.Errorw("service error, GetCdPipelineDeploymentHistory", "err", err)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
common.WriteJsonResp(w, err, resp, http.StatusOK)
return
}

func (handler *HistoryRestHandlerImpl) GetDeploymentHistoryConfigList(w http.ResponseWriter, r *http.Request) {
kind, _, _, caughtError := getKindSubKindVersion(w, r)
if caughtError || kind != bean.DevtronResourceCdPipeline.ToString() {
common.WriteJsonResp(w, fmt.Errorf(apiBean.RequestInvalidKindVersionErrMessage), nil, http.StatusBadRequest)
return
}
v := r.URL.Query()
var decoder = schema.NewDecoder()
decoder.IgnoreUnknownKeys(true)
queryParams := apiBean.GetHistoryConfigQueryParams{}
err := decoder.Decode(&queryParams, v)
if err != nil {
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
decodedReqBean, err := handler.apiReqDecoderService.GetFilterCriteriaParamsForDeploymentHistory(queryParams.FilterCriteria)
if err != nil {
handler.logger.Errorw("error in getting filter criteria params", "err", err, "filterCriteria", queryParams.FilterCriteria)
common.WriteJsonResp(w, err, nil, http.StatusBadRequest)
return
}
//RBAC START
token := r.Header.Get("token")
resourceName := handler.enforcerUtil.GetAppRBACNameByAppId(decodedReqBean.AppId)
if isValidated := handler.enforcer.Enforce(token, casbin.ResourceApplications, casbin.ActionGet, resourceName); !isValidated {
common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
return
}
//RBAC END
resp, err := handler.deploymentHistoryService.
GetCdPipelineDeploymentHistoryConfigList(adapter.GetCDDeploymentHistoryConfigListReq(&queryParams, decodedReqBean))
if err != nil {
handler.logger.Errorw("service error, GetCdPipelineDeploymentHistoryConfigList", "err", err)
common.WriteJsonResp(w, err, nil, http.StatusInternalServerError)
return
}
common.WriteJsonResp(w, err, resp, http.StatusOK)
return
}
23 changes: 23 additions & 0 deletions api/devtronResource/DevtronResourceHistoryRouter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package devtronResource

import "github.com/gorilla/mux"

type HistoryRouter interface {
InitDtResourceHistoryRouter(devtronResourceRouter *mux.Router)
}

type HistoryRouterImpl struct {
dtResourceHistoryRestHandler HistoryRestHandler
}

func NewHistoryRouterImpl(dtResourceHistoryRestHandler HistoryRestHandler) *HistoryRouterImpl {
return &HistoryRouterImpl{dtResourceHistoryRestHandler: dtResourceHistoryRestHandler}
}

func (router *HistoryRouterImpl) InitDtResourceHistoryRouter(historyRouter *mux.Router) {
historyRouter.Path("/deployment/config/{kind:[a-zA-Z0-9/-]+}/{version:[a-zA-Z0-9]+}").
HandlerFunc(router.dtResourceHistoryRestHandler.GetDeploymentHistoryConfigList).Methods("GET")

historyRouter.Path("/deployment/{kind:[a-zA-Z0-9/-]+}/{version:[a-zA-Z0-9]+}").
HandlerFunc(router.dtResourceHistoryRestHandler.GetDeploymentHistory).Methods("GET")
}
31 changes: 31 additions & 0 deletions api/devtronResource/DevtronResourceRestHandler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package devtronResource

import (
"fmt"
apiBean "github.com/devtron-labs/devtron/api/devtronResource/bean"
"github.com/devtron-labs/devtron/api/restHandler/common"
"github.com/devtron-labs/devtron/pkg/devtronResource/helper"
"github.com/gorilla/mux"
"net/http"
)

func getKindSubKindVersion(w http.ResponseWriter, r *http.Request) (kind string, subKind string, version string, caughtError bool) {
vars := mux.Vars(r)
kindVar := vars[apiBean.PathParamKind]
versionVar := vars[apiBean.PathParamVersion]
kind, subKind, statusCode, err := resolveKindSubKindValues(kindVar)
if err != nil {
common.WriteJsonResp(w, err, nil, statusCode)
caughtError = true
}
return kind, subKind, versionVar, caughtError
}

func resolveKindSubKindValues(kindVar string) (kind, subKind string, statusCode int, err error) {
kind, subKind, err = helper.GetKindAndSubKindFrom(kindVar)
if err != nil {
err = fmt.Errorf("invalid parameter: kind")
statusCode = http.StatusBadRequest
}
return kind, subKind, statusCode, err
}
22 changes: 22 additions & 0 deletions api/devtronResource/DevtronResourceRouter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package devtronResource

import "github.com/gorilla/mux"

type DevtronResourceRouter interface {
InitDevtronResourceRouter(devtronResourceRouter *mux.Router)
}

type DevtronResourceRouterImpl struct {
historyRouter HistoryRouter
}

func NewDevtronResourceRouterImpl(historyRouter HistoryRouter) *DevtronResourceRouterImpl {
return &DevtronResourceRouterImpl{
historyRouter: historyRouter,
}
}

func (router *DevtronResourceRouterImpl) InitDevtronResourceRouter(devtronResourceRouter *mux.Router) {
historyRouter := devtronResourceRouter.PathPrefix("/history").Subrouter()
router.historyRouter.InitDtResourceHistoryRouter(historyRouter)
}
Loading

0 comments on commit 25186b7

Please sign in to comment.