Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chart-sync/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/devtron-labs/chart-sync

go 1.25.0

replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6
replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc

require (
github.com/caarlos0/env v3.5.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions chart-sync/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6 h1:TdSTr402uQpelYxrX+FsLOXx7g1OoYJe1PyO/oOv700=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6/go.mod h1:pehekzNkt2KRGZ3VC1b274Qq3iPBh27vGTby88T6KtI=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc h1:vUG3Va+7UGT36MPJL1l/VckJUVj36YG6aX6HimNGluY=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc/go.mod h1:pehekzNkt2KRGZ3VC1b274Qq3iPBh27vGTby88T6KtI=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/distribution/distribution/v3 v3.0.0 h1:q4R8wemdRQDClzoNNStftB2ZAfqOiN6UX90KJc4HjyM=
Expand Down
11 changes: 10 additions & 1 deletion chart-sync/internals/sql/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/caarlos0/env"
"github.com/devtron-labs/common-lib/utils"
"github.com/devtron-labs/common-lib/utils/bean"
commonSql "github.com/devtron-labs/common-lib/utils/sql"
"github.com/go-pg/pg"
"go.uber.org/zap"
"reflect"
Expand All @@ -16,6 +17,8 @@ type Config struct {
Password string `env:"PG_PASSWORD" envDefault:"password" secretData:"-"`
Database string `env:"PG_DATABASE" envDefault:"orchestrator"`
ApplicationName string `env:"APP" envDefault:"chart-sync"`
SslMode string `env:"PG_SSL_MODE" envDefault:""`
SslRootCert string `env:"PG_SSL_ROOT_CERT" envDefault:""`
bean.PgQueryMonitoringConfig
}

Expand All @@ -34,17 +37,23 @@ func GetConfig() (*Config, error) {
}

func NewDbConnection(cfg *Config, logger *zap.SugaredLogger) (*pg.DB, error) {
tlsConfig, err := commonSql.BuildTLSConfig(cfg.SslMode, cfg.SslRootCert, cfg.Addr)
if err != nil {
logger.Errorw("error in building tls config for db connection", "err", err)
return nil, err
}
options := pg.Options{
Addr: cfg.Addr + ":" + cfg.Port,
User: cfg.User,
Password: cfg.Password,
Database: cfg.Database,
ApplicationName: cfg.ApplicationName,
TLSConfig: tlsConfig,
}
dbConnection := pg.Connect(&options)
//check db connection
var test string
_, err := dbConnection.QueryOne(&test, `SELECT 1`)
_, err = dbConnection.QueryOne(&test, `SELECT 1`)

if err != nil {
logger.Errorw("error in connecting db ", "db", obfuscateSecretTags(cfg), "err", err)
Expand Down

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

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

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

4 changes: 2 additions & 2 deletions chart-sync/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ github.com/containerd/platforms
# github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
## explicit
github.com/davecgh/go-spew/spew
# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6
# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc
## explicit; go 1.25.0
github.com/devtron-labs/common-lib/constants
github.com/devtron-labs/common-lib/fetchAllEnv
Expand Down Expand Up @@ -951,5 +951,5 @@ sigs.k8s.io/structured-merge-diff/v6/value
## explicit; go 1.22
sigs.k8s.io/yaml
sigs.k8s.io/yaml/kyaml
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc
# github.com/containerd/containerd v1.7.27 => github.com/containerd/containerd v1.7.29
2 changes: 1 addition & 1 deletion ci-runner/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/devtron-labs/ci-runner

go 1.25.0

replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6
replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc

require (
github.com/Knetic/govaluate v3.0.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions ci-runner/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6 h1:TdSTr402uQpelYxrX+FsLOXx7g1OoYJe1PyO/oOv700=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6/go.mod h1:pehekzNkt2KRGZ3VC1b274Qq3iPBh27vGTby88T6KtI=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc h1:vUG3Va+7UGT36MPJL1l/VckJUVj36YG6aX6HimNGluY=
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc/go.mod h1:pehekzNkt2KRGZ3VC1b274Qq3iPBh27vGTby88T6KtI=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/cli v29.2.0+incompatible h1:9oBd9+YM7rxjZLfyMGxjraKBKE4/nVyvVfN4qNl9XRM=
Expand Down
4 changes: 2 additions & 2 deletions ci-runner/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ github.com/cncf/xds/go/xds/type/v3
# github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
## explicit
github.com/davecgh/go-spew/spew
# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6
# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc
## explicit; go 1.25.0
github.com/devtron-labs/common-lib/blob-storage
github.com/devtron-labs/common-lib/constants
Expand Down Expand Up @@ -1213,4 +1213,4 @@ sigs.k8s.io/structured-merge-diff/v4/value
## explicit; go 1.22
sigs.k8s.io/yaml
sigs.k8s.io/yaml/goyaml.v2
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260415113300-e49850611af6
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260707131338-7cbce898d5fc
9 changes: 9 additions & 0 deletions common-lib/securestore/AttributesRepoDBConnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/caarlos0/env"
"github.com/devtron-labs/common-lib/utils"
"github.com/devtron-labs/common-lib/utils/bean"
"github.com/devtron-labs/common-lib/utils/sql"
"github.com/go-pg/pg"
"log"
)
Expand All @@ -23,6 +24,8 @@ type config struct {
Password string `env:"PG_PASSWORD" envDefault:"" secretData:"-"`
Database string `env:"PG_DATABASE" envDefault:"orchestrator"`
ApplicationName string `env:"APP" envDefault:"orchestrator"`
SslMode string `env:"PG_SSL_MODE" envDefault:""`
SslRootCert string `env:"PG_SSL_ROOT_CERT" envDefault:""`
bean.PgQueryMonitoringConfig
LocalDev bool `env:"RUNTIME_CONFIG_LOCAL_DEV" envDefault:"false"`
}
Expand All @@ -49,12 +52,18 @@ func newDbConnection(databaseName string) (*pg.DB, error) {
if err != nil {
return nil, err
}
tlsConfig, err := sql.BuildTLSConfig(cfg.SslMode, cfg.SslRootCert, cfg.Addr)
if err != nil {
log.Println("error in building tls config for orchestrator db ", "err", err)
return nil, err
}
options := pg.Options{
Addr: cfg.Addr + ":" + cfg.Port,
User: cfg.User,
Password: cfg.Password,
Database: cfg.Database,
ApplicationName: cfg.ApplicationName,
TLSConfig: tlsConfig,
}
dbConnection := pg.Connect(&options)
//check db connection
Expand Down
9 changes: 9 additions & 0 deletions common-lib/securestore/rollback/rollback_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/json"
"fmt"
"github.com/devtron-labs/common-lib/securestore"
"github.com/devtron-labs/common-lib/utils/sql"
"strings"
"time"

Expand Down Expand Up @@ -290,6 +291,8 @@ type config struct {
Password string `env:"PG_PASSWORD" envDefault:"" secretData:"-"`
Database string `env:"PG_DATABASE" envDefault:"orchestrator"`
ApplicationName string `env:"APP" envDefault:"orchestrator"`
SslMode string `env:"PG_SSL_MODE" envDefault:""`
SslRootCert string `env:"PG_SSL_ROOT_CERT" envDefault:""`
LocalDev bool `env:"RUNTIME_CONFIG_LOCAL_DEV" envDefault:"false"`
}

Expand All @@ -307,12 +310,18 @@ func newDbConnection() (*pg.DB, error) {
if err != nil {
return nil, err
}
tlsConfig, err := sql.BuildTLSConfig(cfg.SslMode, cfg.SslRootCert, cfg.Addr)
if err != nil {
log.Errorf("error in building tls config for database %s: %v", cfg.Database, err)
return nil, err
}
options := pg.Options{
Addr: cfg.Addr + ":" + cfg.Port,
User: cfg.User,
Password: cfg.Password,
Database: cfg.Database,
ApplicationName: cfg.ApplicationName,
TLSConfig: tlsConfig,
}
dbConnection := pg.Connect(&options)
//check db connection
Expand Down
Loading
Loading