Skip to content

Commit 4ff130d

Browse files
authored
Merge pull request #236 from devtron-labs/feat-file-variable-cm-mount
feat: mount file type variable in ci-runner through cm
2 parents 22cafd1 + 4b34490 commit 4ff130d

28 files changed

Lines changed: 73 additions & 60 deletions

File tree

chart-sync/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22.4
55
toolchain go1.22.6
66

77
replace (
8-
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16
8+
github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a
99
helm.sh/helm/v3 v3.14.3 => github.com/devtron-labs/helm/v3 v3.14.1-0.20240401080259-90238cf69e42
1010
)
1111

chart-sync/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr
5454
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5555
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5656
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
57-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16 h1:RSNAKhjsHIUh5TeiJu8MNaqJGr52dpQJ3BcMfRa9NlQ=
58-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16/go.mod h1:ceFKgQ2qm40PR95g5Xp2EClq7nDBKFTcglJ0JdsgClA=
57+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a h1:u1RxCB4k8oaw5r2pGBYQ9oybhv+UjuIt8zvBEdwpWu4=
58+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a/go.mod h1:ceFKgQ2qm40PR95g5Xp2EClq7nDBKFTcglJ0JdsgClA=
5959
github.com/devtron-labs/helm/v3 v3.14.1-0.20240401080259-90238cf69e42 h1:pJmK44QaSztOiZe0iQHNf0sdy5KwkAeceydyhOG4RaY=
6060
github.com/devtron-labs/helm/v3 v3.14.1-0.20240401080259-90238cf69e42/go.mod h1:v6myVbyseSBJTzhmeE39UcPLNv6cQK6qss3dvgAySaE=
6161
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=

chart-sync/vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ github.com/containerd/platforms
9393
# github.com/davecgh/go-spew v1.1.1
9494
## explicit
9595
github.com/davecgh/go-spew/spew
96-
# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16
96+
# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a
9797
## explicit; go 1.21
9898
github.com/devtron-labs/common-lib/fetchAllEnv
9999
github.com/devtron-labs/common-lib/git-manager/util
@@ -790,4 +790,4 @@ sigs.k8s.io/structured-merge-diff/v4/value
790790
# sigs.k8s.io/yaml v1.3.0
791791
## explicit; go 1.12
792792
sigs.k8s.io/yaml
793-
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16
793+
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a

ci-runner/executor/StageExecutor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func (impl *StageExecutorImpl) RunCiCdStep(stepType helper.StepType, ciCdRequest
294294
stepIndexFileMountMap := make(map[int]map[string]*fileContentDto)
295295
for _, inVar := range step.InputVars {
296296
if inVar.Format == commonBean.FormatTypeFile {
297-
fileContent := newFileContentDto(inVar.FileContent, inVar.Value)
297+
fileContent := newFileContentDto(inVar.FileReferencePath, inVar.Value)
298298
if fileMap, ok := stepIndexFileMountMap[inVar.VariableStepIndexInPlugin]; ok {
299299
fileMap[inVar.Name] = fileContent
300300
stepIndexFileMountMap[inVar.VariableStepIndexInPlugin] = fileMap
@@ -320,8 +320,8 @@ func (impl *StageExecutorImpl) RunCiCdStep(stepType helper.StepType, ciCdRequest
320320
if fileMap, ok := stepIndexFileMountMap[step.Index]; ok {
321321
for _, inVar := range step.InputVars {
322322
if fileContent, ok := fileMap[inVar.Name]; ok {
323-
inVar.Value = fileContent.filePath
324-
inVar.FileContent = fileContent.content
323+
inVar.Value = fileContent.mountPath
324+
inVar.FileReferencePath = fileContent.referencePath
325325
}
326326
}
327327
}

ci-runner/executor/scriptExecutor.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ type executionConf struct {
178178
}
179179

180180
type fileContentDto struct {
181-
content string
182-
filePath string
181+
referencePath string
182+
mountPath string
183183
}
184184

185-
func newFileContentDto(content, filePath string) *fileContentDto {
185+
func newFileContentDto(fileReferencePath, fileMountPath string) *fileContentDto {
186186
return &fileContentDto{
187-
content: content,
188-
filePath: filePath,
187+
referencePath: fileReferencePath,
188+
mountPath: fileMountPath,
189189
}
190190
}
191191

ci-runner/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.21
44

55
toolchain go1.21.8
66

7-
replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16
7+
replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a
88

99
require (
1010
github.com/Knetic/govaluate v3.0.0+incompatible

ci-runner/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
9595
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9696
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
9797
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
98-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16 h1:RSNAKhjsHIUh5TeiJu8MNaqJGr52dpQJ3BcMfRa9NlQ=
99-
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16/go.mod h1:ceFKgQ2qm40PR95g5Xp2EClq7nDBKFTcglJ0JdsgClA=
98+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a h1:u1RxCB4k8oaw5r2pGBYQ9oybhv+UjuIt8zvBEdwpWu4=
99+
github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a/go.mod h1:ceFKgQ2qm40PR95g5Xp2EClq7nDBKFTcglJ0JdsgClA=
100100
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
101101
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
102102
github.com/docker/cli v24.0.6+incompatible h1:fF+XCQCgJjjQNIMjzaSmiKJSCcfcXb3TWTcc7GAneOY=

ci-runner/vendor/github.com/devtron-labs/common-lib/workflow/bean.go

Lines changed: 12 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ci-runner/vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ github.com/cespare/xxhash/v2
248248
# github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
249249
## explicit
250250
github.com/davecgh/go-spew/spew
251-
# github.com/devtron-labs/common-lib v0.19.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16
251+
# github.com/devtron-labs/common-lib v0.19.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a
252252
## explicit; go 1.21
253253
github.com/devtron-labs/common-lib/blob-storage
254254
github.com/devtron-labs/common-lib/constants
@@ -991,4 +991,4 @@ sigs.k8s.io/structured-merge-diff/v4/value
991991
# sigs.k8s.io/yaml v1.3.0
992992
## explicit; go 1.12
993993
sigs.k8s.io/yaml
994-
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430085115-7367c85c5a16
994+
# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20250430094455-8725cd340b0a

common-lib/utils/k8s/commonBean/bean.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
)
2525

2626
const (
27+
ConfigMapKind = "ConfigMap"
2728
SecretKind = "Secret"
2829
ServiceKind = "Service"
2930
ServiceAccountKind = "ServiceAccount"
@@ -300,8 +301,8 @@ type PodMetadata struct {
300301
EphemeralContainers []*EphemeralContainerData `json:"ephemeralContainers"`
301302
}
302303

303-
// use value field as generic type
304304
// InfoItem contains arbitrary, human readable information about an application
305+
// use value field as generic type
305306
type InfoItem struct {
306307
// Name is a human readable title for this piece of information.
307308
Name string `json:"name,omitempty"`

0 commit comments

Comments
 (0)