Skip to content

Commit acdd584

Browse files
committed
Supporting exporting GitLab CI piplelines
1 parent f639595 commit acdd584

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

internal/cmdexport/cmdexport.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ func GetExportRunner() *ExportRunner {
5555
{
5656
r.Pipeline = new(orchestrators.CloudBuild)
5757
}
58+
case "gitlab-ci":
59+
{
60+
r.Pipeline = new(orchestrators.GitLabCI)
61+
}
5862
default:
5963
return fmt.Errorf("unsupported orchestrator %v", r.Orchestrator)
6064
}

internal/cmdexport/cmdexport_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,32 @@ steps:
176176
- .
177177
- --fn-path
178178
- functions
179+
`,
180+
},
181+
{
182+
description: "exports a GitLab CI pipeline with --fn-path",
183+
files: map[string]string{
184+
"resources/resource.yaml": "",
185+
"functions/function.yaml": "",
186+
},
187+
params: []string{
188+
"gitlab-ci",
189+
"resources",
190+
"--fn-path",
191+
"functions",
192+
"--output",
193+
".gitlab-ci.yml",
194+
},
195+
expected: `
196+
stages:
197+
- run-kpt-functions
198+
kpt:
199+
stage: run-kpt-functions
200+
image: docker
201+
services:
202+
- docker:dind
203+
script: docker run -v $PWD:/app -v /var/run/docker.sock:/var/run/docker.sock gongpu/kpt:latest
204+
fn run /app/resources --fn-path /app/functions
179205
`,
180206
},
181207
}

internal/docs/generated/fndocs/docs.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/content/en/reference/fn/export/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ kpt fn export github-actions DIR/ --fn-path FUNCTIONS_DIR/
3131
kpt fn export ORCHESTRATOR DIR/ [--fn-path FUNCTIONS_DIR/] [--output OUTPUT_FILENAME]
3232
3333
ORCHESTRATOR:
34-
Supported orchestrators are github-actions, and cloud-build.
34+
Supported orchestrators are github-actions, cloud-build, and gitlab-ci.
3535
DIR:
3636
Path to a package directory. If you do not specify the --fn-path flag, this command will discover functions in DIR and run them against resources in it.
3737
```

0 commit comments

Comments
 (0)