Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions .github/workflows/container-local-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- 'main'

env:
IMAGE_BASE: scanoss/scanoss-py-base
IMAGE_NAME: scanoss/scanoss-py

jobs:
Expand Down Expand Up @@ -38,17 +39,35 @@ jobs:
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

# Build Docker image with Buildx
- name: Build Docker Image
id: build-and-push
# Build Docker image with Buildx - Base
- name: Build Docker Image - No Entrypoint
id: build-no-ep
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ${{ env.IMAGE_BASE }}:latest
target: no_entry_point
outputs: type=docker,dest=/tmp/scanoss-py-base.tar

# Build Docker image with Buildx - Entrypoint
- name: Build Docker Image - With Entrypoint
id: build-with-ep
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ${{ env.IMAGE_NAME }}:latest
target: with_entry_point
outputs: type=docker,dest=/tmp/scanoss-py.tar

- name: Test Docker Image
- name: Test Docker Image - No Entrypoint
run: |
docker load --input /tmp/scanoss-py-base.tar
docker image ls -a
docker run ${{ env.IMAGE_BASE }} scanoss-py version

- name: Test Docker Image - With Entrypoint
run: |
docker load --input /tmp/scanoss-py.tar
docker image ls -a
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/container-publish-ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME_BASE: scanoss/scanoss-py-base
IMAGE_NAME: scanoss/scanoss-py

jobs:
Expand Down Expand Up @@ -56,14 +57,36 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
- name: Extract Docker metadata
- name: Extract Docker metadata - no entrypoint
id: meta-ne
uses: docker/metadata-action@v4
with:
images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}"

