Skip to content

Commit

Permalink
Merge pull request #125 from snyk/develop
Browse files Browse the repository at this point in the history
Merge develop into master for release
  • Loading branch information
maxjeffos authored Jul 27, 2021
2 parents 11ee34f + 8c1e32f commit f9ae783
Show file tree
Hide file tree
Showing 6 changed files with 319 additions and 97 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ This extension requires that Node.js and npm be installed on the build agent. Th

## Task Parameters

| Parameter | Description | Required | Default | Type |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ------------- | --------------------------------------------------------------------------------- |
| serviceConnectionEndpoint | The Azure DevOps service connection endpoint where your Snyk API token is defined. Define this within your Azure DevOps project settings / S | no | none | String / Azure Service Connection Endpoint of type SnykAuth / Snyk Authentication |
| testType | Used by the task UI only | no | "application" | string: "app" or "container" |
| dockerImageName | The name of the container image to test. | yes, if container image test | none | string |
| dockerfilePath | The path to the Dockerfile corresponding to the `dockerImageName` | yes, if container image test | none | string |
| targetFile | Applicable to application type tests ony. The path to the manifest file to be used by Snyk. Should only be provided if non-standard. | no | none | string |
| severityThreshold | The severity-threshold to use when testing. By default, issues of all severity types will be found. | no | "low" | string: "low" or "medium" or "high" or "critical" |
| monitorOnBuild | Whether or not to capture the dependencies of the application / container image and monitor them within Snyk. | yes | true | boolean |
| failOnIssues | This specifies if builds should be failed or continued based on issues found by Snyk. | yes | true | boolean |
| projectName | A custom name for the Snyk project to be created on snyk.io | no | none | string |
| organization | Name of the Snyk organisation name, under which this project should be tested and monitored | no | none | string |
| testDirectory | Alternate working directory. For example, if you want to test a manifest file in a directory other than the root of your repo, you would put in relative path to that directory. | no | none | string |
| ignoreUnknownCA | Use to ignore unknown or self-signed certificates. This might be useful in for self-hosted build agents with unusual network configurations or for Snyk on-prem installs configured with a self-signed certificate. | no | false | boolean |
| additionalArguments | Additional Snyk CLI arguments to be passed in. Refer to the Snyk CLI help page for information on additional arguments. | no | none | string |
| Parameter | Description | Required | Default | Type |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | --------------- | --------------------------------------------------------------------------------- |
| serviceConnectionEndpoint | The Azure DevOps service connection endpoint where your Snyk API token is defined. Define this within your Azure DevOps project settings / S | no | none | String / Azure Service Connection Endpoint of type SnykAuth / Snyk Authentication |
| testType | Used by the task UI only | no | "application" | string: "app" or "container" |
| dockerImageName | The name of the container image to test. | yes, if container image test | none | string |
| dockerfilePath | The path to the Dockerfile corresponding to the `dockerImageName` | yes, if container image test | none | string |
| targetFile | Applicable to application type tests ony. The path to the manifest file to be used by Snyk. Should only be provided if non-standard. | no | none | string |
| severityThreshold | The severity-threshold to use when testing. By default, issues of all severity types will be found. | no | "low" | string: "low" or "medium" or "high" or "critical" |
| monitorOnBuild | Whether or not to capture the dependencies of the application / container image and monitor them within Snyk. | yes | true | boolean |
| monitorWhen | When to run `snyk monitor`. Valid options are `never`, `noIssuesFound` (default), and `always`. If set, this option overrides the value of `monitorOnBuild`. | no | 'noIssuesFound' | boolean |
| failOnIssues | This specifies if builds should be failed or continued based on issues found by Snyk. | yes | true | boolean |
| projectName | A custom name for the Snyk project to be created on snyk.io | no | none | string |
| organization | Name of the Snyk organisation name, under which this project should be tested and monitored | no | none | string |
| testDirectory | Alternate working directory. For example, if you want to test a manifest file in a directory other than the root of your repo, you would put in relative path to that directory. | no | none | string |
| ignoreUnknownCA | Use to ignore unknown or self-signed certificates. This might be useful in for self-hosted build agents with unusual network configurations or for Snyk on-prem installs configured with a self-signed certificate. | no | false | boolean |
| additionalArguments | Additional Snyk CLI arguments to be passed in. Refer to the Snyk CLI help page for information on additional arguments. | no | none | string |

## Usage Examples

Expand Down
15 changes: 12 additions & 3 deletions snykTask/src/__tests__/task-lib.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ afterAll(() => {
});

test('getOptionsToExecuteSnyk builds IExecOptions like we need it', () => {
const taskArgs: TaskArgs = new TaskArgs();
const taskArgs: TaskArgs = new TaskArgs({
monitorOnBuild: true,
failOnIssues: true,
});
taskArgs.testDirectory = '/some/path';

const options: tr.IExecOptions = getOptionsToExecuteCmd(taskArgs);
Expand All @@ -47,7 +50,10 @@ test('getOptionsToExecuteSnykCLICommand builds IExecOptions like we need it', ()
const taskNameForAnalytics = 'AZURE_PIPELINES';
const version = '1.2.3';

const taskArgs: TaskArgs = new TaskArgs();
const taskArgs: TaskArgs = new TaskArgs({
monitorOnBuild: true,
failOnIssues: true,
});
taskArgs.testDirectory = '/some/path';

const options: tr.IExecOptions = getOptionsToExecuteSnykCLICommand(
Expand All @@ -67,7 +73,10 @@ test('getOptionsToExecuteSnykCLICommand builds IExecOptions like we need it', ()

describe('getOptionsForSnykToHtml', () => {
it('builds IExecOptions for running snyk-to-html', async () => {
const taskArgs: TaskArgs = new TaskArgs();
const taskArgs: TaskArgs = new TaskArgs({
monitorOnBuild: true,
failOnIssues: true,
});
taskArgs.testDirectory = '/some/path';
const htmlReportFilePath = path.resolve(tempFolder, 'report.html');
const options: tr.IExecOptions = getOptionsForSnykToHtml(
Expand Down
72 changes: 0 additions & 72 deletions snykTask/src/__tests__/test-task-args.js

This file was deleted.

Loading

0 comments on commit f9ae783

Please sign in to comment.