Skip to content

Commit

Permalink
major: Migrate to REST List Projects API & improvements
Browse files Browse the repository at this point in the history
major: Migrate to REST List Projects API

This is to address #182

Co-authored-by: Troy Havelock <[email protected]>

* minor: Added DueDate support for creating Jira (#185)

Added the optional flag for the due date built-in flag.
Updated README with instructions

Co-authored-by: Alexandre Vallières-Lagacé <[email protected]>

* minor: align urls with the recommended domains and paths (#192)

Switch from:
- `snyk.io/api` to `api.snyk.io`
- `api.snyk.io/api` to `api.snyk.io`
- `snyk.io/vuln` to `security.snyk.io/vuln`
- `api.snyk.io/v3` to `api.snyk.io/rest`

* minor: use public utility container for github releasing tool (#194)
* major: Migrate to REST List Projects API (#199)


---------
Co-authored-by: Jeff B <[email protected]>
Co-authored-by: Troy Havelock <[email protected]>
Co-authored-by: Alexandre Vallières-Lagacé <[email protected]>
Co-authored-by: Jérémy Lourenço <[email protected]>
Co-authored-by: aarlaud <[email protected]>
Co-authored-by: Jeff B <[email protected]>
  • Loading branch information
6 people authored Jun 22, 2023
1 parent 1852683 commit 9594f60
Show file tree
Hide file tree
Showing 16 changed files with 3,045 additions and 241 deletions.
5 changes: 1 addition & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ jobs:

publish-github-release:
docker:
- image: gcr.io/snyk-technical-services/cicd-github
auth:
username: _json_key
password: $GCLOUD_GCR_SNYK_TS_READER
- image: aarlaudsnyk/utility-containers
steps:
- checkout
- attach_workspace:
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,21 @@ Use `go install github.com/snyk-tech-services/jira-tickets-for-new-vulns@latest`

- `--projectCriticality` *optional*

Include only projects whose [Snyk business criticality attribute](https://docs.snyk.io/introducing-snyk/introduction-to-snyk-projects/view-project-information/project-attributes#business-criticality) contains one or more of the specified values.
Include only projects whose [Snyk business criticality attribute](https://docs.snyk.io/introducing-snyk/introduction-to-snyk-projects/view-project-information/project-attributes#business-criticality) contains one or more of the specified values. This should be all lower case, comma separated with no spaces.

*Example*: `--projectCriticality=[Critical,Medium]`
*Example*: `--projectCriticality=critical,medium`

- `--projectEnvironment` *optional*

Include only projects whose [Snyk environment attribute](https://docs.snyk.io/introducing-snyk/introduction-to-snyk-projects/view-project-information/project-attributes#environment) contains one or more of the specified values.
Include only projects whose [Snyk environment attribute](https://docs.snyk.io/introducing-snyk/introduction-to-snyk-projects/view-project-information/project-attributes#environment) contains one or more of the specified values. This should be all lower case, comma separated with no spaces.

*Example*: `--projectLifecycle=[backend,frontend]`
*Example*: `--projectEnvironment=backend,frontend`

- `--projectLifecycle` *optional*

Include only projects whose [Snyk lifecycle attribute](https://docs.snyk.io/introducing-snyk/introduction-to-snyk-projects/view-project-information/project-attributes#lifecycle-stage) contains one or more of the specified values.
Include only projects whose [Snyk lifecycle attribute](https://docs.snyk.io/introducing-snyk/introduction-to-snyk-projects/view-project-information/project-attributes#lifecycle-stage) contains one or more of the specified values. This should be all lower case, comma separated with no spaces.

*Example*: `--projectLifecycle=[development,production]`
*Example*: `--projectLifecycle=development,production`

- `--configFile` *optional*

Expand Down
210 changes: 104 additions & 106 deletions fixtures/org.json
Original file line number Diff line number Diff line change
@@ -1,107 +1,105 @@
{
"org": {
"name": "defaultOrg",
"id": "689ce7f9-7943-4a71-b704-2ba575f01089"
},
"projects": [
{
"name": "atokeneduser/goof",
"id": "6d5813be-7e6d-4ab8-80c2-1e3e2a454545",
"created": "2018-10-29T09:50:54.014Z",
"origin": "cli",
"type": "npm",
"readOnly": "false",
"testFrequency": "daily",
"totalDependencies": 438,
"issueCountsBySeverity": {
"low": 8,
"high": 13,
"medium": 15
},
"isMonitored": true,
"attributes":{
"criticality": ["critical"],
"lifecycle": ["production"],
"environment": ["frontend", "external"]
},
"remoteRepoUrl": "https://github.com/snyk/goof.git",
"lastTestedDate": "2019-02-05T06:21:00.000Z",
"importingUser": {
"id": "e713cf94-bb02-4ea0-89d9-613cce0caed2",
"name": "[email protected]",
"username": "exampleUser",
"email": "[email protected]"
},
"owner": {
"id": "e713cf94-bb02-4ea0-89d9-613cce0caed2",
"name": "[email protected]",
"username": "exampleUser",
"email": "[email protected]"
},
"branch": "master"
},
{
"name": "atokeneduser/clojure",
"id": "af127b96-6966-46c1-826b-2e79ac49bbd9",
"created": "2018-10-29T09:50:54.014Z",
"origin": "github",
"type": "maven",
"readOnly": "false",
"testFrequency": "hourly",
"totalDependencies": 42,
"issueCountsBySeverity": {
"low": 8,
"high": 13,
"medium": 21
},
"isMonitored": true,
"attributes":{
"criticality": [],
"lifecycle": [],
"environment": []
},
"remoteRepoUrl": "https://github.com/clojure/clojure.git",
"lastTestedDate": "2019-02-05T07:01:00.000Z",
"owner": {
"id": "42ce0e0f-6288-4874-9266-ef799e7f31bb",
"name": "[email protected]",
"username": "exampleUser2",
"email": "[email protected]"
},
"importingUser": {
"id": "e713cf94-bb02-4ea0-89d9-613cce0caed2",
"name": "[email protected]",
"username": "exampleUser",
"email": "[email protected]"
},
"branch": "master"
},
{
"name": "docker-image|alpine",
"id": "f6c8339d-57e1-4d64-90c1-81af0e811f7e",
"created": "2019-02-04T08:54:07.704Z",
"origin": "cli",
"type": "apk",
"readOnly": "false",
"testFrequency": "daily",
"totalDependencies": 14,
"issueCountsBySeverity": {
"low": 0,
"high": 0,
"medium": 0
},
"isMonitored": false,
"attributes":{
"criticality": [],
"lifecycle": [],
"environment": []
},
"imageId": "sha256:caf27325b298a6730837023a8a342699c8b7b388b8d878966b064a1320043019",
"imageTag": "latest",
"lastTestedDate": "2019-02-05T08:54:07.704Z",
"owner": null,
"importingUser": null,
"branch": "master"
}
]
}
"jsonapi": {
"version": "1.0"
},
"data": [
{
"type": "project",
"id": "68b4ecaa-a211-4d2b-9361-e13792a8e28e",
"meta": {},
"attributes": {
"name": "snyk-fixtures/yarn-2-goof",
"type": "sast",
"target_file": "",
"target_reference": "master",
"origin": "github",
"created": "2023-06-07T14:43:12.551Z",
"status": "active",
"business_criticality": [],
"environment": [],
"lifecycle": [],
"tags": [],
"settings": {
"recurring_tests": {
"frequency": "weekly"
},
"pull_requests": {
"fail_only_for_issues_with_fix": false
}
}
},
"relationships": {
"organization": {
"data": {
"type": "org",
"id": "5ebcd4d3-6138-4788-99ec-e3f2245095b7"
},
"links": {
"related": "/orgs/5ebcd4d3-6138-4788-99ec-e3f2245095b7"
}
},
"target": {
"data": {
"type": "target",
"id": "68e9e0ae-39e7-4751-bb10-553bea246da4"
},
"links": {
"related": "/orgs/5ebcd4d3-6138-4788-99ec-e3f2245095b7/targets/68e9e0ae-39e7-4751-bb10-553bea246da4"
}
},
"importer": {
"data": {
"type": "user",
"id": "d41bb894-f280-47a8-8804-0222fd9642c5"
},
"links": {
"related": "/orgs/5ebcd4d3-6138-4788-99ec-e3f2245095b7/users/d41bb894-f280-47a8-8804-0222fd9642c5"
}
}
}
},
{
"type": "project",
"id": "57cbc2c9-1a1b-45ca-94bb-55c644c217d4",
"attributes": {
"name": "xyz-snyk/goof:package.json",
"created": "2023-04-11T03:57:59.256Z",
"origin": "bitbucket-connect-app",
"type": "npm",
"status": "active",
"targetReference": "master",
"businessCriticality": [
"critical"
],
"lifecycle": [
"development"
],
"environment": [
"frontend"
],
"tags": []
},
"relationships": {
"target": {
"data": {
"type": "target",
"id": "08fbfe72-8d02-4936-a8f2-5ba8e438dee5"
},
"links": {
"self": "/orgs/408fbcd1-2b1d-4892-a0b4-48cb3908c50d/targets/08fbfe72-8d02-4936-a8f2-5ba8e438dee5"
}
},
"importingUser": {
"data": {
"type": "user",
"id": "66bd4557-3a1b-4e33-80e0-dc418283753d"
},
"links": {
"self": "/orgs/408fbcd1-2b1d-4892-a0b4-48cb3908c50d/users/66bd4557-3a1b-4e33-80e0-dc418283753d"
}
}
}
}
],
"links": {}
}
100 changes: 61 additions & 39 deletions fixtures/orgEndToEnd.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,63 @@
{
"org": {
"name": "defaultOrg",
"id": "689ce7f9-7943-4a71-b704-2ba575f01089"
},
"projects": [
{
"id": "123",
"name": "test/goof:package.json",
"created": "2021-08-31T02:48:41.669Z",
"origin": "gitlab",
"type": "npm",
"readOnly": false,
"testFrequency": "daily",
"isMonitored": true,
"totalDependencies": 483,
"issueCountsBySeverity": {
"low": 7,
"high": 21,
"medium": 27,
"critical": 1
},
"imageTag": "0.0.3",
"imagePlatform": "",
"imageBaseImage": "",
"lastTestedDate": "2021-09-10T02:36:31.142Z",
"browseUrl": "https://app.snyk.io/org/test-playground/project/123",
"owner": null,
"importingUser": {
"id": "123",
"name": "someone withAName",
"username": "someone",
"email": "[email protected]"
},
"tags": [],
"attributes": { "criticality": [], "lifecycle": [], "environment": [] },
"branch": "master"
}
]

"jsonapi": {
"version": "1.0"
},
"data": [
{
"type": "project",
"id": "123",
"meta": {},
"attributes": {
"name": "snyk-fixtures/yarn-2-goof",
"type": "sast",
"target_file": "",
"target_reference": "master",
"origin": "github",
"created": "2023-06-07T14:43:12.551Z",
"status": "active",
"business_criticality": [],
"environment": [],
"lifecycle": [],
"tags": [],
"settings": {
"recurring_tests": {
"frequency": "weekly"
},
"pull_requests": {
"fail_only_for_issues_with_fix": false
}
}
},
"relationships": {
"organization": {
"data": {
"type": "org",
"id": "5ebcd4d3-6138-4788-99ec-e3f2245095b7"
},
"links": {
"related": "/orgs/5ebcd4d3-6138-4788-99ec-e3f2245095b7"
}
},
"target": {
"data": {
"type": "target",
"id": "68e9e0ae-39e7-4751-bb10-553bea246da4"
},
"links": {
"related": "/orgs/5ebcd4d3-6138-4788-99ec-e3f2245095b7/targets/68e9e0ae-39e7-4751-bb10-553bea246da4"
}
},
"importer": {
"data": {
"type": "user",
"id": "d41bb894-f280-47a8-8804-0222fd9642c5"
},
"links": {
"related": "/orgs/5ebcd4d3-6138-4788-99ec-e3f2245095b7/users/d41bb894-f280-47a8-8804-0222fd9642c5"
}
}
}
}
],
"links": {}
}
Loading

0 comments on commit 9594f60

Please sign in to comment.