Skip to content

Commit 5015cd8

Browse files
committed
Merge branch 'main' into fix_lint_errors
Signed-off-by: Vivek Kumar Sahu <[email protected]>
2 parents cc1626e + a6774a6 commit 5015cd8

File tree

4 files changed

+46
-18
lines changed

4 files changed

+46
-18
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: docker/build-push-action@v2
3939
with:
4040
context: .
41-
platforms: linux/amd64
41+
platforms: linux/amd64, linux/arm64
4242
push: true
4343
tags: ${{ steps.meta.outputs.tags }}
44-
labels: ${{ steps.meta.outputs.labels }}
44+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM golang:1.22.2-alpine AS builder
1+
# Use buildx for multi-platform builds
2+
# Build stage
3+
FROM --platform=$BUILDPLATFORM golang:1.22.2-alpine AS builder
24
LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomqs"
35

46
RUN apk add --no-cache make git
@@ -7,23 +9,17 @@ COPY go.mod go.sum ./
79
RUN go mod download
810
COPY . .
911

10-
RUN make ; make build
12+
# Build for multiple architectures
13+
ARG TARGETOS TARGETARCH
14+
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -o sbomqs .
1115

16+
# Final stage
1217
FROM scratch
1318
LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomqs"
1419
LABEL org.opencontainers.image.description="Quality metrics for your sboms"
1520
LABEL org.opencontainers.image.licenses=Apache-2.0
1621

17-
COPY --from=builder /bin/sh /bin/grep /bin/busybox /bin/touch /bin/chmod /bin/mkdir /bin/date /bin/cat /bin/
18-
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
19-
COPY --from=builder /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1
20-
COPY --from=builder /tmp /tmp
21-
COPY --from=builder /usr/bin /usr/bin
22-
2322
# Copy our static executable
24-
COPY --from=builder /app/build/sbomqs /app/sbomqs
25-
26-
# Disable version check
27-
ENV INTERLYNK_DISABLE_VERSION_CHECK=true
23+
COPY --from=builder /app/sbomqs /app/sbomqs
2824

29-
ENTRYPOINT [ "/app/sbomqs" ]
25+
ENTRYPOINT ["/app/sbomqs"]

cmd/compliance.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ var complianceCmd = &cobra.Command{
2828
Long: `Check if your SBOM complies with various SBOM standards like NTIA minimum elements, BSI TR-03183-2, OpenChain Telco.
2929
Generate a compliance report for an SBOM file.
3030
`,
31+
Example: ` sbomqs compliance --bsi|--oct [--basic|--json] <SBOM file>
32+
33+
# Check a BSI TR-03183-2 v1.1 compliance against a SBOM in a table output
34+
sbomqs compliance --bsi samples/sbomqs-spdx-syft.json
35+
36+
# Check a BSI TR-03183-2 v1.1 compliance against a SBOM in a JSON output
37+
sbomqs compliance --bsi --json samples/sbomqs-spdx-syft.json
38+
39+
# Check a OpenChain Telco compliance against a SBOM in a table output
40+
sbomqs compliance --oct samples/sbomqs-spdx-syft.json
41+
42+
# Check a OpenChain Telco compliance against a SBOM in a JSON output
43+
sbomqs compliance --oct --json samples/sbomqs-spdx-syft.json
44+
`,
3145
Args: func(cmd *cobra.Command, args []string) error {
3246
if err := cobra.ExactArgs(1)(cmd, args); err != nil {
3347
return fmt.Errorf("compliance requires a single argument, the path to an SBOM file")

cmd/score.go

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,25 @@ var scoreCmd = &cobra.Command{
6565
Use: "score",
6666
Short: "comprehensive quality score for your sbom",
6767
SilenceUsage: true,
68-
Args: func(_ *cobra.Command, args []string) error {
68+
Example: ` sbomqs score [--category <category>] [--feature <feature>] [--basic|--json] <SBOM file>
69+
70+
# Get a score against a SBOM in a table output
71+
sbomqs score samples/sbomqs-spdx-syft.json
72+
73+
# Get a score against a SBOM in a basic output
74+
sbomqs score --basic samples/sbomqs-spdx-syft.json
75+
76+
# Get a score against a SBOM in a JSON output
77+
sbomqs score --json samples/sbomqs-spdx-syft.json
78+
79+
# Get a score for a 'NTIA-minimum-elements' category against a SBOM in a table output
80+
sbomqs score --category NTIA-minimum-elements samples/sbomqs-spdx-syft.json
81+
82+
# Get a score for a 'NTIA-minimum-elements' category and 'sbom_authors' feature against a SBOM in a table output
83+
sbomqs score --category NTIA-minimum-elements --feature sbom_authors samples/sbomqs-spdx-syft.json
84+
`,
85+
86+
Args: func(cmd *cobra.Command, args []string) error {
6987
if len(args) <= 0 {
7088
if len(inFile) <= 0 && len(inDirPath) <= 0 {
7189
return fmt.Errorf("provide a path to an sbom file or directory of sbom files")
@@ -188,8 +206,8 @@ func init() {
188206
scoreCmd.Flags().StringP("configpath", "", "", "scoring based on config path")
189207

190208
// Filter Control
191-
scoreCmd.Flags().StringP("category", "c", "", "filter by category")
192-
scoreCmd.Flags().StringP("feature", "f", "", "filter by feature")
209+
scoreCmd.Flags().StringP("category", "c", "", "filter by category (e.g. 'NTIA-minimum-elements', 'Quality', 'Semantic', 'Sharing', 'Structural')")
210+
scoreCmd.Flags().StringP("feature", "f", "", "filter by feature (e.g. 'sbom_authors', 'comp_with_name', 'sbom_creation_timestamp') ")
193211

194212
// Spec Control
195213
scoreCmd.Flags().BoolP("spdx", "", false, "limit scoring to spdx sboms")

0 commit comments

Comments
 (0)