chore: migrate fixtures to testdata (#4651)

* migrate fixtures to testdata

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix: correct broken symlinks after testdata migration

The migration from test-fixtures to testdata broke several symlinks:
- elf-test-fixtures symlinks pointed to old test-fixtures paths
- elf-test-fixtures needed to be renamed to elf-testdata
- image-pkg-coverage symlink pointed to test-fixtures instead of testdata

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix: handle missing classifiers/bin directory in Makefile

The clean-fingerprint target was failing when classifiers/bin doesn't
exist (e.g., on fresh clone without downloaded binaries).

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix: add gitignore negation for jar/zip fixtures in test/cli

The jar and zip files in test/cli/testdata/image-unknowns were being
gitignored by the root .gitignore patterns. This caused them to be
untracked and not included when building docker images in CI, resulting
in Test_Unknowns failures since the test expects errors from corrupt
archive files that weren't present.

Add a .gitignore in test/cli/testdata to negate the exclusions for
these specific test fixture files.

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* switch fixture cache to v2

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* test: update expected versions for rebuilt fixtures

Update test expectations for packages that have been updated in
upstream repositories when docker images are rebuilt:
- glibc: 2.42-r4 → 2.43-r1 (wolfi)
- php: 8.2.29 → 8.2.30 (ubuntu/apache)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* upgrade go

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix: add go-shlex dependency for testdata manager tool

The manager tool in syft/pkg/cataloger/binary/testdata/ imports
go-shlex, but since it's in a testdata directory, Go doesn't track
its dependencies. This caused CI failures when go.mod didn't
explicitly list the dependency.

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* refactor: move binary classifier manager to internal/

Move the manager tool from testdata/manager to internal/manager so
that Go properly tracks its dependencies. Code in testdata directories
is ignored by Go for dependency tracking, which caused CI failures
when go.mod didn't explicitly list transitive dependencies.

This is a cleaner solution than manually adding dependencies to go.mod
for code that happens to live in testdata.

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix: add gitignore negations for test fixtures blocked by root patterns

Multiple test fixtures were being blocked by root-level gitignore patterns
like bin/, *.jar, *.tar, and *.exe. This adds targeted .gitignore files with
negation patterns to allow these specific test fixtures to be tracked:

- syft/linux/testdata/os/busybox/bin/busybox (blocked by bin/)
- syft/pkg/cataloger/java/testdata/corrupt/example.{jar,tar} (blocked by *.jar, *.tar)
- syft/pkg/cataloger/binary/testdata/classifiers/snippets/go-version-hint/**/bin/go (blocked by bin/)
- syft/pkg/cataloger/bitnami/testdata/no-rel/.../bin/redis-server (blocked by bin/)

Also updates the bitnami test expectation to include the newly required
.gitignore files in the test fixture.

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* test: update glibc version expectation (2.43-r1 -> 2.43-r2)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* add capability drift check as unit step

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* dont clear test observations before drift detection

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* bump stereoscope commit to main

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman
2026-03-06 19:42:04 +00:00
committed by GitHub
parent 35278f3d3d
commit b5e85c3ea5
1589 changed files with 1184 additions and 1058 deletions
+10
View File
@@ -0,0 +1,10 @@
FROM golang:1.17.8@sha256:c7c94588b6445f5254fbc34df941afa10de04706deb330e62831740c9f0f2030 AS builder
WORKDIR /root/
RUN go install github.com/google/trillian/cmd/createtree@v1.3.10
ADD ./config/logid.sh /root/
ADD ./config/ctfe /root/ctfe
RUN chmod +x /root/logid.sh
CMD /root/logid.sh
+9
View File
@@ -0,0 +1,9 @@
{
"OIDCIssuers": {
"http://dex-idp:8888/auth": {
"IssuerURL": "http://dex-idp:8888/auth",
"ClientID": "fulcio",
"Type": "email"
}
}
}
+11
View File
@@ -0,0 +1,11 @@
config {
log_id: %LOGID%
prefix: "test"
roots_pem_file: "/etc/config/root.pem"
private_key: {
[type.googleapis.com/keyspb.PEMKeyFile] {
path: "/etc/config/privkey.pem"
password: "foobar"
}
}
}
+8
View File
@@ -0,0 +1,8 @@
-----BEGIN EC PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-CBC,05BAAA9143C46320
AttbquLclNy7ZEnlDFpReZvV2PZKuv89YMWqDvGGtnBVw+3eXYIa54Xli1CyXEPn
qNGvibjIxj+Q19+VhA3n42SE2fHyULHKPZHebSL5qcVvZTqmbtAe/dZNH1SiGG2f
bWauIw0oeHhXW5i9isxrLggPMRmPA65Ii3W7gyWFmjE=
-----END EC PRIVATE KEY-----
+4
View File
@@ -0,0 +1,4 @@
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEbbQiLx6GKy6ivhc11wJGbQjc2VX/
mnuk5d670MTXR3p+LIAcxd5MhqIHpLmyYJ5mDKLEoZ/pC0nPuje3JueBcA==
-----END PUBLIC KEY-----
@@ -0,0 +1,48 @@
#
# Copyright 2021 The Sigstore Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
issuer: http://dex-idp:8888/auth
storage:
type: memory
web:
http: dex-idp:8888
frontend:
issuer: Fulcio in Docker Compose
expiry:
signingKeys: "24h"
idTokens: "1m"
authRequests: "24h"
oauth2:
responseTypes: [ "code" ]
alwaysShowLoginScreen: false
skipApprovalScreen: true
connectors:
- type: mockCallback
id: approved
name: AlwaysApprovesOIDCProvider
staticClients:
- id: fulcio
public: true
name: 'Fulcio in Docker Compose'
# Dex's issuer URL + "/callback"
redirectURI: http://dex-idp:8888/auth/callback
+54
View File
@@ -0,0 +1,54 @@
#!/bin/bash
#
# Copyright 2021 The Sigstore Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
function get_log_id() {
curl -s --retry-connrefused --retry 10 http://trillian-log-server:8095/metrics |grep "^quota_acquired_tokens{spec=\"trees"|head -1|awk ' { print $1 } '|sed -e 's/[^0-9]*//g' > /tmp/logid
}
function get_ephemeral_ca() {
curl -s --retry-connrefused --retry 10 http://fulcio-server:5555/api/v1/rootCert > /etc/config/root.pem
}
function create_log () {
/go/bin/createtree -admin_server trillian-log-server:8096 > /tmp/logid
echo -n "Created log ID " && cat /tmp/logid
}
function update_config() {
cat /root/ctfe/ct_server.cfg | sed -e "s/%LOGID%/"`cat /tmp/logid`"/g" > /etc/config/ct_server.cfg
cp /root/ctfe/*.pem /etc/config/
}
# check to see if log id exists; if so, use that
echo -n "Checking for existing configuration..."
echo "Checking for preexisting logs..."
get_log_id
# else create one
if ! [[ -s /tmp/logid ]]; then
echo "No log found; let's create one..."
create_log
fi
echo "Updating config with current log"
update_config
configid=`cat /etc/config/ct_server.cfg|grep log_id|awk ' { print $2 } '`
echo "Exisiting configuration uses log ID $configid, exiting"
echo "Grabing fulcio root pem file"
get_ephemeral_ca
echo "Finished ct_server configuration"
@@ -0,0 +1,48 @@
#
# Copyright 2021 The Sigstore Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
issuer: http://dex-idp:8888/auth
storage:
type: memory
web:
http: 0.0.0.0:8888
frontend:
issuer: Fulcio in Docker Compose
expiry:
signingKeys: "24h"
idTokens: "1m"
authRequests: "24h"
oauth2:
responseTypes: [ "code" ]
alwaysShowLoginScreen: true
skipApprovalScreen: true
connectors:
- type: mockCallback
id: https://any.valid.url/
name: AlwaysApprovesOIDCProvider
staticClients:
- id: fulcio
public: true
name: 'Fulcio in Docker Compose'
# Dex's issuer URL + "/callback"
redirectURI: http://dex-idp:8888/auth/callback
+116
View File
@@ -0,0 +1,116 @@
version: '3.2'
services:
fulcio-server:
image: fulcio_fulcio-server
command: [
"fulcio-server",
"serve",
"--host=0.0.0.0",
"--port=5555",
"--ca=ephemeralca",
"--ct-log-url=http://ct_server:6962/test",
]
restart: always # keep the server running
ports:
- "5555:5555"
volumes:
- ./config/config.json:/etc/fulcio-config/config.json:z
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5555/ping"]
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
depends_on:
- dex-idp
mysql:
image: gcr.io/trillian-opensource-ci/db_server:3c8193ebb2d7fedb44d18e9c810d0d2e4dbb7e4d
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=test
- MYSQL_USER=test
- MYSQL_PASSWORD=password
restart: always # keep the MySQL server running
healthcheck:
test: ["CMD", "/etc/init.d/mysql", "status"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
ctfe_init:
build:
context: .
dockerfile: Dockerfile.ctfe_init
depends_on:
- trillian-log-server
- fulcio-server
volumes:
- ctfeConfig:/etc/config/:rw
ct_server:
image: gcr.io/trillian-opensource-ci/ctfe
volumes:
- ctfeConfig:/etc/config/:rw
command: [
"--log_config" ,"/etc/config/ct_server.cfg",
"--log_rpc_server", "trillian-log-server:8096",
"--http_endpoint", "0.0.0.0:6962",
"--alsologtostderr",
]
restart: always # retry while ctfe_init is running
depends_on:
- trillian-log-server
- trillian-log-signer
- ctfe_init
ports:
- "6962:6962"
dex-idp:
image: dexidp/dex:v2.30.0
user: root
command: [
"dex",
"serve",
"/etc/config/docker-compose-config.yaml",
]
restart: always # keep the server running
ports:
- "8888:8888"
volumes:
- ./config/dex:/etc/config/:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8888/auth/healthz"]
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
trillian-log-server:
image: gcr.io/trillian-opensource-ci/log_server
command: [
"--storage_system=mysql",
"--mysql_uri=test:password@tcp(mysql:3306)/test",
"--rpc_endpoint=0.0.0.0:8096",
"--http_endpoint=0.0.0.0:8095",
"--alsologtostderr",
]
restart: always # retry while mysql is starting up
ports:
- "8096:8096"
- "8095:8095"
depends_on:
- mysql
trillian-log-signer:
image: gcr.io/trillian-opensource-ci/log_signer
command: [
"--storage_system=mysql",
"--mysql_uri=test:password@tcp(mysql:3306)/test",
"--rpc_endpoint=0.0.0.0:8095",
"--http_endpoint=0.0.0.0:8097",
"--force_master",
"--alsologtostderr",
]
restart: always # retry while mysql is starting up
ports:
- "8097:8097"
depends_on:
- mysql
volumes:
ctfeConfig: {}