From 2ab577d0b0882da0cf2145a898f2091e0e029054 Mon Sep 17 00:00:00 2001 From: Douglas Coburn Date: Thu, 17 Oct 2024 22:38:53 -0700 Subject: [PATCH] Added support for CycloneDX and SPDX manifest files to the CLI. Also improved build script --- scripts/build_container.sh | 33 ++++++++++++++++++++------------- socketsecurity/__init__.py | 2 +- socketsecurity/core/__init__.py | 13 +++++++++++++ 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/scripts/build_container.sh b/scripts/build_container.sh index a57ebcf..a0c2a1b 100755 --- a/scripts/build_container.sh +++ b/scripts/build_container.sh @@ -5,32 +5,39 @@ STABLE_VERSION=$2 echo $VERSION if [ -z $ENABLE_PYPI_BUILD ] || [ -z $STABLE_VERSION ]; then echo "$0 pypi-build=enable stable=true" - echo "\tpypi-build: Build and publish a new version of the package to pypi" + echo "\tpypi-build: Build and publish a new version of the package to pypi. Options are prod or test" echo "\tstable: Only build and publish a new version for the stable docker tag if it has been tested and going on the changelog" exit fi -if [ $ENABLE_PYPI_BUILD = "pypi-build=enable" ]; then +if [ $ENABLE_PYPI_BUILD = "pypi-build=prod" ]; then echo "Doing production build" python -m build --wheel --sdist twine upload dist/*$VERSION* - sleep 240 + sleep 120 docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:$VERSION . \ && docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:latest . \ && docker push socketdev/cli:$VERSION \ && docker push socketdev/cli:latest - if [ $STABLE_VERSION = "stable=true" ]; then - docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:stable . \ - && docker push socketdev/cli:stable - fi -else +fi + +if [ $ENABLE_PYPI_BUILD = "pypi-build=test" ]; then echo "Doing test build" python -m build --wheel --sdist twine upload --repository testpypi dist/*$VERSION* -# sleep 240 -# docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:$VERSION . \ -# && docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:latest . \ -# && docker push socketdev/cli:$VERSION-test \ -# && docker push socketdev/cli:test + sleep 120 + docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:$VERSION . \ + && docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:latest . \ + && docker push socketdev/cli:$VERSION-test \ + && docker push socketdev/cli:test fi + +if [ $STABLE_VERSION = "stable=true" ]; then + if [ $ENABLE_PYPI_BUILD = "pypi-build=enable" ]; then + sleep 120 + fi + docker build --no-cache --build-arg CLI_VERSION=$VERSION --platform linux/amd64,linux/arm64 -t socketdev/cli:stable . \ + && docker push socketdev/cli:stable + fi + diff --git a/socketsecurity/__init__.py b/socketsecurity/__init__.py index 9914dc4..554e76e 100644 --- a/socketsecurity/__init__.py +++ b/socketsecurity/__init__.py @@ -1,2 +1,2 @@ __author__ = 'socket.dev' -__version__ = '1.0.31' +__version__ = '1.0.32' diff --git a/socketsecurity/core/__init__.py b/socketsecurity/core/__init__.py index c192a1b..8dea47a 100644 --- a/socketsecurity/core/__init__.py +++ b/socketsecurity/core/__init__.py @@ -50,6 +50,19 @@ log.addHandler(logging.NullHandler()) socket_globs = { + "spdx": { + "spdx.json": { + "pattern": "*[-.]spdx.json" + } + }, + "cdx": { + "cyclonedx.json": { + "pattern": "{bom,*[-.]c{yclone,}dx}.json" + }, + "xml": { + "pattern": "{bom,*[-.]c{yclone,}dx}.xml" + } + }, "npm": { "package.json": { "pattern": "package.json"