Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
0b7da2e
[WIP] Conformance redesign
sudo-bmitch Jan 16, 2025
b9f39a4
[WIP] Log individual test success/failures
sudo-bmitch Feb 9, 2025
06b835c
[WIP] Writing junit results
sudo-bmitch Feb 9, 2025
499a59a
[WIP] Refactor runner, results, and state
sudo-bmitch Aug 11, 2025
1117f11
[WIP] Switch yaml library
sudo-bmitch Aug 11, 2025
75d25af
[WIP] First pass at auth
sudo-bmitch Aug 16, 2025
83eb746
[WIP] Add http tracing output
sudo-bmitch Aug 23, 2025
e3b2aa7
[WIP] Fix bearer token handler
sudo-bmitch Aug 23, 2025
5ea5e70
[WIP]: Use a redaction writer for logs
sudo-bmitch Aug 24, 2025
14b6033
[WIP] Fix data status
sudo-bmitch Aug 25, 2025
e7dac7e
[WIP] Add HTML report
sudo-bmitch Sep 22, 2025
52c93b4
[WIP] Adding config to Junit output, cleaning todos
sudo-bmitch Sep 29, 2025
e30769b
[WIP] Add logging
sudo-bmitch Sep 30, 2025
7ff176b
[WIP] Apply modernizer changes
sudo-bmitch Oct 1, 2025
aa19642
[WIP] Add a spec version
sudo-bmitch Oct 2, 2025
30b64d4
[WIP] support bool environment variables
sudo-bmitch Oct 2, 2025
f3ca4b0
[WIP] Return multiple errors and check headers on manifest push
sudo-bmitch Oct 13, 2025
4afb3c5
[WIP] Propagate errors from failed APIs in prep for a TestPushBlobAny…
sudo-bmitch Oct 14, 2025
87c3263
[WIP] Blob push by any method
sudo-bmitch Oct 14, 2025
cb07ccc
[WIP] Add blob patch apis
sudo-bmitch Oct 15, 2025
e9072a8
[WIP] Fix API report
sudo-bmitch Oct 15, 2025
d27282f
[WIP] Add cleanup commands and track skipped tests
sudo-bmitch Oct 17, 2025
f41b57a
[WIP] Fix reporting of disabled tests
sudo-bmitch Oct 17, 2025
4f2b78b
[WIP] Organize tests by data type
sudo-bmitch Oct 17, 2025
aad10a0
[WIP] Add blob push tests
sudo-bmitch Oct 17, 2025
3308ed6
[WIP] Individually test blob APIs
sudo-bmitch Oct 21, 2025
0bb5097
[WIP] Add get APIs
sudo-bmitch Oct 22, 2025
729d071
[WIP] Handle registry rejected requests
sudo-bmitch Oct 24, 2025
4350c8d
[WIP] Report tested API version and commit
sudo-bmitch Oct 24, 2025
a0be234
[WIP] Pass through repo and update gen with func options
sudo-bmitch Oct 25, 2025
fdfef3b
[WIP] Push manifest with a subject
sudo-bmitch Oct 27, 2025
c553f28
[WIP] Test referrers API and reorder methods
sudo-bmitch Nov 2, 2025
c6f7bf4
[WIP] Verify Content-Type header on manifest get
sudo-bmitch Nov 3, 2025
abb4c59
[WIP] Add Artifact Index with a subject
sudo-bmitch Nov 3, 2025
7d5221a
[WIP] Manage tags as a map to digests
sudo-bmitch Nov 3, 2025
8911353
[WIP] Add blob mount tests, better handle disabled APIs, and rework A…
sudo-bmitch Nov 7, 2025
e9f79b5
[WIP] Add HEAD requests
sudo-bmitch Nov 17, 2025
f377cdb
[WIP] Add tag listing after push
sudo-bmitch Nov 23, 2025
aabab4e
[WIP] Verify delete operations
sudo-bmitch Nov 24, 2025
eec6016
[WIP] Configurable data tests
sudo-bmitch Nov 25, 2025
1f315c2
[WIP] Add foreign layers and artifact as index
sudo-bmitch Nov 26, 2025
0263e2c
[WIP] Add and verify unique annotations and artifactType in referrers…
sudo-bmitch Nov 27, 2025
c585865
[WIP] Add custom fields
sudo-bmitch Nov 27, 2025
338949d
[WIP] Switch to upstream image structs
sudo-bmitch Nov 27, 2025
2fbb089
[WIP] Allow report sections to be collapsed
sudo-bmitch Nov 28, 2025
4e5aed7
[WIP] Save computed config to results
sudo-bmitch Nov 28, 2025
73c3173
[WIP] Cleanup report CSS alignment
sudo-bmitch Nov 28, 2025
b67aecc
[WIP] Convert legacy environment variables
sudo-bmitch Nov 30, 2025
7379147
[WIP] Support read-only registries
sudo-bmitch Dec 2, 2025
586c345
[WIP] Convert legacy variables for read-only registries and improve e…
sudo-bmitch Dec 3, 2025
e9bc8ef
[WIP] Add a readme
sudo-bmitch Dec 4, 2025
3e4bd4a
[WIP] Improve test on referrers response descriptors
sudo-bmitch Dec 4, 2025
c811424
[WIP] Add Docker image
sudo-bmitch Dec 4, 2025
70d17fe
[WIP] Add a test wrapper, but warn when used
sudo-bmitch Dec 4, 2025
19da089
[WIP] Allow the empty blob test to be disabled, fix empty platform
sudo-bmitch Dec 4, 2025
3380574
[WIP] Add Content-Length to blob APIs where required
sudo-bmitch Dec 5, 2025
8cf62d4
[WIP] Show expected status code in errors
sudo-bmitch Dec 5, 2025
26b9eaa
[WIP] Fix Content-Length header on requests
sudo-bmitch Dec 5, 2025
4400153
[WIP] Include Content-Length in debugging logs
sudo-bmitch Dec 5, 2025
763bc3d
[WIP] Test push of a chunk in final PUT request
sudo-bmitch Dec 5, 2025
e5e6289
[WIP] Fix Content-Length on blob mount fallback
sudo-bmitch Dec 5, 2025
a53fe79
[WIP] Test invalid blob digests
sudo-bmitch Dec 7, 2025
9952882
[WIP] Fallback to PUT if blob POST with data returns Accepted
sudo-bmitch Dec 7, 2025
f75f9c0
[WIP] Add test for invalid manifest digest
sudo-bmitch Dec 9, 2025
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
6 changes: 6 additions & 0 deletions conformance2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
!go.mod
!go.sum
conformance
conformance.test
oci-conformance.yaml
results/**
10 changes: 10 additions & 0 deletions conformance2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM golang:1.24-alpine AS build

COPY . .
RUN CGO_ENABLED=0 go build -o /usr/local/bin/conformance .
ENTRYPOINT [ "/usr/local/bin/conformance" ]

FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /usr/local/bin/conformance /conformance
ENTRYPOINT [ "/conformance" ]
171 changes: 171 additions & 0 deletions conformance2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# OCI Distribution Spec Conformance Test

The distribution-spec conformance test is used to verify the various HTTP endpoints on a registry generate the appropriate responses and handle different types of data.

## Configuration

The test is configured by either a yaml configuration file or environment variables.
When a setting is configured by multiple sources, the precedence from highest to lowest is the environment variable, then yaml configuration file, and lastly any legacy environment variables.

Most registries can be tested by setting the registry, repository, and login credentials.
For APIs with a valid unsupported response code, attempts are made to track the missing feature without needing to manually disable the test.

### Environment Variables

Environment variables can be used to set any configuration setting in the conformance test.
The available variables and their default values are listed here:

```shell
# several variables are used to configure the overall conformance test process
export OCI_CONFIGURATION="oci-conformance.yaml" # see Yaml Configuration File below
export OCI_RESULTS_DIR="./results" # output of the conformance test will be written here, see Results below
export OCI_VERSION="1.1" # distribution-spec version to test against, this adjusts default values for the API tests
export OCI_LOG=warn # adjust logging threshold: debug, info, warn, error (this does not affect the generated reports)

# the registry settings typically need to be configured
export OCI_REGISTRY="localhost:5000"
export OCI_TLS="enabled" # enabled (https), insecure (self signed), or disabled (http)
export OCI_REPO1="conformance/repo1"
export OCI_REPO2="conformance/repo2"
export OCI_USERNAME=
export OCI_PASSWORD=

# API settings with their 1.1 default values can be used to skip specific requests
export OCI_API_PULL=true
export OCI_API_PUSH=true # to disable push requests, see the OCI_RO_DATA variables below
export OCI_API_BLOBS_ATOMIC=true # whether blob delete operations should be immediate
export OCI_API_BLOBS_DELETE=true
export OCI_API_BLOBS_MOUNT_ANONYMOUS=true # attempt to mount a blob without a source repository
export OCI_API_MANIFESTS_ATOMIC=true # whether manifest delete operations should be immediate
export OCI_API_MANIFESTS_DELETE=true
export OCI_API_TAGS_ATOMIC=true # whether tag delete operations should be immediate
export OCI_API_TAGS_DELETE=true
export OCI_API_TAGS_LIST=true
export OCI_API_REFERRER=true

# Data settings are used to generate a variety of OCI content
export OCI_DATA_IMAGE=true # note, this must be left enabled for any tests to run
export OCI_DATA_INDEX=true
export OCI_DATA_INDEX_LIST=true # an index containing a nested index
export OCI_DATA_SPARSE=false # an index containing references to manifests that have not been pushed
export OCI_DATA_ARTIFACT=true # an OCI artifact packaged as an image with an artifactType
export OCI_DATA_SUBJECT=true # an OCI image with the subject field defined
export OCI_DATA_SUBJECT_MISSING=true # pushes content with a subject referencing a non-existent digest
export OCI_DATA_ARTIFACT_LIST=true # an OCI index with an artifactType
export OCI_DATA_SUBJECT_LIST=true # an OCI index with the subject field defined
export OCI_DATA_DATA_FIELD=true # descriptors with the data field populated
export OCI_DATA_NONDISTRIBUTABLE=true # an OCI image containing nondistributable layer references that have not been pushed
export OCI_DATA_CUSTOM_FIELDS=true # manifests and config json with additional fields
export OCI_DATA_EMPTY_BLOB=true # zero byte blob
export OCI_DATA_SHA512=true # content pushed using the sha512 digest algorithm

# For testing read-only registries, images must be preloaded.
# OCI_API_PUSH=false must be set, and disabling DELETE APIs is recommended.
# All requests are performed against the OCI_REPO1 repository.
export OCI_RO_DATA_TAGS= # space separated list of tags
export OCI_RO_DATA_MANIFESTS= # space separated list of manifest digests
export OCI_RO_DATA_BLOBS= # space separated list of blob digests
export OCI_RO_DATA_REFERRERS= # space separated list of subject digests for the referrers API
```

### Yaml Configuration File

The conformance test will load `oci-conformance.yaml` by default, which can be configured with the `OCI_CONFIGURATION` environment variable.

The default yaml configuration is shown below and matches the environment variables described above:

```yaml
resultsDir: ./results
version: "1.1"
registry: localhost:5000
tls: enabled
repo1: conformance/repo1
repo2: conformance/repo2
username: ""
password: ""
logging: warn
apis:
pull: true
push: true
blobs:
atomic: true
delete: true
mountAnonymous: false
manifests:
atomic: true
delete: true
tags:
atomic: true
delete: true
list: true
referrer: true
data:
image: true
index: true
indexList: true
sparse: false
artifact: true
subject: true
subjectMissing: true
artifactList: true
subjectList: true
dataField: true
nondistributable: true
customFields: true
emptyBlob: true
sha512: true
roData:
tags: []
manifests: []
blobs: []
referrers: []
```

## Running the Test

The test is available to be run with Go, Docker, or GitHub Actions.

### Go

The tests require Go 1.24 or greater.

They can be run directly with:

```shell
go run -buildvcs=true .
```

Or to compile and run separately:

```shell
go build -o conformance .
./conformance
```

### Docker

First configure the test with environment variables or a configuration file as described above.
Then build and run the conformance test using a command similar to below:

```shell
docker build -t conformance .
docker run -it --rm --net=host \
-u "$(id -u):$(id -g)" \
-v "$(pwd)/results:/results" \
-e OCI_REGISTRY -e OCI_TLS -e OCI_REPO1 -e OCI_REPO2 -e OCI_USERNAME -e OCI_PASSWORD -e OCI_VERSION \
conformance:latest
```

Additional environment variables can be specified as needed, or the `oci-conformance.yaml` file can be passed as a volume, mounted at `/oci-conformance.yaml` inside the container.

### GitHub Actions

TODO

## Results

A summary of the test is output to the screen along with any logging.
The results directory (`results` by default) is populated with the following files:

- `report.html`: Full report of the test, including censored output of each request and response.
- `junit.xml`: JUnit report.
Loading
Loading