@@ -27,6 +27,96 @@ Install
2727$ npm install --save teamcity-build-queue
2828```
2929
30+ Usage
31+ -----
32+
33+ ``` js
34+ const queueInfo = require (' teamcity-build-queue' );
35+
36+ queueInfo (' http://teamcity.domain.com' , {
37+ projectPattern: ' project :: Pull requests :: *' ,
38+ ignoreDependencies: true , // ignore builds with dependencies that have not been built yet
39+ ignoreIncompatibleAgents: true // ignore builds without compatible agents
40+ })
41+ .then (queue => {
42+ console .log (queue .builds );
43+ console .log (queue .size );
44+ });
45+ ```
46+
47+ API
48+ ---
49+
50+ ### queueInfo(url[ , options] )
51+
52+ Returns a Promise, that resolves to object with builds from Build Queue.
53+
54+ #### url
55+
56+ Type: ` string `
57+
58+ The URL to TeamCity host.
59+
60+ #### options
61+
62+ Type: ` object `
63+
64+ #### options.projectPattern
65+
66+ Type: ` string `
67+
68+ The pattern of project name to filter builds.
69+
70+ If pattern is not specified, then all builds will be in the result.
71+
72+ ** Wildcards**
73+
74+ ``` js
75+ queueInfo (' http://teamcity.domain.com' , {
76+ projectPattern: ' project :: Pull requests :: *'
77+ });
78+
79+ // Will be taken into account builds the following assemblies:
80+
81+ // project :: Pull requests :: build
82+ // project :: Pull requests :: tests :: unit
83+ // project :: Pull requests :: tests :: e2e
84+ // project :: Pull requests :: docs
85+ // project :: Pull requests :: deploy
86+ // ...
87+ ```
88+
89+ ** Brace Expansion**
90+
91+ ``` js
92+ queueInfo (' http://teamcity.domain.com' , {
93+ projectPattern: ' project :: {Pull requests, dev} :: *'
94+ });
95+
96+ // Will be taken into account builds the following configurations:
97+ //
98+ // project :: Pull requests :: build
99+ // project :: Pull requests :: tests
100+ // ...
101+ // project :: dev :: build
102+ // project :: dev :: tests
103+ // ...
104+ ```
105+
106+ Read more about it in [ micromatch] ( https://github.com/jonschlinkert/micromatch#features ) package.
107+
108+ #### options.ignoreDependencies
109+
110+ Type: ` string ` Default: ` false `
111+
112+ To ignore builds with dependencies that have not been built yet.
113+
114+ #### options.ignoreIncompatibleAgents
115+
116+ Type: ` string ` Default: ` false `
117+
118+ To ignore builds without compatible agents.
119+
30120License
31121-------
32122
0 commit comments