forked from docker-library/meta-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doi.jq
180 lines (173 loc) · 3.06 KB
/
doi.jq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# a helper for "build_should_sbom"
def _sbom_subset:
[
# only repositories we have explicitly verified
"aerospike",
"almalinux",
"alpine",
"alt",
"amazoncorretto",
"amazonlinux",
"arangodb",
"archlinux",
"backdrop",
"bash",
"bonita",
"buildpack-deps",
"busybox",
"caddy",
"cassandra",
"chronograf",
"cirros",
"clojure",
"composer",
"convertigo",
"couchdb",
"crate",
"debian",
"drupal",
"eclipse-mosquitto",
"eclipse-temurin",
"eggdrop",
"elasticsearch",
"elixir",
"emqx",
"erlang",
"fedora",
"flink",
"fluentd",
"gazebo",
"gcc",
"geonetwork",
"ghost",
"golang",
"gradle",
"groovy",
"haproxy",
"haskell",
"hitch",
"httpd",
"hylang",
"ibm-semeru-runtimes",
"ibmjava",
"influxdb",
"irssi",
"jetty",
"jruby",
"julia",
"kapacitor",
"kibana",
"kong",
"liquibase",
"logstash",
"mageia",
"mariadb",
"maven",
"memcached",
"mongo",
"mongo-express",
"mono",
"mysql",
"neo4j",
"neurodebian",
"nginx",
"node",
"odoo",
"openjdk",
"open-liberty",
"oraclelinux",
"orientdb",
"perl",
"photon",
"php",
"plone",
"postgres",
"pypy",
"python",
"r-base",
"rabbitmq",
"rakudo-star",
"redis",
"registry",
"rethinkdb",
"rockylinux",
"ros",
"ruby",
"rust",
"sapmachine",
"satosa",
"silverpeas",
"solr",
"sonarqube",
"spark",
"spiped",
"storm",
"swift",
"swipl",
"telegraf",
"tomcat",
"tomee",
"traefik",
"ubuntu",
"websphere-liberty",
"wordpress",
"xwiki",
"znc",
"zookeeper",
# TODO: add these when PHP extensions and PECL packages are supported in Syft
# "friendica",
# "joomla",
# "matomo",
# "mediawiki",
# "monica",
# "nextcloud",
# "phpmyadmin",
# "postfixadmin",
# "yourls",
# TODO: add these when the golang dependencies are fixed
# "api-firewall",
# "nats",
# "couchbase",
# TODO: add these when sbom scanning issues fixed
# "dart",
# "clearlinux",
# "rocket.chat",
# "teamspeak",
# "varnish",
empty
]
;
# https://github.com/docker-library/meta-scripts/pull/61 (for lack of better documentation for setting this in buildkit)
# https://slsa.dev/provenance/v0.2#builder.id
def buildkit_provenance_builder_id:
"https://github.com/docker-library"
;
# input: "build" object (with "buildId" top level key)
# output: boolean
def build_should_sbom:
# see "bashbrew remote arches docker/scout-sbom-indexer:1" (we need the SBOM scanner to be runnable on the host architecture)
# bashbrew remote arches --json docker/scout-sbom-indexer:1 | jq '.arches | keys_unsorted' -c
(
.build.arch as $arch | ["amd64","arm32v5","arm32v7","arm64v8","i386","ppc64le","riscv64","s390x"] | index($arch)
) and (
.source.arches[.build.arch].tags
| map(split(":")[0])
| unique
| _sbom_subset as $subset
| any(.[];
. as $i
| $subset
| index($i)
)
)
;
# input: "build" object (with "buildId" top level key)
# output: boolean
def build_should_sign:
.build.arch == "amd64" and (
.source.arches[.build.arch].tags
| map(split(":")[0])
| unique
| index("notary")
)
;