@aikidosec/ci-api-client 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-and-release.yml +9 -4
- package/lib/aikidoApi.d.ts +1 -0
- package/lib/commands/scan.js +1 -1
- package/lib/commands/scanRelease.d.ts +1 -0
- package/lib/commands/scanRelease.js +9 -2
- package/lib/index.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/aikidoApi.ts +1 -0
- package/src/commands/scan.ts +1 -1
- package/src/commands/scanRelease.ts +15 -2
- package/src/index.ts +1 -1
|
@@ -3,6 +3,10 @@ on:
|
|
|
3
3
|
release:
|
|
4
4
|
types: [published]
|
|
5
5
|
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
6
10
|
jobs:
|
|
7
11
|
build:
|
|
8
12
|
runs-on: ubuntu-latest
|
|
@@ -14,11 +18,14 @@ jobs:
|
|
|
14
18
|
- uses: actions/checkout@v4
|
|
15
19
|
- uses: actions/setup-node@v4
|
|
16
20
|
with:
|
|
17
|
-
node-version: "
|
|
21
|
+
node-version: "22"
|
|
18
22
|
registry-url: "https://registry.npmjs.org"
|
|
19
23
|
scope: "@aikidosec"
|
|
20
24
|
cache: 'npm'
|
|
21
25
|
|
|
26
|
+
- name: Update npm
|
|
27
|
+
run: npm install -g npm@11.10.0 # pinned to 11.10.0 to work around https://github.com/nodejs/node/issues/62425
|
|
28
|
+
|
|
22
29
|
- name: Install dependencies
|
|
23
30
|
run: npm ci
|
|
24
31
|
|
|
@@ -35,6 +42,4 @@ jobs:
|
|
|
35
42
|
- name: Publish to NPM
|
|
36
43
|
run: |
|
|
37
44
|
echo "Publishing version ${{ steps.get_version.outputs.tag }} to NPM"
|
|
38
|
-
npm publish --
|
|
39
|
-
env:
|
|
40
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
|
45
|
+
npm publish --access public
|
package/lib/aikidoApi.d.ts
CHANGED
package/lib/commands/scan.js
CHANGED
|
@@ -118,7 +118,7 @@ export const scan = async ({ repoId, baseCommitId, headCommitId, branchName, opt
|
|
|
118
118
|
pollStatus();
|
|
119
119
|
};
|
|
120
120
|
const parseCliOptions = (userCliOptions) => {
|
|
121
|
-
const apiOptions = { version: '1.0.
|
|
121
|
+
const apiOptions = { version: '1.0.15' };
|
|
122
122
|
const cliOptions = { pollInterval: 5 };
|
|
123
123
|
if (userCliOptions.pullRequestTitle) {
|
|
124
124
|
apiOptions.pull_request_metadata = {
|
|
@@ -24,6 +24,7 @@ type TScanUserCliOptions = {
|
|
|
24
24
|
minimumSeverityLevel?: string;
|
|
25
25
|
pollInterval?: number;
|
|
26
26
|
baseBranch?: string;
|
|
27
|
+
slaMode?: boolean;
|
|
27
28
|
};
|
|
28
29
|
declare function cli(repoId: string, commitId: string, options: TScanUserCliOptions, command: string): Promise<void>;
|
|
29
30
|
export declare const scan: ({ repoId, commitId, options, pollInterval, onStart, onStartComplete, onStartFail, onScanStart, onNextPoll, onScanComplete, onScanFail, }: TScanArguments) => Promise<void>;
|
|
@@ -35,7 +35,10 @@ async function cli(repoId, commitId, options, command) {
|
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
loader?.fail('Scan completed with issues');
|
|
38
|
-
if (
|
|
38
|
+
if (apiOptions.sla_mode) {
|
|
39
|
+
outputLog(chalk.gray(chalk.bold('Issues outside of SLA found: ') + pollResult.issues_outside_sla));
|
|
40
|
+
}
|
|
41
|
+
else if (pollResult.new_issues_found) {
|
|
39
42
|
outputLog(chalk.gray(chalk.bold('Open issues found: ') + pollResult.new_issues_found));
|
|
40
43
|
}
|
|
41
44
|
if (pollResult.issue_links) {
|
|
@@ -120,7 +123,7 @@ export const scan = async ({ repoId, commitId, options, pollInterval = 10, onSta
|
|
|
120
123
|
pollStatus();
|
|
121
124
|
};
|
|
122
125
|
const parseCliOptions = (userCliOptions) => {
|
|
123
|
-
const apiOptions = { version: '1.0.
|
|
126
|
+
const apiOptions = { version: '1.0.15' };
|
|
124
127
|
const cliOptions = { pollInterval: 10 };
|
|
125
128
|
if (userCliOptions.pullRequestTitle) {
|
|
126
129
|
apiOptions.pull_request_metadata = {
|
|
@@ -155,6 +158,9 @@ const parseCliOptions = (userCliOptions) => {
|
|
|
155
158
|
if (userCliOptions.baseBranch) {
|
|
156
159
|
apiOptions.base_branch = userCliOptions.baseBranch;
|
|
157
160
|
}
|
|
161
|
+
if (userCliOptions.slaMode) {
|
|
162
|
+
apiOptions.sla_mode = true;
|
|
163
|
+
}
|
|
158
164
|
if (userCliOptions.pollInterval &&
|
|
159
165
|
(isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)) {
|
|
160
166
|
outputError('Please provide a valid poll interval');
|
|
@@ -186,6 +192,7 @@ export const cliSetup = (program) => program
|
|
|
186
192
|
.preset(10)
|
|
187
193
|
.argParser(parseFloat))
|
|
188
194
|
.addOption(new Option('--base-branch <branchname>', 'Base branch for the release gated scan.'))
|
|
195
|
+
.option('--sla-mode', 'Let Aikido only fail only on open issues that have gone out of SLA.')
|
|
189
196
|
.description('Run a release scan of an Aikido repo.')
|
|
190
197
|
.action(cli);
|
|
191
198
|
export default { cli, cliSetup, scan };
|
package/lib/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export const program = new Command();
|
|
|
11
11
|
program
|
|
12
12
|
.name('Aikido API Client')
|
|
13
13
|
.description('CLI api client to easily integrate the Aikido public CI API into custom deploy scripts')
|
|
14
|
-
.version('1.0.
|
|
14
|
+
.version('1.0.15');
|
|
15
15
|
apiKey.cliSetup(program);
|
|
16
16
|
scan.cliSetup(program);
|
|
17
17
|
scanRelease.cliSetup(program);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aikidosec/ci-api-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@aikidosec/ci-api-client",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.15",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "1.8.3",
|
package/package.json
CHANGED
package/src/aikidoApi.ts
CHANGED
package/src/commands/scan.ts
CHANGED
|
@@ -245,7 +245,7 @@ export const scan = async ({
|
|
|
245
245
|
const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
|
|
246
246
|
// Version provided to the API corresponds with the version in package.json
|
|
247
247
|
// of the cli client
|
|
248
|
-
const apiOptions: TScanApiOptions = { version: '1.0.
|
|
248
|
+
const apiOptions: TScanApiOptions = { version: '1.0.15' };
|
|
249
249
|
const cliOptions: TScanCliOptions = { pollInterval: 5 };
|
|
250
250
|
|
|
251
251
|
if (userCliOptions.pullRequestTitle) {
|
|
@@ -62,6 +62,7 @@ type TScanUserCliOptions = {
|
|
|
62
62
|
minimumSeverityLevel?: string;
|
|
63
63
|
pollInterval?: number;
|
|
64
64
|
baseBranch?: string;
|
|
65
|
+
slaMode?: boolean;
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
async function cli(
|
|
@@ -114,7 +115,12 @@ async function cli(
|
|
|
114
115
|
} else {
|
|
115
116
|
loader?.fail('Scan completed with issues');
|
|
116
117
|
|
|
117
|
-
if (
|
|
118
|
+
if (apiOptions.sla_mode) {
|
|
119
|
+
outputLog(
|
|
120
|
+
chalk.gray(
|
|
121
|
+
chalk.bold('Issues outside of SLA found: ') + pollResult.issues_outside_sla)
|
|
122
|
+
);
|
|
123
|
+
} else if (pollResult.new_issues_found) {
|
|
118
124
|
outputLog(
|
|
119
125
|
chalk.gray(
|
|
120
126
|
chalk.bold('Open issues found: ') + pollResult.new_issues_found
|
|
@@ -239,7 +245,7 @@ export const scan = async ({
|
|
|
239
245
|
const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
|
|
240
246
|
// Version provided to the API corresponds with the version in package.json
|
|
241
247
|
// of the cli client
|
|
242
|
-
const apiOptions: TScanApiOptions = { version: '1.0.
|
|
248
|
+
const apiOptions: TScanApiOptions = { version: '1.0.15' };
|
|
243
249
|
const cliOptions: TScanCliOptions = { pollInterval: 10 };
|
|
244
250
|
|
|
245
251
|
if (userCliOptions.pullRequestTitle) {
|
|
@@ -275,6 +281,9 @@ const parseCliOptions = (userCliOptions: TScanUserCliOptions) => {
|
|
|
275
281
|
if (userCliOptions.baseBranch) {
|
|
276
282
|
apiOptions.base_branch = userCliOptions.baseBranch;
|
|
277
283
|
}
|
|
284
|
+
if (userCliOptions.slaMode) {
|
|
285
|
+
apiOptions.sla_mode = true;
|
|
286
|
+
}
|
|
278
287
|
if (
|
|
279
288
|
userCliOptions.pollInterval &&
|
|
280
289
|
(isNaN(userCliOptions.pollInterval) || userCliOptions.pollInterval <= 0)
|
|
@@ -350,6 +359,10 @@ export const cliSetup = (program: Command) =>
|
|
|
350
359
|
'Base branch for the release gated scan.'
|
|
351
360
|
)
|
|
352
361
|
)
|
|
362
|
+
.option(
|
|
363
|
+
'--sla-mode',
|
|
364
|
+
'Let Aikido only fail only on open issues that have gone out of SLA.'
|
|
365
|
+
)
|
|
353
366
|
.description('Run a release scan of an Aikido repo.')
|
|
354
367
|
.action(cli);
|
|
355
368
|
|
package/src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ program
|
|
|
20
20
|
.description(
|
|
21
21
|
'CLI api client to easily integrate the Aikido public CI API into custom deploy scripts'
|
|
22
22
|
)
|
|
23
|
-
.version('1.0.
|
|
23
|
+
.version('1.0.15');
|
|
24
24
|
|
|
25
25
|
// Load in all app commands and set them up in the `program` instance
|
|
26
26
|
apiKey.cliSetup(program);
|