repo-scaffolding Plugin¶
This plugin bootstraps a GitHub or GitLab repo with scaffolding code for a web application.
Usage¶
The following content is an example of the "tool file".
For more information on the main config, the tool file, and the var file of DevStream, see Core Concepts Overview and DevStream Configuration.
tools:
# name of the tool
- name: repo-scaffolding
# id of the tool instance
instanceID: default
# format: name.instanceID; If specified, dtm will make sure the dependency is applied first before handling this tool.
dependsOn: [ ]
# options for the plugin
options:
# desinationRepo is the config for desination repo
destinationRepo:
# scm common field
branch: YOUR_REPO_BRANCH
token: YOUR_REPO_SCM_TOKEN
# you can directly use the url of repo (git@gitlab.com/root/test-exmaple.git for example)
url: YOUR_REPO_URL
# or you can config detailed fields for this repo
owner: YOUR_REPO_OWNER
org: YOUR_REPO_ORG
name: YOUR_REPO_NAME
scmType: gitlab
# you can config this field if you are using self-host gitlab
baseURL: YOUR_SELF_HOST_GITLAB_URL
# sourceRepo is the template repo location, support github only
sourceRepo:
# scm common field
branch: YOUR_REPO_BRANCH
token: YOUR_REPO_SCM_TOKEN
# you can directly use the url of repo (git@github.com/root/test-exmaple.git for example)
url: YOUR_REPO_URL
# or you can config detailed fields for this repo
owner: YOUR_REPO_OWNER
org: YOUR_REPO_ORG
name: YOUR_REPO_NAME
scmType: github
# this is used for template render
vars:
imageRepo: YOUR_DOCKERHUB_REPOSITORY
Notes:
- If you run
dtm delete, the repo will be completely removed. - If the
Updateinterface is called, the repo will be completely removed and recreated. - For the
repo-scaffoldingplugin, we only needrepo,delete_repopermission for the token. destinationRepoconfig option represents codebase location; for more info, you can refer to SCM Config.sourceRepoconfig option represents codebase location; for more info, you can refer to SCM Config.- if
destinationRepotype isGitlab, thenDevstreamsupports configdestinationRepo.visibility. This configuration is used to set the permissions of the new repository. The options arepublic,private, andinternal.
vars¶
This configuration is used for template rendering, It has default variables listed below:
{
"AppName": destinationRepo.repo,
"Repo": {
"Name": destinationRepo.repo,
"Owner": destinationRepo.owner
}
}
Outputs¶
This plugin has three outputs:
ownerreporepoURL
Examples¶
official scaffolding repo config¶
These repositories are official scaffolding repo to use for sourceRepo config; You can use these repo directly or just create one for yourself.
| language | org | repo |
|---|---|---|
| Golang | devstream-io | dtm-repo-scaffolding-golang-gin |
| Golang | devstream-io | dtm-repo-scaffolding-golang-cli |
| Python | devstream-io | dtm-repo-scaffolding-python-flask |
| Java | devstream-io | dtm-repo-scaffolding-java-springboot |
Golang¶
tools:
- name: repo-scaffolding
instanceID: golang-scaffolding
options:
destinationRepo:
owner: test_owner
org: ""
name: dtm-test-golang
branch: main
scmType: github
sourceRepo:
org: devstream-io
name: dtm-repo-scaffolding-golang-gin
scmType: github
vars:
imageRepo: dtm-test/golang-repo
This config will create dtm-test-golang repo for user test_owner in GitHub, and the variable ImageRepo will be used for template rendering.
Golang CLI¶
tools:
- name: repo-scaffolding
instanceID: golang-cli-scaffolding
options:
destinationRepo:
owner: test_owner
org: ""
name: dtm-test-golang-cli
branch: main
scmType: github
sourceRepo:
org: devstream-io
name: dtm-repo-scaffolding-golang-cli
scmType: github
This config will create dtm-test-golang-cli repo for user test_owner in GitHub.
Java Spring¶
tools:
- name: repo-scaffolding
instanceID: java-scaffolding
options:
destinationRepo:
owner: test_owner
org: ""
name: dtm-test-java
branch: main
baseUrl: 127.0.0.1:30001
visibility: public
scmType: gitlab
sourceRepo:
org: devstream-io
name: dtm-repo-scaffolding-java-springboot
scmType: github
This config will create dtm-test-java repo for user test_owner in GitHub.