Skip to content

Commit

Permalink
Supporting exporting GitLab CI piplelines
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuGongpu committed Jul 7, 2020
1 parent f639595 commit acdd584
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
4 changes: 4 additions & 0 deletions internal/cmdexport/cmdexport.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func GetExportRunner() *ExportRunner {
{
r.Pipeline = new(orchestrators.CloudBuild)
}
case "gitlab-ci":
{
r.Pipeline = new(orchestrators.GitLabCI)
}
default:
return fmt.Errorf("unsupported orchestrator %v", r.Orchestrator)
}
Expand Down
26 changes: 26 additions & 0 deletions internal/cmdexport/cmdexport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,32 @@ steps:
- .
- --fn-path
- functions
`,
},
{
description: "exports a GitLab CI pipeline with --fn-path",
files: map[string]string{
"resources/resource.yaml": "",
"functions/function.yaml": "",
},
params: []string{
"gitlab-ci",
"resources",
"--fn-path",
"functions",
"--output",
".gitlab-ci.yml",
},
expected: `
stages:
- run-kpt-functions
kpt:
stage: run-kpt-functions
image: docker
services:
- docker:dind
script: docker run -v $PWD:/app -v /var/run/docker.sock:/var/run/docker.sock gongpu/kpt:latest
fn run /app/resources --fn-path /app/functions
`,
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/docs/generated/fndocs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion site/content/en/reference/fn/export/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ kpt fn export github-actions DIR/ --fn-path FUNCTIONS_DIR/
kpt fn export ORCHESTRATOR DIR/ [--fn-path FUNCTIONS_DIR/] [--output OUTPUT_FILENAME]
ORCHESTRATOR:
Supported orchestrators are github-actions, and cloud-build.
Supported orchestrators are github-actions, cloud-build, and gitlab-ci.
DIR:
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.
```
Expand Down

0 comments on commit acdd584

Please sign in to comment.