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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ _debug_bin
postgres-data/
mysql-data/
.docker/
docker-compose.override.yml

# config files
local.js
Expand Down
2 changes: 1 addition & 1 deletion backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ all: build
go-dep:
go install github.com/vektra/mockery/[email protected]
go install github.com/swaggo/swag/cmd/[email protected]
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4

go-dev-tools:
# go install github.com/atombender/go-jsonschema/cmd/gojsonschema@latest
Expand Down
56 changes: 28 additions & 28 deletions backend/helpers/srvhelper/scope_service_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,39 +268,39 @@ func (scopeSrv *ScopeSrvHelper[C, S, SC]) getAffectedTables() ([]string, errors.
if err != nil {
return nil, err
}
if pluginModel, ok := meta.(plugin.PluginModel); !ok {
pluginModel, ok := meta.(plugin.PluginModel)
if !ok {
panic(errors.Default.New(fmt.Sprintf("plugin \"%s\" does not implement listing its tables", scopeSrv.pluginName)))
} else {
// Unfortunately, can't cache the tables because Python creates some tables on a per-demand basis, so such a cache would possibly get outdated.
// It's a rare scenario in practice, but might as well play it safe and sacrifice some performance here
var allTables []string
if allTables, err = scopeSrv.db.AllTables(); err != nil {
return nil, err
}
// collect raw tables
for _, table := range allTables {
if strings.HasPrefix(table, "_raw_"+scopeSrv.pluginName) {
tables = append(tables, table)
}
}
// Unfortunately, can't cache the tables because Python creates some tables on a per-demand basis, so such a cache would possibly get outdated.
// It's a rare scenario in practice, but might as well play it safe and sacrifice some performance here
var allTables []string
if allTables, err = scopeSrv.db.AllTables(); err != nil {
return nil, err
}
// collect raw tables
for _, table := range allTables {
if strings.HasPrefix(table, "_raw_"+scopeSrv.pluginName) {
tables = append(tables, table)
}
// collect tool tables
toolModels := pluginModel.GetTablesInfo()
for _, toolModel := range toolModels {
if !isScopeModel(toolModel) && hasField(toolModel, "RawDataParams") {
tables = append(tables, toolModel.TableName())
}
}
// collect tool tables
toolModels := pluginModel.GetTablesInfo()
for _, toolModel := range toolModels {
if !isScopeModel(toolModel) && hasField(toolModel, "RawDataParams") {
tables = append(tables, toolModel.TableName())
}
// collect domain tables
for _, domainModel := range domaininfo.GetDomainTablesInfo() {
// we only care about tables with RawOrigin
ok = hasField(domainModel, "RawDataParams")
if ok {
tables = append(tables, domainModel.TableName())
}
}
// collect domain tables
for _, domainModel := range domaininfo.GetDomainTablesInfo() {
// we only care about tables with RawOrigin
ok = hasField(domainModel, "RawDataParams")
if ok {
tables = append(tables, domainModel.TableName())
}
// additional tables
tables = append(tables, models.CollectorLatestState{}.TableName())
}
// additional tables
tables = append(tables, models.CollectorLatestState{}.TableName())
scopeSrv.log.Debug("Discovered %d tables used by plugin \"%s\": %v", len(tables), scopeSrv.pluginName, tables)
return tables, nil
}
Expand Down
8 changes: 4 additions & 4 deletions backend/impls/logruslog/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ func init() {
if basePath == "" {
basePath = "./logs"
}
if abs, err := filepath.Abs(basePath); err != nil {
panic(err)
} else {
basePath = filepath.Join(abs, "devlake.log")
abs, absErr := filepath.Abs(basePath)
if absErr != nil {
panic(absErr)
}
basePath = filepath.Join(abs, "devlake.log")
var err errors.Error
Global, err = NewDefaultLogger(inner)
if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion backend/plugins/bitbucket/api/blueprint_v200.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ func makeDataSourcePipelinePlanV200(
if err != nil {
return nil, err
}
cloneUrl.User = url.UserPassword(connection.Username, connection.Password)
// For Bitbucket API tokens, use x-token-auth as username per Bitbucket docs
// https://support.atlassian.com/bitbucket-cloud/docs/using-api-tokens/
gitUsername := connection.Username
if connection.UsesApiToken {
gitUsername = "x-bitbucket-api-token-auth"
}
cloneUrl.User = url.UserPassword(gitUsername, connection.Password)
stage = append(stage, &coreModels.PipelineTask{
Plugin: "gitextractor",
Options: map[string]interface{}{
Expand Down
8 changes: 7 additions & 1 deletion backend/plugins/bitbucket/api/connection_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,18 @@ func testConnection(ctx context.Context, connection models.BitbucketConn) (*BitB
}

if res.StatusCode == http.StatusUnauthorized {
return nil, errors.HttpStatus(http.StatusBadRequest).New("StatusUnauthorized error when testing connection")
return nil, errors.HttpStatus(http.StatusBadRequest).New("StatusUnauthorized error when testing connection. Please check your credentials.")
}

if res.StatusCode != http.StatusOK {
return nil, errors.HttpStatus(res.StatusCode).New("unexpected status code when testing connection")
}

// Log deprecation warning if using App Password (not API token)
if !connection.UsesApiToken {
basicRes.GetLogger().Warn(nil, "Bitbucket App passwords are deprecated and will be deactivated on June 9, 2026. Please migrate to API tokens.")
}

connection = connection.Sanitize()
body := BitBucketTestConnResponse{}
body.Success = true
Expand Down
Loading
Loading