From b5ddbb9720a78dea5752a83d13e28bf6afa8540a Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 8 Mar 2024 16:25:31 +0800 Subject: [PATCH] fix: blueprint gets disabled when disabling dora for project --- backend/scripts/build-plugins.sh | 4 ++-- backend/server/services/init.go | 3 --- backend/server/services/project.go | 18 +++++++++--------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/backend/scripts/build-plugins.sh b/backend/scripts/build-plugins.sh index 50e4876f85a..565da7eaa37 100755 --- a/backend/scripts/build-plugins.sh +++ b/backend/scripts/build-plugins.sh @@ -47,7 +47,7 @@ if [ "$DEVLAKE_PLUGINS" = "none" ]; then fi if [ -n "$DEVLAKE_DEBUG" ]; then - EXTRA="-gcflags='all=-N -l'" + GCFLAGS=all=-N\ -l fi if [ -z "$DEVLAKE_PLUGINS" ]; then @@ -67,7 +67,7 @@ PIDS="" for PLUG in $PLUGINS; do NAME=$(basename $PLUG) echo "Building plugin $NAME to bin/plugins/$NAME/$NAME.so with args: $*" - go build -buildmode=plugin $EXTRA -o $PLUGIN_OUTPUT_DIR/$NAME/$NAME.so $PLUG/*.go & + go build -buildmode=plugin --gcflags="$GCFLAGS" -o $PLUGIN_OUTPUT_DIR/$NAME/$NAME.so $PLUG/*.go & PIDS="$PIDS $!" # avoid too many processes causing signal killed COUNT=$(echo "$PIDS" | wc -w) diff --git a/backend/server/services/init.go b/backend/server/services/init.go index 86558ce55bc..b40d99ff2e2 100644 --- a/backend/server/services/init.go +++ b/backend/server/services/init.go @@ -119,9 +119,6 @@ func ExecuteMigration() errors.Error { // cronjob for blueprint triggering location := cron.WithLocation(time.UTC) cronManager = cron.New(location) - if err != nil { - panic(err) - } // initialize pipeline server, mainly to start the pipeline consuming process pipelineServiceInit() diff --git a/backend/server/services/project.go b/backend/server/services/project.go index 9ebc1e7aed1..51d773e820a 100644 --- a/backend/server/services/project.go +++ b/backend/server/services/project.go @@ -224,14 +224,14 @@ func PatchProject(name string, body map[string]interface{}) (*models.ApiOutputPr } // Blueprint - err = tx.UpdateColumn( - &models.Blueprint{}, - "enable", projectInput.Enable, - dal.Where("project_name = ?", name), - ) - if err != nil { - return nil, err - } + // err = tx.UpdateColumn( + // &models.Blueprint{}, + // "enable", projectInput.Enable, + // dal.Where("project_name = ?", name), + // ) + // if err != nil { + // return nil, err + // } // refresh project metrics if needed if len(projectInput.Metrics) > 0 { @@ -377,7 +377,7 @@ func makeProjectOutput(project *models.Project, withLastPipeline bool) (*models. } if withLastPipeline { if projectOutput.Blueprint == nil { - logger.Warn(fmt.Errorf("Blueprint is nil"), "want to get latest pipeline, but blueprint is nil") + logger.Warn(fmt.Errorf("blueprint is nil"), "want to get latest pipeline, but blueprint is nil") } else { pipelines, pipelinesCount, err := GetPipelines(&PipelineQuery{ BlueprintId: projectOutput.Blueprint.ID,