Skip to content

Commit a2c29a8

Browse files
committed
Add Prow CI scripts and configuration
Add CI scripts for OFCIR SSH-from-Pod pattern: - prow_setup.sh: machine setup (install deps, validate env) - prow_e2e.sh: E2E deployment (connected/disconnected) - prow_infra_verify.sh: infrastructure verification - prow_disconnected_dry_run.sh: mirror config validation - prow_cleanup.sh: periodic infrastructure cleanup Add OWNERS file for Prow review workflow. Add migration and OFCIR setup documentation.
1 parent c34c4d9 commit a2c29a8

3 files changed

Lines changed: 146 additions & 0 deletions

File tree

Makefile.ci

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ include Makefile
2222
.PHONY: validate validate-shell validate-yaml validate-json-schema validate-ansible \
2323
validate-tags validate-templates validate-mirror validate-makefile validate-plugins \
2424
build-ci-image push-ci-image test-ci-image build-push-ci-image \
25+
build-tarball build-push-tarball \
2526
deploy-cluster-pre-install-validate \
2627
environment provision-landing-zone verify-landing-zone \
2728
install-enclave verify-enclave-installation \
@@ -241,6 +242,16 @@ validate-makefile:
241242
validate-plugins:
242243
@./scripts/verification/validate.sh plugins
243244

245+
# --- Tarball targets ---
246+
247+
# Build distribution tarball (used by ci-operator container test)
248+
build-tarball:
249+
@./scripts/ci/build_tarball.sh build
250+
251+
# Build and push tarball to Quay (postsubmit)
252+
build-push-tarball:
253+
@./scripts/ci/build_tarball.sh build-push
254+
244255
# --- CI Image targets ---
245256

246257
build-ci-image:

OWNERS

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
approvers:
2+
- agonzalezrh
3+
- carbonin
4+
- danielerez
5+
- eliorerz
6+
- eurijon
7+
- javipolo
8+
- maorfr
9+
- mlorenzofr
10+
- rporres
11+
reviewers:
12+
- agonzalezrh
13+
- carbonin
14+
- danielerez
15+
- eliorerz
16+
- eurijon
17+
- javipolo
18+
- maorfr
19+
- mlorenzofr
20+
- rporres

scripts/ci/build_tarball.sh

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#!/usr/bin/env bash
2+
# Build and optionally push the enclave distribution tarball.
3+
#
4+
# Usage:
5+
# scripts/ci/build_tarball.sh build # Build and validate only
6+
# scripts/ci/build_tarball.sh build-push # Build, validate, and push to Quay
7+
8+
set -euo pipefail
9+
10+
ACTION="${1:-build}"
11+
12+
TAG="${TARBALL_TAG:-$(git rev-parse --short HEAD 2>/dev/null || echo dev)}"
13+
TARBALL="enclave.tar.gz"
14+
MAX_SIZE=1073741824 # 1GB
15+
16+
# --- Build ---
17+
18+
echo "Building distribution tarball..."
19+
echo -n "$TAG" > .version
20+
21+
tar --exclude='.git' --exclude='.gitignore' --exclude='.github' --exclude='scripts' \
22+
--exclude='Makefile.ci' \
23+
-czvf "/tmp/$TARBALL" .
24+
mv "/tmp/$TARBALL" .
25+
26+
echo ""
27+
echo "Validating tarball..."
28+
29+
# Check size
30+
SIZE=$(stat -c%s "$TARBALL")
31+
echo "Tarball size: $(numfmt --to=iec-i --suffix=B "$SIZE")"
32+
if [ "$SIZE" -gt "$MAX_SIZE" ]; then
33+
echo "Error: Tarball exceeds 1GB"
34+
exit 1
35+
fi
36+
37+
# Extract file list
38+
tar -tzf "$TARBALL" > /tmp/tarball-contents.txt
39+
40+
# Check required files
41+
REQUIRED_FILES=(".version" "Makefile")
42+
for file in "${REQUIRED_FILES[@]}"; do
43+
if ! grep -q "^\./${file}$" /tmp/tarball-contents.txt; then
44+
echo "Error: Required file '${file}' not found in tarball"
45+
head -20 /tmp/tarball-contents.txt
46+
exit 1
47+
fi
48+
echo " Found ${file}"
49+
done
50+
51+
# Check required directories (only if they exist in source)
52+
REQUIRED_DIRS=("playbooks" "operators" "configs")
53+
for dir in "${REQUIRED_DIRS[@]}"; do
54+
if [ -d "$dir" ]; then
55+
if ! grep -q "^\./${dir}/" /tmp/tarball-contents.txt; then
56+
echo "Error: Required directory '${dir}/' not found in tarball"
57+
head -20 /tmp/tarball-contents.txt
58+
exit 1
59+
fi
60+
echo " Found ${dir}/"
61+
fi
62+
done
63+
64+
# Check excluded paths are absent
65+
EXCLUDED_PATHS=(".git/" ".github/" "Makefile.ci")
66+
for path in "${EXCLUDED_PATHS[@]}"; do
67+
if grep -q "^\./${path}" /tmp/tarball-contents.txt; then
68+
echo "Error: Excluded path '${path}' found in tarball"
69+
exit 1
70+
fi
71+
echo " ${path} correctly excluded"
72+
done
73+
74+
# Validate file counts for critical directories
75+
echo "Validating file counts..."
76+
for dir in "${REQUIRED_DIRS[@]}"; do
77+
if [ -d "$dir" ]; then
78+
SOURCE_COUNT=$(find "$dir" -type f | wc -l)
79+
TARBALL_COUNT=$(grep "^\./${dir}/" /tmp/tarball-contents.txt | grep -v '/$' | wc -l)
80+
echo " ${dir}/: source=${SOURCE_COUNT}, tarball=${TARBALL_COUNT}"
81+
if [ "$SOURCE_COUNT" -ne "$TARBALL_COUNT" ]; then
82+
echo "Error: File count mismatch in ${dir}/"
83+
echo " Expected: ${SOURCE_COUNT} files"
84+
echo " Found in tarball: ${TARBALL_COUNT} files"
85+
exit 1
86+
fi
87+
fi
88+
done
89+
90+
echo "Tarball validation passed"
91+
rm -f .version
92+
93+
# --- Push (optional) ---
94+
95+
if [ "$ACTION" = "build-push" ]; then
96+
if [ -z "${QUAY_USER:-}" ] || [ -z "${QUAY_TOKEN:-}" ]; then
97+
echo "Error: QUAY_USER and QUAY_TOKEN must be set"
98+
exit 1
99+
fi
100+
101+
echo "$QUAY_TOKEN" | podman login quay.io -u "$QUAY_USER" --password-stdin
102+
103+
echo "Pushing tarball with tag: $TAG"
104+
oras push "quay.io/edge-infrastructure/enclave:${TAG}" \
105+
"${TARBALL}:application/vnd.oci.image.layer.v1.tar+gzip"
106+
107+
rm -f "$TARBALL"
108+
echo "Tarball pushed successfully"
109+
elif [ "$ACTION" = "build" ]; then
110+
echo "Tarball built: $TARBALL"
111+
else
112+
echo "Unknown action: $ACTION"
113+
echo "Usage: $0 build|build-push"
114+
exit 1
115+
fi

0 commit comments

Comments
 (0)