Skip to content

Commit

Permalink
Merge branch 'main' of github.com:devtron-labs/devtron into pre-cd-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ayu-devtron committed Jan 30, 2025
2 parents 6ba7dd2 + d5ba44f commit 9746989
Show file tree
Hide file tree
Showing 176 changed files with 8,989 additions and 2,898 deletions.
66 changes: 30 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,52 +1,46 @@
FROM golang:1.21 AS build-env

RUN echo $GOPATH
RUN apt update
RUN apt install git gcc musl-dev make -y
RUN go install github.com/google/wire/cmd/wire@latest
RUN echo $GOPATH && \
apt update && \
apt install git gcc musl-dev make -y && \
go install github.com/google/wire/cmd/wire@latest

WORKDIR /go/src/github.com/devtron-labs/devtron

ADD . /go/src/github.com/devtron-labs/devtron/

ADD ./vendor/github.com/Microsoft/ /go/src/github.com/devtron-labs/devtron/vendor/github.com/microsoft/
RUN GOOS=linux make build-all

RUN GOOS=linux make build

# uncomment this post build arg
FROM ubuntu:22.04@sha256:1b8d8ff4777f36f19bfe73ee4df61e3a0b789caeff29caa019539ec7c9a57f95 as devtron-all

RUN apt update
RUN apt install ca-certificates git curl -y
RUN apt clean autoclean
RUN apt autoremove -y && rm -rf /var/lib/apt/lists/*
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/devtron .
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/auth_model.conf .
#COPY --from=build-env /go/src/github.com/devtron-labs/devtron/vendor/github.com/argoproj/argo-cd/assets/ /go/src/github.com/devtron-labs/devtron/vendor/github.com/argoproj/argo-cd/assets
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/argocd-assets/ /go/src/github.com/devtron-labs/devtron/vendor/github.com/argoproj/argo-cd/assets
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/devtron-reference-helm-charts scripts/devtron-reference-helm-charts
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/sql scripts/sql
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/casbin scripts/casbin
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/argo-assets/APPLICATION_TEMPLATE.tmpl scripts/argo-assets/APPLICATION_TEMPLATE.tmpl

COPY ./git-ask-pass.sh /git-ask-pass.sh
RUN chmod +x /git-ask-pass.sh

RUN useradd -ms /bin/bash devtron
RUN chown -R devtron:devtron ./devtron
RUN chown -R devtron:devtron ./git-ask-pass.sh
RUN chown -R devtron:devtron ./auth_model.conf
RUN chown -R devtron:devtron ./scripts
RUN apt update && \
apt install ca-certificates git curl -y && \
apt clean autoclean && \
apt autoremove -y && \
rm -rf /var/lib/apt/lists/* && \
useradd -ms /bin/bash devtron

USER devtron
COPY --chown=devtron:devtron --from=build-env /go/src/github.com/devtron-labs/devtron/devtron .

COPY --chown=devtron:devtron --from=build-env /go/src/github.com/devtron-labs/devtron/auth_model.conf .

CMD ["./devtron"]
COPY --chown=devtron:devtron --from=build-env /go/src/github.com/devtron-labs/devtron/argocd-assets/ /go/src/github.com/devtron-labs/devtron/vendor/github.com/argoproj/argo-cd/assets

COPY --chown=devtron:devtron --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/devtron-reference-helm-charts scripts/devtron-reference-helm-charts

#FROM alpine:3.15.0 as devtron-ea
COPY --chown=devtron:devtron --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/sql scripts/sql

#RUN apk add --no-cache ca-certificates
#COPY --from=build-env /go/src/github.com/devtron-labs/devtron/auth_model.conf .
#COPY --from=build-env /go/src/github.com/devtron-labs/devtron/cmd/external-app/devtron-ea .
COPY --chown=devtron:devtron --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/casbin scripts/casbin

#COPY --from=build-env /go/src/github.com/devtron-labs/devtron/vendor/github.com/argoproj/argo-cd/assets/ /go/src/github.com/devtron-labs/devtron/vendor/github.com/argoproj/argo-cd/assets
#COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/devtron-reference-helm-charts scripts/devtron-reference-helm-charts
#COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/argo-assets/APPLICATION_TEMPLATE.JSON scripts/argo-assets/APPLICATION_TEMPLATE.JSON
COPY --chown=devtron:devtron --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/argo-assets/APPLICATION_TEMPLATE.tmpl scripts/argo-assets/APPLICATION_TEMPLATE.tmpl

COPY --chown=devtron:devtron ./git-ask-pass.sh /git-ask-pass.sh

RUN chmod +x /git-ask-pass.sh

USER devtron

#CMD ["./devtron-ea"]
CMD ["./devtron"]
35 changes: 21 additions & 14 deletions DockerfileEA
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
FROM golang:1.21 AS build-env

RUN echo $GOPATH
RUN apt update
RUN apt install git gcc musl-dev make -y
RUN go install github.com/google/wire/cmd/wire@latest
RUN echo $GOPATH && \
apt update && \
apt install git gcc musl-dev make -y && \
go install github.com/google/wire/cmd/wire@latest

WORKDIR /go/src/github.com/devtron-labs/devtron

ADD . /go/src/github.com/devtron-labs/devtron/

ADD ./vendor/github.com/Microsoft/ /go/src/github.com/devtron-labs/devtron/vendor/github.com/microsoft/

RUN GOOS=linux make build-all

FROM ubuntu:22.04@sha256:1b8d8ff4777f36f19bfe73ee4df61e3a0b789caeff29caa019539ec7c9a57f95 as devtron-ea

RUN apt update
RUN apt install ca-certificates curl -y
RUN apt clean autoclean
RUN apt autoremove -y && rm -rf /var/lib/apt/lists/*
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/auth_model.conf .
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/cmd/external-app/devtron-ea .
RUN apt update && \
apt install ca-certificates curl -y && \
apt clean autoclean && \
apt autoremove -y && rm -rf /var/lib/apt/lists/* && \
useradd -ms /bin/bash devtron

COPY --chown=devtron:devtron --from=build-env /go/src/github.com/devtron-labs/devtron/auth_model.conf .

COPY --chown=devtron:devtron --from=build-env /go/src/github.com/devtron-labs/devtron/cmd/external-app/devtron-ea .

#COPY --from=build-env /go/src/github.com/devtron-labs/devtron/vendor/github.com/argoproj/argo-cd/assets/ /go/src/github.com/devtron-labs/devtron/vendor/github.com/argoproj/argo-cd/assets
COPY --from=build-env /go/src/github.com/devtron-labs/devtron/argocd-assets/ /go/src/github.com/devtron-labs/devtron/vendor/github.com/argoproj/argo-cd/assets

COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/devtron-reference-helm-charts scripts/devtron-reference-helm-charts

COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/sql scripts/sql

COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/casbin scripts/casbin

COPY --from=build-env /go/src/github.com/devtron-labs/devtron/scripts/argo-assets/APPLICATION_TEMPLATE.tmpl scripts/argo-assets/APPLICATION_TEMPLATE.tmpl

RUN useradd -ms /bin/bash devtron
RUN chown -R devtron:devtron ./devtron-ea
RUN chown -R devtron:devtron ./auth_model.conf
RUN chown -R devtron:devtron ./scripts

USER devtron
Expand Down
41 changes: 17 additions & 24 deletions Wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
"github.com/devtron-labs/devtron/api/externalLink"
fluxApplication "github.com/devtron-labs/devtron/api/fluxApplication"
client "github.com/devtron-labs/devtron/api/helm-app"
"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"
Expand Down Expand Up @@ -79,8 +78,10 @@ import (
"github.com/devtron-labs/devtron/cel"
"github.com/devtron-labs/devtron/client/argocdServer"
"github.com/devtron-labs/devtron/client/argocdServer/application"
"github.com/devtron-labs/devtron/client/argocdServer/bean"
"github.com/devtron-labs/devtron/client/argocdServer/certificate"
cluster2 "github.com/devtron-labs/devtron/client/argocdServer/cluster"
acdConfig "github.com/devtron-labs/devtron/client/argocdServer/config"
"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"
Expand Down Expand Up @@ -129,7 +130,8 @@ import (
"github.com/devtron-labs/devtron/pkg/chart/gitOpsConfig"
chartRepoRepository "github.com/devtron-labs/devtron/pkg/chartRepo/repository"
"github.com/devtron-labs/devtron/pkg/commonService"
"github.com/devtron-labs/devtron/pkg/configDiff"
"github.com/devtron-labs/devtron/pkg/config"
"github.com/devtron-labs/devtron/pkg/config/configDiff"
delete2 "github.com/devtron-labs/devtron/pkg/delete"
deployment2 "github.com/devtron-labs/devtron/pkg/deployment"
"github.com/devtron-labs/devtron/pkg/deployment/common"
Expand All @@ -143,17 +145,14 @@ import (
"github.com/devtron-labs/devtron/pkg/generateManifest"
"github.com/devtron-labs/devtron/pkg/gitops"
"github.com/devtron-labs/devtron/pkg/imageDigestPolicy"
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/infraConfig"
"github.com/devtron-labs/devtron/pkg/kubernetesResourceAuditLogs"
repository7 "github.com/devtron-labs/devtron/pkg/kubernetesResourceAuditLogs/repository"
"github.com/devtron-labs/devtron/pkg/notifier"
"github.com/devtron-labs/devtron/pkg/pipeline"
"github.com/devtron-labs/devtron/pkg/pipeline/executors"
history3 "github.com/devtron-labs/devtron/pkg/pipeline/history"
repository3 "github.com/devtron-labs/devtron/pkg/pipeline/history/repository"
"github.com/devtron-labs/devtron/pkg/pipeline/infraProviders"
repository5 "github.com/devtron-labs/devtron/pkg/pipeline/repository"
"github.com/devtron-labs/devtron/pkg/pipeline/types"
"github.com/devtron-labs/devtron/pkg/plugin"
Expand Down Expand Up @@ -229,7 +228,7 @@ func InitializeApp() (*App, error) {
connection.SettingsManager,
// auth.GetConfigForDevtronApps,

connection.GetConfig,
bean.GetConfig,
wire.Bind(new(session2.ServiceClient), new(*middleware.LoginService)),

sse.NewSSE,
Expand Down Expand Up @@ -278,20 +277,6 @@ func InitializeApp() (*App, error) {
wire.Bind(new(dashboardEvent.DashboardTelemetryRouter),
new(*dashboardEvent.DashboardTelemetryRouterImpl)),

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

units.NewUnits,
infraConfigService.NewInfraConfigServiceImpl,
wire.Bind(new(infraConfigService.InfraConfigService), new(*infraConfigService.InfraConfigServiceImpl)),
infraProviders.NewInfraProviderImpl,
wire.Bind(new(infraProviders.InfraProvider), new(*infraProviders.InfraProviderImpl)),
infraConfig.NewInfraConfigRestHandlerImpl,
wire.Bind(new(infraConfig.InfraConfigRestHandler), new(*infraConfig.InfraConfigRestHandlerImpl)),

infraConfig.NewInfraProfileRouterImpl,
wire.Bind(new(infraConfig.InfraConfigRouter), new(*infraConfig.InfraConfigRouterImpl)),

router.NewMuxRouter,

app2.NewAppRepositoryImpl,
Expand Down Expand Up @@ -526,6 +511,10 @@ func InitializeApp() (*App, error) {
chartConfig.NewConfigMapRepositoryImpl,
wire.Bind(new(chartConfig.ConfigMapRepository), new(*chartConfig.ConfigMapRepositoryImpl)),

config.WireSet,

infraConfig.WireSet,

notifier.NewSESNotificationServiceImpl,
wire.Bind(new(notifier.SESNotificationService), new(*notifier.SESNotificationServiceImpl)),

Expand Down Expand Up @@ -926,6 +915,7 @@ func InitializeApp() (*App, error) {
wire.Bind(new(resourceQualifiers.QualifierMappingService), new(*resourceQualifiers.QualifierMappingServiceImpl)),

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

pipeline.NewPluginInputVariableParserImpl,
Expand All @@ -937,7 +927,7 @@ func InitializeApp() (*App, error) {
wire.Bind(new(imageDigestPolicy.ImageDigestPolicyService), new(*imageDigestPolicy.ImageDigestPolicyServiceImpl)),

certificate.NewServiceClientImpl,
wire.Bind(new(certificate.Client), new(*certificate.ServiceClientImpl)),
wire.Bind(new(certificate.ServiceClient), new(*certificate.ServiceClientImpl)),

appStoreRestHandler.FullModeWireSet,

Expand All @@ -950,14 +940,17 @@ func InitializeApp() (*App, error) {
common.NewDeploymentConfigServiceImpl,
wire.Bind(new(common.DeploymentConfigService), new(*common.DeploymentConfigServiceImpl)),

repoCredsK8sClient.NewRepositorySecret,
wire.Bind(new(repoCredsK8sClient.RepositoryCreds), new(*repoCredsK8sClient.RepositorySecretImpl)),
repoCredsK8sClient.NewRepositoryCredsK8sClientImpl,
wire.Bind(new(repoCredsK8sClient.RepositoryCredsK8sClient), new(*repoCredsK8sClient.RepositoryCredsK8sClientImpl)),

repocreds.NewServiceClientImpl,
wire.Bind(new(repocreds.ServiceClient), new(*repocreds.ServiceClientImpl)),

dbMigration.NewDbMigrationServiceImpl,
wire.Bind(new(dbMigration.DbMigration), new(*dbMigration.DbMigrationServiceImpl)),

acdConfig.NewArgoCDConfigGetter,
wire.Bind(new(acdConfig.ArgoCDConfigGetter), new(*acdConfig.ArgoCDConfigGetterImpl)),
)
return &App{}, nil
}
5 changes: 1 addition & 4 deletions api/appStore/InstalledAppRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"time"

"github.com/devtron-labs/devtron/api/restHandler/common"
"github.com/devtron-labs/devtron/client/argocdServer/application"
"github.com/devtron-labs/devtron/client/cron"
"github.com/devtron-labs/devtron/internal/constants"
"github.com/devtron-labs/devtron/internal/middleware"
Expand Down Expand Up @@ -84,7 +83,6 @@ type InstalledAppRestHandlerImpl struct {
chartGroupService chartGroup.ChartGroupService
validator *validator.Validate
clusterService cluster.ClusterService
acdServiceClient application.ServiceClient
appStoreDeploymentService service.AppStoreDeploymentService
appStoreDeploymentDBService service.AppStoreDeploymentDBService
helmAppClient client.HelmAppClient
Expand All @@ -100,7 +98,7 @@ func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService u
installedAppService FullMode.InstalledAppDBExtendedService,
installedAppResourceService resource.InstalledAppResourceService,
chartGroupService chartGroup.ChartGroupService, validator *validator.Validate, clusterService cluster.ClusterService,
acdServiceClient application.ServiceClient, appStoreDeploymentService service.AppStoreDeploymentService,
appStoreDeploymentService service.AppStoreDeploymentService,
appStoreDeploymentDBService service.AppStoreDeploymentDBService,
helmAppClient client.HelmAppClient,

Expand All @@ -120,7 +118,6 @@ func NewInstalledAppRestHandlerImpl(Logger *zap.SugaredLogger, userAuthService u
chartGroupService: chartGroupService,
validator: validator,
clusterService: clusterService,
acdServiceClient: acdServiceClient,
appStoreDeploymentService: appStoreDeploymentService,
appStoreDeploymentDBService: appStoreDeploymentDBService,
helmAppClient: helmAppClient,
Expand Down
Loading

0 comments on commit 9746989

Please sign in to comment.