Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: switch ci fixes #5358

Merged
merged 11 commits into from
Jul 12, 2024
Prev Previous commit
Next Next commit
chore: refactoring
  • Loading branch information
gireesh-naidu committed Jul 8, 2024
commit a167b11a367954c8b29c645b3631ff75419010b7
6 changes: 4 additions & 2 deletions pkg/pipeline/BuildPipelineSwitchService.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
package pipeline

import (
"fmt"
"github.com/devtron-labs/devtron/internal/sql/repository/appWorkflow"
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
"github.com/devtron-labs/devtron/internal/util"
"github.com/devtron-labs/devtron/pkg/bean"
"github.com/devtron-labs/devtron/pkg/pipeline/adapter"
pipelineConfigBean "github.com/devtron-labs/devtron/pkg/pipeline/bean/CiPipeline"
Expand All @@ -29,6 +29,7 @@ import (
"github.com/go-pg/pg"
"github.com/juju/errors"
"go.uber.org/zap"
"net/http"
"time"
)

Expand Down Expand Up @@ -139,7 +140,8 @@ func (impl *BuildPipelineSwitchServiceImpl) createNewPipelineAndReplaceOldPipeli

isSelfLinkedCiPipeline := switchFromType != pipelineConfigBean.EXTERNAL && ciPipelineReq.IsLinkedCi() && ciPipelineReq.ParentCiPipeline == switchFromPipelineId
if isSelfLinkedCiPipeline {
return nil, fmt.Errorf("cannot create linked ci pipeline from the same source")
errMsg := "cannot create linked ci pipeline from the same source"
return nil, util.NewApiError().WithInternalMessage(errMsg).WithUserMessage(errMsg).WithHttpStatusCode(http.StatusBadRequest)
}

tx, err := impl.ciPipelineRepository.StartTx()
Expand Down
Loading