# Build and push Docker image with Buildx (don't push on PR)
- name: Build and push Docker image - Base (no entrypoint)
id: build-and-push-ne
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-ne.outputs.tags }}
labels: ${{ steps.meta-ne.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
target: no_entry_point

# Extract metadata (tags, labels) for Docker
- name: Extract Docker metadata - entrypoint
id: meta
uses: docker/metadata-action@v4
with:
images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"

# Build and push Docker image with Buildx (don't push on PR)
- name: Build and push Docker image
- name: Build and push Docker image - EP (entrypoint)
id: build-and-push
uses: docker/build-push-action@v5
with:
Expand All @@ -75,6 +98,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
target: with_entry_point

# Test the docker image
- name: Test Published Image
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/python-local-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ jobs:
run: make dist

- name: Install Test Package
run: |
pip install -r requirements.txt
pip install dist/scanoss-*-py3-none-any.whl
which scanoss-py
uses: nick-fields/retry@v3
with:
timeout_minutes: 2
retry_wait_seconds: 10
max_attempts: 3
retry_on: error
command: |
pip install -r requirements.txt
pip install dist/scanoss-*-py3-none-any.whl
which scanoss-py

- name: Run Tests
run: |
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/python-publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,19 @@ jobs:
python-version: '3.10.x'

- name: Install Remote Package
run: |
scanoss_version=$(python ./version.py)
echo "Sleeping before checking PyPI for new release version ${scanoss_version}..."
sleep 60
echo "Installing scanoss ${scanoss_version}..."
pip install --upgrade scanoss==$scanoss_version
which scanoss-py
uses: nick-fields/retry@v3
with:
timeout_minutes: 3
retry_wait_seconds: 10
max_attempts: 3
retry_on: error
command: |
scanoss_version=$(python ./version.py)
echo "Sleeping before checking PyPI for new release version ${scanoss_version}..."
sleep 60
echo "Installing scanoss ${scanoss_version}..."
pip install --upgrade scanoss==$scanoss_version
which scanoss-py

- name: Run Tests
run: |
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Upcoming changes...

## [1.19.2] - 2025-01-06
### Added
- Add second container image `scanoss-py-base` with no `ENTRYPOINT`
- This is useful for calls from container pipelines (i.e. Jenkins)

## [1.19.1] - 2025-01-06
### Fixed
- Fixed undeclared components inspection
Expand Down Expand Up @@ -423,4 +428,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[1.18.0]: https://github.com/scanoss/scanoss.py/compare/v1.17.5...v1.18.0
[1.18.1]: https://github.com/scanoss/scanoss.py/compare/v1.18.0...v1.18.1
[1.19.0]: https://github.com/scanoss/scanoss.py/compare/v1.18.1...v1.19.0
[1.19.1]: https://github.com/scanoss/scanoss.py/compare/v1.19.0...v1.19.1
[1.19.1]: https://github.com/scanoss/scanoss.py/compare/v1.19.0...v1.19.1
[1.19.2]: https://github.com/scanoss/scanoss.py/compare/v1.19.1...v1.19.2
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN tar -xvzf /install/v5.39.210212.tar.gz -C /install \
RUN rm -rf /root/.local/lib/python3.10/site-packages/licensedcode/data/rules /root/.local/lib/python3.10/site-packages/licensedcode/data/cache
RUN mkdir /root/.local/lib/python3.10/site-packages/licensedcode/data/rules /root/.local/lib/python3.10/site-packages/licensedcode/data/cache

FROM base
FROM base AS no_entry_point

# Copy the Python user packages from the build image to here
COPY --from=builder /root/.local /root/.local
Expand All @@ -56,5 +56,7 @@ WORKDIR /scanoss
# Run scancode once to setup any initial files, etc. so that it'll run faster later
RUN scancode -p --only-findings --quiet --json /scanoss/scancode-dependencies.json /scanoss && rm -f /scanoss/scancode-dependencies.json

FROM no_entry_point AS with_entry_point

ENTRYPOINT ["scanoss-py"]
CMD ["--help"]
29 changes: 20 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

#vars
IMAGE_BASE=scanoss-py-base
IMAGE_NAME=scanoss-py
REPO=scanoss
DOCKER_FULLNAME_BASE=${REPO}/${IMAGE_BASE}
DOCKER_FULLNAME=${REPO}/${IMAGE_NAME}
GHCR_FULLNAME_BASE=ghcr.io/${REPO}/${IMAGE_BASE}
GHCR_FULLNAME=ghcr.io/${REPO}/${IMAGE_NAME}
VERSION=$(shell ./version.py)

Expand Down Expand Up @@ -55,15 +58,19 @@ package_all: dist publish ## Build & Publish Python package to PyPI

ghcr_build: dist ## Build GitHub container image with local arch
@echo "Building GHCR container image..."
docker build -t $(GHCR_FULLNAME) .
docker build --target with_entry_point -t $(GHCR_FULLNAME) .

ghcr_build_base: dist ## Build GitHub container base image with local arch (no entrypoint)
@echo "Building GHCR base container image..."
docker build --target no_entry_point -t $(GHCR_FULLNAME_BASE) .

ghcr_amd64: dist ## Build GitHub AMD64 container image
@echo "Building GHCR AMD64 container image..."
docker build -t $(GHCR_FULLNAME) --platform linux/amd64 .
docker build --target with_entry_point -t $(GHCR_FULLNAME) --platform linux/amd64 .

ghcr_arm64: dist ## Build GitHub ARM64 container image
@echo "Building GHCR ARM64 container image..."
docker build -t $(GHCR_FULLNAME) --platform linux/arm64 .
docker build --target with_entry_point -t $(GHCR_FULLNAME) --platform linux/arm64 .

ghcr_tag: ## Tag the latest GH container image with the version from Python
@echo "Tagging GHCR latest image with $(VERSION)..."
Expand All @@ -76,21 +83,25 @@ ghcr_push: ## Push the GH container image to GH Packages

ghcr_release: dist ## Build/Publish GitHub multi-platform container image
@echo "Building & Releasing GHCR multi-platform container image $(VERSION)..."
docker buildx build --push -t $(GHCR_FULLNAME):$(VERSION) --platform linux/arm64,linux/amd64 .
docker buildx build --push --target with_entry_point -t $(GHCR_FULLNAME):$(VERSION) --platform linux/arm64,linux/amd64 .

ghcr_all: ghcr_release ## Execute all GHCR container actions

docker_build: ## Build Docker container image with local arch
docker_build: dist ## Build Docker container image with local arch
@echo "Building Docker image..."
docker build --no-cache --target with_entry_point -t $(DOCKER_FULLNAME) .

docker_build_base: dist ## Build Docker container image with local arch
@echo "Building Docker image..."
docker build --no-cache -t $(DOCKER_FULLNAME) .
docker build --no-cache --target no_entry_point -t $(DOCKER_FULLNAME_BASE) .

docker_amd64: dist ## Build Docker AMD64 container image
@echo "Building Docker AMD64 container image..."
docker build -t $(DOCKER_FULLNAME) --platform linux/amd64 .
docker build --target with_entry_point -t $(DOCKER_FULLNAME) --platform linux/amd64 .

docker_arm64: dist ## Build Docker ARM64 container image
@echo "Building Docker ARM64 container image..."
docker build -t $(DOCKER_FULLNAME) --platform linux/arm64 .
docker build --target with_entry_point -t $(DOCKER_FULLNAME) --platform linux/arm64 .

docker_tag: ## Tag the latest Docker container image with the version from Python
@echo "Tagging Docker latest image with $(VERSION)..."
Expand All @@ -103,6 +114,6 @@ docker_push: ## Push the Docker container image to DockerHub

docker_release: dist ## Build/Publish Docker multi-platform container image
@echo "Building & Releasing Docker multi-platform container image $(VERSION)..."
docker buildx build --push -t $(DOCKER_FULLNAME):$(VERSION) --platform linux/arm64,linux/amd64 .
docker buildx build --push --target with_entry_point -t $(DOCKER_FULLNAME):$(VERSION) --platform linux/arm64,linux/amd64 .

docker_all: docker_release ## Execute all DockerHub container actions
2 changes: 1 addition & 1 deletion src/scanoss/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
THE SOFTWARE.
"""

__version__ = "1.19.1"
__version__ = "1.19.2"
Loading