Skip to content

Commit 69884d1

Browse files
committed
reserve CiRunnerWorkingDir path in OutputDirectoryPath before saving
1 parent 994a9d8 commit 69884d1

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
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: 9 additions & 0 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/constants"
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"
@@ -36,6 +37,7 @@ import (
3637
"github.com/go-pg/pg"
3738
"go.uber.org/zap"
3839
"net/http"
40+
"strings"
3941
"time"
4042
)
4143

@@ -679,6 +681,13 @@ func (impl *PipelineStageServiceImpl) CreateStageSteps(steps []*bean.PipelineSta
679681
impl.logger.Errorw("error in creating script and mapping for inline step", "err", err, "inlineStepDetail", inlineStepDetail)
680682
return err
681683
}
684+
for _, path := range step.OutputDirectoryPath {
685+
if strings.HasPrefix(path, constants.CiRunnerWorkingDir) {
686+
errMsg := fmt.Sprintf("output directory path cannot start with reserved path %s", constants.CiRunnerWorkingDir)
687+
return util.NewApiError(http.StatusBadRequest, errMsg, errMsg)
688+
}
689+
}
690+
682691
inlineStep := &repository.PipelineStageStep{
683692
PipelineStageId: stageId,
684693
Name: step.Name,

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"

0 commit comments

Comments
 (0)