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

Script for timing large snapshot #2217

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
61 changes: 61 additions & 0 deletions hack/large-snapshot-times.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash
set -euo pipefail

SNAPSHOT=./large.yaml
PUBLIC_KEY=./key-rhel-osci.pub
POLICY_CONFIGURATION=github.com/enterprise-contract/config//redhat

#VERSIONS_TO_TEST=(
# v0.6.94
# v0.6.129
# v0.6.138
# v0.6.142
#)

#VERSIONS_TO_TEST=(v0.6.94)
VERSIONS_TO_TEST=(main)

#WORKERS=5
WORKERS=20

GOOS=$(go env GOOS)
GOARCH=$(go env GOARCH)
EC=./dist/ec_${GOOS}_${GOARCH}

TIME=/usr/bin/time
TIME_FORMAT='User CPU time: %U\nSystem CPU time: %S\nElapsed time: %e\nPeak memory usage: %M kb'

for ref in ${VERSIONS_TO_TEST[@]}; do
EC_REF=${EC}_${ref}

if [[ ! -x "$EC_REF" ]]; then
git reset --hard "${ref}"
make ${EC}
cp ${EC} ${EC_REF}
cp ${EC}.sha256 ${EC_REF}.sha256
fi

title="Ref ${ref}"
echo "$title"
echo "$title" | tr '[:print:]' '='

git log --format="Commit: %h %s%nDate: %cd" -n 1 ${ref}
echo "Started: $(date)"

${TIME} --format "${TIME_FORMAT}" \
${EC_REF} validate image \
--images large.yaml \
--public-key key-rhel-osci.pub \
--policy ${POLICY_CONFIGURATION} \
--ignore-rekor \
--output json=/dev/null \
--output yaml=/dev/null \
--show-successes \
--timeout 60m \
--workers ${WORKERS} \
--info \
2>&1 | tee "out-$ref.log"

echo ""

done
Loading