Skip to content

Commit

Permalink
Mbt upgrade SBOM file content (#1103)
Browse files Browse the repository at this point in the history
* modified:   .circleci/config.yml
	modified:   Dockerfile_mbtci_template
	modified:   Makefile
	modified:   internal/artifacts/sbom.go
	modified:   internal/commands/commands.go

* modified:   internal/artifacts/sbom.go
	modified:   internal/commands/commands.go

* modified:   internal/artifacts/sbom.go

* modified:   Dockerfile_mbtci_template
	modified:   internal/artifacts/sbom.go

* modified:   internal/artifacts/project.go
	modified:   internal/artifacts/project_test.go
	modified:   internal/artifacts/sbom.go

* modified:   internal/artifacts/sbom.go

* modified:   Makefile

---------

Co-authored-by: Young Yang <[email protected]>
  • Loading branch information
young-yang03 and Young Yang authored Jul 2, 2024
1 parent 6d70b01 commit 8fc6493
Show file tree
Hide file tree
Showing 7 changed files with 279 additions and 48 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ jobs:
go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@latest
cyclonedx-gomod version
- run:
name: install cyclonedx-bom
command: |
CYCLONEDX_BOM_PACKAGE=cyclonedx-bom
CYCLONEDX_BOM_VERSION=0.0.9
CYCLONEDX_BOM_BINARY=cyclonedx-bom
npm install ${CYCLONEDX_BOM_PACKAGE}@${CYCLONEDX_BOM_VERSION} --no-save
echo "${CYCLONEDX_BOM_BINARY} -h"
npx ${CYCLONEDX_BOM_BINARY} -h
name: install cyclonedx-npm
command: |
CYCLONEDX_NPM_PACKAGE=@cyclonedx/cyclonedx-npm
CYCLONEDX_NPM_VERSION=1.11.0
CYCLONEDX_NPM_BINARY=cyclonedx-npm
npm install ${CYCLONEDX_NPM_PACKAGE}@${CYCLONEDX_NPM_VERSION} --no-save
echo "${CYCLONEDX_NPM_BINARY} -h"
npx ${CYCLONEDX_NPM_BINARY} -h
- run:
name: build mbt binary
command: |
Expand Down
12 changes: 3 additions & 9 deletions Dockerfile_mbtci_template
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ ARG CYCLONEDX_CLI_VERSION=0.24.2
ARG CYCLONEDX_CLI_BINARY=cyclonedx
ARG CYCLONEDX_GOMOD_VERSION=1.4.0
ARG CYCLONEDX_GOMOD_BINARY=cyclonedx-gomod
ARG CYCLONEDX_BOM_PACKAGE=cyclonedx-bom
ARG CYCLONEDX_BOM_VERSION=0.0.9
ARG CYCLONEDX_BOM_BINARY=cyclonedx-bom
ARG CYCLONEDX_NPM_PACKAGE=@cyclonedx/cyclonedx-npm
ARG CYCLONEDX_NPM_VERSION=1.11.0
ARG CYCLONEDX_NPM_BINARY=cyclonedx-npm

# Environment variables
ENV PYTHON /usr/bin/python3
Expand Down Expand Up @@ -293,12 +293,6 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& echo "cyclonedx-gomod smoke tests!" \
&& cyclonedx-gomod version

# Install cyclone-bom
RUN set -ex \
&& npm install --prefix /usr/local/ -g ${CYCLONEDX_BOM_PACKAGE}@${CYCLONEDX_BOM_VERSION} \
&& echo "cyclonedx-bom smoke tests!" \
&& npx ${CYCLONEDX_BOM_BINARY} -h

# Install curl and ca-certificates
RUN set -ex \
&& apt-get update \
Expand Down
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ CYCLONEDX_CLI_VERSION = 0.24.2
CYCLONEDX_GOMOD_BINARY = cyclonedx-gomod
CYCLONEDX_GOMOD_VERSION = latest

# cyclonedx-bom
CYCLONEDX_BOM_PACKAGE = cyclonedx-bom
CYCLONEDX_BOM_VERSION = 0.0.9
CYCLONEDX_BOM_BINARY = cyclonedx-bom

# cyclonedx_npm
CYCLONEDX_NPM_PACKAGE = @cyclonedx/cyclonedx-npm
CYCLONEDX_NPM_VERSION = 1.11.0
CYCLONEDX_NPM_BINARY = cyclonedx-npm

ifeq ($(OS),Windows_NT)
CYCLONEDX_OS=win
Expand Down Expand Up @@ -70,10 +69,10 @@ lint:

# execute general tests
tests:
go test -v -count=1 -timeout 30m ./...
go test -v -count=1 -timeout 60m ./...
# check code coverage
cover:
go test -v -coverprofile cover.out ./... -count=1 -timeout 30m
go test -v -coverprofile cover.out ./... -count=1 -timeout 60m
go tool cover -html=cover.out -o cover.html
open cover.html

Expand Down Expand Up @@ -111,18 +110,20 @@ else
cp $(CURDIR)/release/$(BINARY_NAME) $~/usr/local/bin/
endif

# use for local development - > install cyclonedx-gomod, cyclonedx-cli and cyclonedx-bom
# use for local development - > install cyclonedx-gomod, cyclonedx-cli and cyclonedx-npm
install-cyclonedx:
# install cyclonedx-gomod
go install github.com/CycloneDX/cyclonedx-gomod/cmd/${CYCLONEDX_GOMOD_BINARY}@${CYCLONEDX_GOMOD_VERSION}
echo "${CYCLONEDX_GOMOD_BINARY} version"
${CYCLONEDX_GOMOD_BINARY} version

# install cyclonedx-cli
curl -fsSLO --compressed "https://github.com/CycloneDX/cyclonedx-cli/releases/download/v${CYCLONEDX_CLI_VERSION}/${CYCLONEDX_CLI_BINARY}-${CYCLONEDX_OS}-${CYCLONEDX_ARCH}${CYCLONEDX_BINARY_SUFFIX}"
mv ${CYCLONEDX_CLI_BINARY}-${CYCLONEDX_OS}-${CYCLONEDX_ARCH}${CYCLONEDX_BINARY_SUFFIX} $(GOPATH)/bin/${CYCLONEDX_CLI_BINARY}${CYCLONEDX_BINARY_SUFFIX}
echo "${CYCLONEDX_CLI_BINARY} version:"
${CYCLONEDX_CLI_BINARY} --version
# install cyclonedx-bom
npm install -g ${CYCLONEDX_BOM_PACKAGE}@${CYCLONEDX_BOM_VERSION}
echo "${CYCLONEDX_BOM_BINARY} -h"
npx ${CYCLONEDX_BOM_BINARY} -h

# install cyclonedx-npm
npm install -g ${CYCLONEDX_NPM_PACKAGE}@${CYCLONEDX_NPM_VERSION}
echo "${CYCLONEDX_NPM_BINARY} -h"
npx ${CYCLONEDX_NPM_BINARY} -h
2 changes: 1 addition & 1 deletion internal/artifacts/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/pkg/errors"

dir "github.com/SAP/cloud-mta-build-tool/internal/archive"
"github.com/SAP/cloud-mta-build-tool/internal/archive"
"github.com/SAP/cloud-mta-build-tool/internal/commands"
"github.com/SAP/cloud-mta-build-tool/internal/exec"
"github.com/SAP/cloud-mta-build-tool/internal/logs"
Expand Down
2 changes: 1 addition & 1 deletion internal/artifacts/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"

dir "github.com/SAP/cloud-mta-build-tool/internal/archive"
"github.com/SAP/cloud-mta-build-tool/internal/archive"
"github.com/SAP/cloud-mta-build-tool/internal/commands"
"github.com/SAP/cloud-mta-build-tool/internal/exec"
"github.com/SAP/cloud-mta/mta"
Expand Down
Loading

0 comments on commit 8fc6493

Please sign in to comment.