Skip to content

Commit 4eb4c50

Browse files
authored
chore: migrate off of quay and use internal snykgoof instead (for tests) (#711)
* chore: use internal hosted images (snykgoof) for tests * chore: remove quay update script. now outdated
1 parent fe858e6 commit 4eb4c50

File tree

5 files changed

+31
-92
lines changed

5 files changed

+31
-92
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"test": "npm run test-jest",
2323
"test-jest": "jest --ci --maxWorkers=3 --logHeapUsage --colors",
2424
"test-jest-windows": "jest --ci --maxWorkers=3 --config test/windows/jest.config.js --logHeapUsage",
25-
"update-quay-tests": "bash update_centos_shas.sh",
2625
"prepare": "npm run build"
2726
},
2827
"engines": {

test/fixtures/centos-shas.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

test/system/package-managers/__snapshots__/rpm.spec.ts.snap

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ Object {
424424
},
425425
],
426426
"nodeId": "root-node",
427-
"pkgId": "docker-image|quay.io/centos/centos@",
427+
"pkgId": "docker-image|snykgoof/dockerhub-goof@centos-stream9",
428428
},
429429
Object {
430430
"deps": Array [],
@@ -1124,10 +1124,10 @@ Object {
11241124
},
11251125
"pkgs": Array [
11261126
Object {
1127-
"id": "docker-image|quay.io/centos/centos@",
1127+
"id": "docker-image|snykgoof/dockerhub-goof@centos-stream9",
11281128
"info": Object {
1129-
"name": "docker-image|quay.io/centos/centos",
1130-
"version": undefined,
1129+
"name": "docker-image|snykgoof/dockerhub-goof",
1130+
"version": "centos-stream9",
11311131
},
11321132
},
11331133
Object {
@@ -2237,7 +2237,7 @@ Object {
22372237
},
22382238
Object {
22392239
"data": Array [
2240-
"sha256:388256329b02d57afd18ce187b85eae5b49ce8b24df7ec91f299fd45f926f9c9",
2240+
"548262f4b50f4ed2941ff02cde714223a51a2f11191b06dcb95b54c2381cb514/layer.tar",
22412241
],
22422242
"type": "imageLayers",
22432243
},
@@ -2269,8 +2269,8 @@ Object {
22692269
Object {
22702270
"data": Object {
22712271
"names": Array [
2272-
"quay.io/centos/centos@sha256:0cae7e53f997228f0afc523f1bad28f3347dd0216ea8e27977f7af33f626f912",
2273-
"quay.io/centos/centos@sha256:0cae7e53f997228f0afc523f1bad28f3347dd0216ea8e27977f7af33f626f912",
2272+
"snykgoof/dockerhub-goof:centos-stream9",
2273+
"snykgoof/dockerhub-goof@sha256:afa4e96dd42cec591af30331b45b68fc00de9a95e7c148b847914b749e10e651",
22742274
],
22752275
},
22762276
"type": "imageNames",
@@ -2283,7 +2283,7 @@ Object {
22832283
"type": "rpm",
22842284
},
22852285
"target": Object {
2286-
"image": "docker-image|quay.io/centos/centos",
2286+
"image": "docker-image|snykgoof/dockerhub-goof",
22872287
},
22882288
},
22892289
],
@@ -2789,7 +2789,7 @@ Object {
27892789
},
27902790
],
27912791
"nodeId": "root-node",
2792-
"pkgId": "docker-image|quay.io/centos/centos@",
2792+
"pkgId": "docker-image|snykgoof/dockerhub-goof@centos-stream10",
27932793
},
27942794
Object {
27952795
"deps": Array [],
@@ -3614,10 +3614,10 @@ Object {
36143614
},
36153615
"pkgs": Array [
36163616
Object {
3617-
"id": "docker-image|quay.io/centos/centos@",
3617+
"id": "docker-image|snykgoof/dockerhub-goof@centos-stream10",
36183618
"info": Object {
3619-
"name": "docker-image|quay.io/centos/centos",
3620-
"version": undefined,
3619+
"name": "docker-image|snykgoof/dockerhub-goof",
3620+
"version": "centos-stream10",
36213621
},
36223622
},
36233623
Object {
@@ -4927,7 +4927,7 @@ Object {
49274927
},
49284928
Object {
49294929
"data": Array [
4930-
"sha256:2d5a7d2db745217a9f00bd43e99262d3ff2e54efae6bce8e30f29a001adad913",
4930+
"8be31ad17a137bcf3c6d66a929af66a31da914a42a568949bf12510409133d5f/layer.tar",
49314931
],
49324932
"type": "imageLayers",
49334933
},
@@ -4959,8 +4959,8 @@ Object {
49594959
Object {
49604960
"data": Object {
49614961
"names": Array [
4962-
"quay.io/centos/centos@sha256:8749c1fde6471d2dd94d6b1cee8ac43a070573ce9cc5e85bf59b9e8331bc1974",
4963-
"quay.io/centos/centos@sha256:8749c1fde6471d2dd94d6b1cee8ac43a070573ce9cc5e85bf59b9e8331bc1974",
4962+
"snykgoof/dockerhub-goof:centos-stream10",
4963+
"snykgoof/dockerhub-goof@sha256:211cc59e39702f1bfc1a0bebe2271c9e506459cef382594f319a591a119a62dd",
49644964
],
49654965
},
49664966
"type": "imageNames",
@@ -4973,7 +4973,7 @@ Object {
49734973
"type": "rpm",
49744974
},
49754975
"target": Object {
4976-
"image": "docker-image|quay.io/centos/centos",
4976+
"image": "docker-image|snykgoof/dockerhub-goof",
49774977
},
49784978
},
49794979
],

test/system/package-managers/rpm.spec.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Docker } from "../../../lib/docker";
22
import { scan } from "../../../lib/index";
33
import { execute } from "../../../lib/sub-process";
4-
import { CENTOS_SHAS } from "../../fixtures/centos-shas";
54

65
describe("rpm package manager tests", () => {
76
beforeAll(() => {
@@ -26,8 +25,8 @@ describe("rpm package manager tests", () => {
2625
"amazonlinux:2022.0.20220504.1",
2726
"registry.access.redhat.com/ubi9/ubi@sha256:c113f67e8e70940af28116d75e32f0aa4ffd3bf6fab30e970850475ab1de697f",
2827
"registry.access.redhat.com/ubi10-beta/ubi@sha256:4b4976d86eefeedab6884c9d2923206c6c3c2e2471206f97fd9d7aaaecbc04ac",
29-
`quay.io/centos/centos@${CENTOS_SHAS.stream9}`, // stream9
30-
`quay.io/centos/centos@${CENTOS_SHAS.stream10}`, // stream10
28+
"snykgoof/dockerhub-goof:centos-stream9",
29+
"snykgoof/dockerhub-goof:centos-stream10",
3130
]).catch(() => {
3231
console.error(`tests teardown failed to remove docker image`);
3332
});
@@ -72,25 +71,30 @@ describe("rpm package manager tests", () => {
7271
});
7372

7473
it("should correctly analyze a CentOS Stream 9 image", async () => {
75-
// quay doesn't always keep older shas, so if this fails, get the sha from the latest
76-
// stream9 at https://quay.io/repository/centos/centos?tab=tags&tag=stream9
77-
// OR run npm run update-quay-tests to update the shas
78-
const image = `quay.io/centos/centos@${CENTOS_SHAS.stream9}`;
74+
// quay doesn't keep older shas, so the test would break every time
75+
// they pushed a new version. To mitigate this, we cloned an image
76+
// and pushed it to the snykgoof repo
77+
const image = "snykgoof/dockerhub-goof:centos-stream9";
78+
7979
const pluginResult = await scan({
8080
path: image,
8181
platform: "linux/amd64",
82+
username: process.env.DOCKER_HUB_USERNAME,
83+
password: process.env.DOCKER_HUB_PASSWORD,
8284
});
8385
expect(pluginResult).toMatchSnapshot();
8486
});
8587

8688
it("should correctly analyze a CentOS Stream 10 image", async () => {
87-
// quay doesn't always keep older shas, so if this fails, get the sha from the latest
88-
// stream10 at https://quay.io/repository/centos/centos?tab=tags&tag=stream10
89-
// OR run npm run update-quay-tests to update the shas
90-
const image = `quay.io/centos/centos@${CENTOS_SHAS.stream10}`;
89+
// quay doesn't keep older shas, so the test would break every time
90+
// they pushed a new version. To mitigate this, we cloned an image
91+
// and pushed it to the snykgoof repo
92+
const image = "snykgoof/dockerhub-goof:centos-stream10";
9193
const pluginResult = await scan({
9294
path: image,
9395
platform: "linux/amd64",
96+
username: process.env.DOCKER_HUB_USERNAME,
97+
password: process.env.DOCKER_HUB_PASSWORD,
9498
});
9599
expect(pluginResult).toMatchSnapshot();
96100
});

update_centos_shas.sh

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)