0.1.1 • Published 4 years ago

runas-plugin-scm-git v0.1.1

Weekly downloads
12
License
-
Repository
-
Last release
4 years ago

SCM operations for runas (Git implementation)

Hook (stages: config)

Any step can configure this plugin to perform a number of SCM operations.

1. Install plugin

Add package dependency:

npm install --save runas-plugin-scm-git

Add plugin on steps/$stepName/config.json plugins:

{
  "plugins: [
    [...]
    "scm"
  ]
}

2. Add git requirement to the step

{
  "requirements": {
    [...]
    "git": {}
  }
}

3. Configure plugin in config.json

Example:

{
  "scm": {
    "operation": "checkout",
    "repos": [{
      "repo": "ssh://git@globalrepos.com/ctool/runas-plugin-scm-git.git",
      "folder": "projects/tools"
    }],
    "jobs": 10
  }
}
  • operation Any of the operations supported by the plugin (see below)
  • repos A list of repos in which the operation will be performed. Each repo must be an object containing the fields required by the operation (see below)
  • jobs Number of jobs executed in parallel

Addons

this.scmClone

Executes git clone ${options.repo}. If present, sets current working directory to ${options.folder}. If not, works in the cwd.

ParamDescription
optionsobject containing the fields repo and folder
returnsa Promise with the complete child_process object result of the execution

this.scmPull

Executes git pull --rebase. If present, sets current working directory to ${options.folder}. If not, works in the cwd.

ParamDescription
optionsobject containing the field folder
returnsa Promise with the complete child_process object result of the execution

this.scmCheckout

Checks whether the ${options.repo} exists in ${options.folder} or not, and executes either a scmPull (if exists) or a scmClone (if not).

ParamDescription
optionsobject containing the fields repo and folder
returnsa Promise with the complete child_process object result of the execution

this.scmUpdate

Alias for scmPull.

this.scmAdd

Executes git add --all in the folder ${options.folder} (if not present, in the cwd).

ParamDescription
optionsobject containing the field folder
returnsa Promise with the complete child_process object result of the execution

this.scmCommit

Executes git commit -m ${options.message} in the folder ${options.folder} (if not present, in the cwd).

ParamDescription
optionsobject containing the fields message and folder
returnsa Promise with the complete child_process object result of the execution

this.scmPush

Executes git push -u origin ${options.branch} in the folder ${options.folder} (if not present, in the cwd). If ${options.branch} is not present, it will use the value master.

ParamDescription
optionsobject containing the fields branch and folder
returnsa Promise with the complete child_process object result of the execution

this.scmFetch

Executes git fetch -p in the folder ${options.folder} (if not present, in the cwd).

ParamDescription
optionsobject containing the fields branch and folder
returnsa Promise with the complete child_process object result of the execution