Skip to content

Commit e9d16c5

Browse files
committed
Script for timing large snapshot
Not sure if we wanna merge this, but I'll push a draft PR to share my hacky script. Somewhat on-topic for... Ref: https://issues.redhat.com/browse/EC-976
1 parent a2e1084 commit e9d16c5

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

hack/large-snapshot-times.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env bash
2+
# Copyright The Conforma Contributors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
set -euo pipefail
19+
20+
SNAPSHOT=./large.yaml
21+
PUBLIC_KEY=./key-rhel-osci.pub
22+
POLICY_CONFIGURATION=github.com/enterprise-contract/config//redhat
23+
24+
#VERSIONS_TO_TEST=(
25+
# v0.6.94
26+
# v0.6.129
27+
# v0.6.138
28+
# v0.6.142
29+
#)
30+
31+
#VERSIONS_TO_TEST=(v0.6.94)
32+
VERSIONS_TO_TEST=(main)
33+
34+
#WORKERS=5
35+
WORKERS=20
36+
37+
GOOS=$(go env GOOS)
38+
GOARCH=$(go env GOARCH)
39+
EC=./dist/ec_${GOOS}_${GOARCH}
40+
41+
TIME=/usr/bin/time
42+
TIME_FORMAT='User CPU time: %U\nSystem CPU time: %S\nElapsed time: %e\nPeak memory usage: %M kb'
43+
44+
for ref in ${VERSIONS_TO_TEST[@]}; do
45+
EC_REF=${EC}_${ref}
46+
47+
if [[ ! -x "$EC_REF" ]]; then
48+
git reset --hard "${ref}"
49+
make ${EC}
50+
cp ${EC} ${EC_REF}
51+
cp ${EC}.sha256 ${EC_REF}.sha256
52+
fi
53+
54+
title="Ref ${ref}"
55+
echo "$title"
56+
echo "$title" | tr '[:print:]' '='
57+
58+
git log --format="Commit: %h %s%nDate: %cd" -n 1 ${ref}
59+
echo "Started: $(date)"
60+
61+
${TIME} --format "${TIME_FORMAT}" \
62+
${EC_REF} validate image \
63+
--images large.yaml \
64+
--public-key key-rhel-osci.pub \
65+
--policy ${POLICY_CONFIGURATION} \
66+
--ignore-rekor \
67+
--output json=/dev/null \
68+
--output yaml=/dev/null \
69+
--show-successes \
70+
--timeout 60m \
71+
--workers ${WORKERS} \
72+
--info \
73+
2>&1 | tee "out-$ref.log"
74+
75+
echo ""
76+
77+
done

0 commit comments

Comments
 (0)