Skip to content

Commit 7f99896

Browse files
authored
Merge pull request #43 from screwdriver-cd/jithin1987-patch-1
fix(1075): Documenation for exchangeTokenForBuild
2 parents cbcb04e + 3944201 commit 7f99896

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ npm install screwdriver-executor-base
3333
| config.apiUri | String | Screwdriver's API |
3434
| config.buildId | String | The unique ID for a build |
3535
| config.container | String | Container for the build to run in |
36-
| config.token | String | JWT to act on behalf of the build |
36+
| config.token | String | Temporary JWT which Executor must exchange with API to get JWT which can act on behalf of the build |
3737

3838
##### Expected Outcome
3939
The start function is expected to create a [task] in the execution engine.
@@ -71,6 +71,20 @@ A Promise that resolves with the current build status, or rejects if it fails.
7171
##### Expected Outcome
7272
The `stats` function is expected to return an object of statistics
7373

74+
#### Status
75+
##### Required Parameters
76+
| Parameter | Type | Description |
77+
| :------------- | :---- | :-------------|
78+
| config | Object | Configuration Object |
79+
| config.token | String | Temporary JWT for a build |
80+
| buildTimeout | Number | Build timeout in minutes |
81+
82+
##### Expected Outcome
83+
The `exchangeTokenForBuild` function will call API to exchange temporary build JWT with actual build JWT.
84+
85+
##### Expected Return
86+
A Promise which resolves to actual build JWT
87+
7488
## Extending
7589
To make use of the validation function for start and stop, you need to
7690
override the `_start` and `_stop` methods.
@@ -80,8 +94,10 @@ class MyExecutor extends Executor {
8094
// Implement the interface
8195
_start(config) {
8296
if (config.buildId) {
83-
// do stuff here...
84-
return Promise.resolve(null);
97+
return this.exchangeTokenForBuild(config.token, buildTimeout).then(buildToken => {
98+
// do stuff here...
99+
return Promise.resolve(null);
100+
});
85101
}
86102

87103
return Promise.reject(new Error('Error starting executor'));

0 commit comments

Comments
 (0)