Skip to content

Commit fccc8a0

Browse files
Merge pull request #6686 from devtron-labs/output-path-infite-loop-fix
chore: when output dir path is /devtroncd inany pipeline stage step then the ci runner is stuck in recursive self-copy situation
2 parents 994a9d8 + 9cf81fe commit fccc8a0

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

env_gen.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

env_gen.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@
290290
| DASHBOARD_PORT | string |3000 | Port for dashboard micro-service | | false |
291291
| DEX_HOST | string |http://localhost | | | false |
292292
| DEX_PORT | string |5556 | | | false |
293-
| GIT_SENSOR_PROTOCOL | string |REST | Protocol to connect with git-sensor micro-service | | false |
293+
| GIT_SENSOR_PROTOCOL | string |GRPC | Protocol to connect with git-sensor micro-service | | false |
294294
| GIT_SENSOR_SERVICE_CONFIG | string |{"loadBalancingPolicy":"pick_first"} | git-sensor grpc service config | | false |
295295
| GIT_SENSOR_TIMEOUT | int |0 | Timeout for getting response from the git-sensor | | false |
296-
| GIT_SENSOR_URL | string |127.0.0.1:7070 | git-sensor micro-service url | | false |
296+
| GIT_SENSOR_URL | string |127.0.0.1:7071 | git-sensor micro-service url | | false |
297297
| HELM_CLIENT_URL | string |127.0.0.1:50051 | Kubelink micro-service url | | false |
298298
| KUBELINK_GRPC_MAX_RECEIVE_MSG_SIZE | int |20 | | | false |
299299
| KUBELINK_GRPC_MAX_SEND_MSG_SIZE | int |4 | | | false |

pkg/pipeline/PipelineStageService.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/devtron-labs/devtron/internal/util"
2626
"github.com/devtron-labs/devtron/pkg/pipeline/adapter"
2727
"github.com/devtron-labs/devtron/pkg/pipeline/bean"
28+
"github.com/devtron-labs/devtron/pkg/pipeline/helper"
2829
"github.com/devtron-labs/devtron/pkg/pipeline/repository"
2930
"github.com/devtron-labs/devtron/pkg/plugin"
3031
repository2 "github.com/devtron-labs/devtron/pkg/plugin/repository"
@@ -679,14 +680,15 @@ func (impl *PipelineStageServiceImpl) CreateStageSteps(steps []*bean.PipelineSta
679680
impl.logger.Errorw("error in creating script and mapping for inline step", "err", err, "inlineStepDetail", inlineStepDetail)
680681
return err
681682
}
683+
682684
inlineStep := &repository.PipelineStageStep{
683685
PipelineStageId: stageId,
684686
Name: step.Name,
685687
Description: step.Description,
686688
Index: step.Index,
687689
StepType: step.StepType,
688690
ScriptId: scriptEntryId,
689-
OutputDirectoryPath: step.OutputDirectoryPath,
691+
OutputDirectoryPath: helper.FilterReservedPathFromOutputDirPath(step.OutputDirectoryPath), // TODO: silently filtering reserved paths, not throwing error as of now since this flow is not in tx
690692
DependentOnStep: dependentOnStep,
691693
Deleted: false,
692694
AuditLog: sql.AuditLog{
@@ -1205,7 +1207,7 @@ func (impl *PipelineStageServiceImpl) UpdateStageStepsWithTx(steps []*bean.Pipel
12051207
Description: step.Description,
12061208
Index: step.Index,
12071209
StepType: step.StepType,
1208-
OutputDirectoryPath: step.OutputDirectoryPath,
1210+
OutputDirectoryPath: helper.FilterReservedPathFromOutputDirPath(step.OutputDirectoryPath),
12091211
DependentOnStep: dependentOnStep,
12101212
Deleted: false,
12111213
AuditLog: sql.AuditLog{

pkg/pipeline/constants/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ const Starting = "Starting"
4040
const TERMINATE_MESSAGE = "workflow shutdown with strategy: Terminate"
4141
const FORCE_ABORT_MESSAGE_AFTER_STARTING_STAGE = "workflow shutdown with strategy: Force Abort"
4242
const POD_TIMEOUT_MESSAGE = "Pod was active on the node longer than the specified deadline"
43+
const CiRunnerWorkingDir = "/devtroncd"

pkg/pipeline/helper/helper.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package helper
2+
3+
import (
4+
"github.com/devtron-labs/devtron/pkg/pipeline/constants"
5+
"strings"
6+
)
7+
8+
func FilterReservedPathFromOutputDirPath(outputDirectoryPath []string) []string {
9+
var newOutputDirPath []string
10+
for _, path := range outputDirectoryPath {
11+
if !strings.HasPrefix(path, constants.CiRunnerWorkingDir) {
12+
newOutputDirPath = append(newOutputDirPath, path)
13+
}
14+
}
15+
return newOutputDirPath
16+
}

0 commit comments

Comments
 (0)