-
Notifications
You must be signed in to change notification settings - Fork 31
/
index.js
executable file
·75 lines (70 loc) · 1.78 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env node
"use strict";
const meow = require("meow");
const bbrun = require("./src/bbrun");
const cli = meow(
`
Usage
$ bbrun <step> <options>
Options
--template (-t), build template, defaults to "bitbucket-pipelines.yml"
--pipeline (-p), pipeline to execute. "default" if not provided
--env (-e), define environment variables for execution
--work-dir (-w), docker working directory, defaults to "ws"
--dry-run (-d), performs dry run, printing the docker command
--interactive (-i), starts an interactive bash session in the container
--ignore-folder (-if), maps the folder to an empty folder (useful for forcing package managers to reinstall)
--help, prints this very guide
Examples:
Execute all steps in the default pipeline from bitbucket-pipelines.yml
$ bbrun
$ bbrun --template bitbucket-template.yml
$ bbrun --pipeline default
Execute a single step by its name
$ bbrun test
$ bbrun "Integration Tests"
Execute steps from different pipelines
$ bbrun test --pipeline branches:master
Define an environment variable
$ bbrun test --env EDITOR=vim
$ bbrun test --env "EDITOR=vim, USER=root"
`,
{
flags: {
pipeline: {
type: "string",
alias: "p"
},
template: {
type: "string",
alias: "t"
},
env: {
type: "string",
alias: "e"
},
"work-dir": {
type: "string",
alias: "w"
},
interactive: {
type: "boolean",
alias: "i"
},
"dry-run": {
type: "boolean",
alias: "d"
},
"ignore-folder": {
type: "string",
alias: "f"
}
}
}
);
try {
bbrun(cli.flags, cli.input[0]);
} catch (error) {
console.error(error.message);
process.exit(1);
}