Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Singularity Image Support #125

Merged
merged 8 commits into from
Aug 2, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .bouncer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ permit:
- BSD.*
- MIT.*
- Apache.*
- MPL.*
- MPL.*
- CC0-1.0
20 changes: 17 additions & 3 deletions .github/workflows/validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,29 @@ jobs:
- name: Bootstrap CI environment dependencies
run: make ci-bootstrap

- name: Build key for tar cache
- name: Build key for test-fixture cache
run: make integration-fingerprint

- name: Restore integration test cache
- name: Restore integration test-fixture cache
uses: actions/cache@v2.1.3
with:
path: ${{ github.workspace }}/test/integration/test-fixtures/cache
key: ${{ runner.os }}-integration-test-cache-${{ hashFiles('test/integration/test-fixtures/cache.fingerprint') }}


- name: Build key for tool cache
run: make integration-tools-fingerprint

- name: Restore integration tool cache
id: integration-tool-cache
uses: actions/cache@v2.1.3
with:
path: ${{ github.workspace }}/test/integration/tools/cache
key: ${{ runner.os }}-integration-tools-cache-${{ hashFiles('test/integration/tools/cache.fingerprint') }}

- name: (cache-hit) Load integration tool cache
if: steps.integration-tool-cache.outputs.cache-hit == 'true'
run: make integration-tools-load

- name: Run integration tests
run: make integration

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.DS_Store
coverage.txt
**/test-fixtures/cache/
**/*.fingerprint

# Binaries for programs and plugins
*.exe
Expand Down
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ help:
.PHONY: ci-bootstrap
ci-bootstrap: bootstrap
sudo apt install -y bc
curl -sLO https://github.com/sylabs/singularity/releases/download/v3.10.0/singularity-ce_3.10.0-focal_amd64.deb && sudo apt-get install -y -f ./singularity-ce_3.10.0-focal_amd64.deb

$(RESULTSDIR):
mkdir -p $(RESULTSDIR)
Expand Down Expand Up @@ -110,8 +111,24 @@ show-benchstat:
integration-fingerprint:
find test/integration/test-fixtures/image-* -type f -exec md5sum {} + | awk '{print $1}' | sort | md5sum | tee test/integration/test-fixtures/cache.fingerprint

.PHONY: integration-tools-fingerprint
integration-tools-fingerprint:
@cd test/integration/tools && make fingerprint

.PHONY: integration-tools
integration-tools:
@cd test/integration/tools && make

.PHONY: integration-tools
integration-tools-load:
@cd test/integration/tools && make load-cache

.PHONY: integration-tools
integration-tools-save:
@cd test/integration/tools && make save-cache

.PHONY: integration
integration: ## Run integration tests
integration: integration-tools ## Run integration tests
$(call title,Running integration tests)
go test -v ./test/integration

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ Note: To run tests you will need `skopeo` installed.
## Overview

This library provides the means to:
- parse and read images from multiple sources (currently docker V2 schema images read from the docker daemon and from an archive on disk)
- parse and read images from multiple sources, supporting:
- docker V2 schema images from the docker daemon, podman, or archive
- OCI images from disk, directory, or registry
- singularity formatted image files
- build a file tree representing each layer blob
- create a squashed file tree representation for each layer
- search one or more file trees for selected paths
Expand Down
6 changes: 6 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/anchore/stereoscope/pkg/image"
"github.com/anchore/stereoscope/pkg/image/docker"
"github.com/anchore/stereoscope/pkg/image/oci"
"github.com/anchore/stereoscope/pkg/image/sif"
"github.com/anchore/stereoscope/pkg/logger"
"github.com/wagoodman/go-partybus"
)
Expand Down Expand Up @@ -132,6 +133,11 @@ func selectImageProvider(imgStr string, source image.Source, cfg config) (image.
provider = oci.NewProviderFromTarball(imgStr, tempDirGenerator)
case image.OciRegistrySource:
provider = oci.NewProviderFromRegistry(imgStr, tempDirGenerator, cfg.Registry, cfg.Platform)
case image.SingularitySource:
if cfg.Platform != nil {
return nil, platformSelectionUnsupported
}
provider = sif.NewProviderFromPath(imgStr, tempDirGenerator)
default:
return nil, fmt.Errorf("unable determine image source")
}
Expand Down
9 changes: 7 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/anchore/stereoscope
go 1.16

require (
github.com/CalebQ42/squashfs v0.5.4
github.com/GoogleCloudPlatform/docker-credential-gcr v2.0.5+incompatible
github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220517224237-e6f29200ae04
Expand All @@ -22,11 +23,15 @@ require (
github.com/pkg/errors v0.9.1
// pinned to pull in 386 arch fix: https://github.com/scylladb/go-set/commit/cc7b2070d91ebf40d233207b633e28f5bd8f03a5
github.com/scylladb/go-set v1.0.3-0.20200225121959-cc7b2070d91e
github.com/sergi/go-diff v1.1.0
github.com/sergi/go-diff v1.2.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/afero v1.6.0
github.com/stretchr/testify v1.7.0
github.com/sylabs/sif/v2 v2.7.0
github.com/wagoodman/go-partybus v0.0.0-20200526224238-eb215533f07d
github.com/wagoodman/go-progress v0.0.0-20200621122631-1a2120f0695a
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
)

// Forked to remove https://github.com/rasky/go-lzo dependency, which is GPLv2 licensed.
replace github.com/CalebQ42/squashfs => github.com/sylabs/squashfs v0.5.5-0.20220526223455-67e0f4cd95c5
wagoodman marked this conversation as resolved.
Show resolved Hide resolved