Skip to content

Commit f5752b8

Browse files
committed
ci triggeredBy updates
1 parent 3356c63 commit f5752b8

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

client/cron/CiTriggerCron.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121
"github.com/caarlos0/env"
2222
repository2 "github.com/devtron-labs/devtron/internal/sql/repository"
23+
bean2 "github.com/devtron-labs/devtron/pkg/auth/user/bean"
2324
"github.com/devtron-labs/devtron/pkg/bean"
2425
pipelineConfigBean "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
2526
"github.com/devtron-labs/devtron/pkg/pipeline"
@@ -98,7 +99,7 @@ func (impl *CiTriggerCronImpl) TriggerCiCron() {
9899
ciTriggerRequest := bean.CiTriggerRequest{
99100
PipelineId: ciPipelineId,
100101
CiPipelineMaterial: ciPipelineMaterials,
101-
TriggeredBy: 1,
102+
TriggeredBy: bean2.SYSTEM_USER_ID,
102103
InvalidateCache: false,
103104
PipelineType: string(pipelineConfigBean.CI_JOB),
104105
}

internal/sql/repository/app/AppRepository.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ func (app *App) IsEmpty() bool {
4848
return app.Id == 0
4949
}
5050

51-
const (
52-
SYSTEM_USER_ID = 1
53-
)
54-
5551
func (app *App) IsAppJobOrExternalType() bool {
5652
return len(app.DisplayName) > 0
5753
}

pkg/build/git/gitWebhook/GitWebhookService.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/devtron-labs/devtron/client/gitSensor"
2121
"github.com/devtron-labs/devtron/internal/sql/constants"
2222
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig"
23+
bean2 "github.com/devtron-labs/devtron/pkg/auth/user/bean"
2324
"github.com/devtron-labs/devtron/pkg/bean"
2425
"github.com/devtron-labs/devtron/pkg/build/git/gitWebhook/repository"
2526
"github.com/devtron-labs/devtron/pkg/pipeline"
@@ -71,7 +72,7 @@ func (impl *GitWebhookServiceImpl) HandleGitWebhook(gitWebhookRequest gitSensor.
7172

7273
resp, err := impl.ciHandler.HandleCIWebhook(bean.GitCiTriggerRequest{
7374
CiPipelineMaterial: ciPipelineMaterial,
74-
TriggeredBy: 1, // Automatic trigger, userId is 1
75+
TriggeredBy: bean2.SYSTEM_USER_ID, // Automatic trigger, system user
7576
ExtraEnvironmentVariables: gitWebhookRequest.ExtraEnvironmentVariables,
7677
})
7778
if err != nil {

pkg/pipeline/CiHandler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/devtron-labs/common-lib/utils/workFlow"
2626
"github.com/devtron-labs/devtron/internal/sql/constants"
2727
"github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/workflow/cdWorkflow"
28+
bean6 "github.com/devtron-labs/devtron/pkg/auth/user/bean"
2829
"github.com/devtron-labs/devtron/pkg/bean/common"
2930
"github.com/devtron-labs/devtron/pkg/build/artifacts/imageTagging"
3031
bean4 "github.com/devtron-labs/devtron/pkg/build/pipeline/bean"
@@ -222,7 +223,7 @@ func (impl *CiHandlerImpl) reTriggerCi(retryCount int, refCiWorkflow *pipelineCo
222223
}
223224

224225
trigger := types.Trigger{}
225-
trigger.BuildTriggerObject(refCiWorkflow, ciMaterials, 1, true, nil, "")
226+
trigger.BuildTriggerObject(refCiWorkflow, ciMaterials, bean6.SYSTEM_USER_ID, true, nil, "")
226227
_, err = impl.ciService.TriggerCiPipeline(trigger)
227228

228229
if err != nil {

0 commit comments

Comments
 (0)