Skip to content

Commit da110a9

Browse files
greatgitsbympurnell1
authored andcommitted
Revert CI images in GitHub (#101)
* Revert "use versioned branch names for release images (#93)" This reverts commit a4842a7. * Revert "ci: push release images to branch instead of GitHub release (#90)" This reverts commit c937d27.
1 parent 3feabe2 commit da110a9

2 files changed

Lines changed: 56 additions & 80 deletions

File tree

.github/workflows/build.yml

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,48 @@ jobs:
6464
build/rootfs-profile.md
6565
if-no-files-found: error
6666

67+
- name: download master baseline
68+
if: github.event_name == 'pull_request'
69+
env:
70+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
run: |
72+
mkdir -p baseline
73+
RUN_ID=$(gh run list --workflow=build.yml --branch=master \
74+
--status=success --limit=1 --json databaseId --jq '.[0].databaseId')
75+
if [ -n "$RUN_ID" ]; then
76+
gh run download "$RUN_ID" --name rootfs-profile --dir baseline/ || true
77+
fi
78+
79+
- name: post PR comment
80+
if: github.event_name == 'pull_request'
81+
env:
82+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
run: |
84+
# Generate diff (gracefully handles missing baseline)
85+
DIFF_MD=$(./vamos profile diff baseline/rootfs-profile.json build/rootfs-profile.json 2>/dev/null || echo "No baseline available")
86+
PROFILE_MD=$(cat build/rootfs-profile.md)
87+
88+
# Assemble comment with hidden marker for find-and-update
89+
printf -v COMMENT_BODY '%s\n%s\n\n%s\n%s\n\n---\n\n%s' \
90+
'<!-- rootfs-profile-bot -->' \
91+
'## vamOS System Profile' \
92+
'### Changes vs master' \
93+
"$DIFF_MD" \
94+
"$PROFILE_MD"
95+
96+
# Find existing comment by marker
97+
COMMENT_ID=$(gh api \
98+
"repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \
99+
--jq '.[] | select(.body | contains("<!-- rootfs-profile-bot -->")) | .id' \
100+
| head -1)
101+
102+
if [ -n "$COMMENT_ID" ]; then
103+
gh api "repos/${{ github.repository }}/issues/comments/$COMMENT_ID" \
104+
-X PATCH -f body="$COMMENT_BODY"
105+
else
106+
gh pr comment "${{ github.event.pull_request.number }}" --body "$COMMENT_BODY"
107+
fi
108+
67109
release:
68110
if: github.event_name == 'push'
69111
needs: [build-kernel, build-system]
@@ -87,48 +129,16 @@ jobs:
87129
name: system.erofs.img
88130
path: build/
89131

90-
- name: check deploy key
91-
id: check-key
92-
run: |
93-
if [ -n "${{ secrets.VAMOS_IMAGES_DEPLOY_KEY }}" ]; then
94-
echo "has_key=true" >> $GITHUB_OUTPUT
95-
else
96-
echo "has_key=false" >> $GITHUB_OUTPUT
97-
echo "::warning::VAMOS_IMAGES_DEPLOY_KEY secret is not set — skipping image publish and release."
98-
fi
99-
100132
- name: generate manifest
101-
if: steps.check-key.outputs.has_key == 'true'
133+
env:
134+
RELEASE_URL: https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}
102135
run: |
103136
VERSION=$(cat userspace/root/VERSION)
104137
echo "VERSION=$VERSION" >> $GITHUB_ENV
105-
IMAGES_URL="https://github.com/${{ github.repository_owner }}/vamos-images/raw/v${VERSION}"
106-
IMAGES_URL=$IMAGES_URL python3 tools/build/package_ota.py
107-
108-
- name: push images to vamos-images
109-
if: steps.check-key.outputs.has_key == 'true'
110-
uses: actions/checkout@v4
111-
with:
112-
repository: ${{ github.repository_owner }}/vamos-images
113-
ssh-key: ${{ secrets.VAMOS_IMAGES_DEPLOY_KEY }}
114-
path: vamos-images
115-
116-
- name: commit and tag images
117-
if: steps.check-key.outputs.has_key == 'true'
118-
run: |
119-
TAG="v${VERSION}"
120-
cd vamos-images
121-
git checkout --orphan release
122-
cp ../build/ota/*.img* .
123-
cp ../build/ota/manifest.json .
124-
git add .
125-
git -c user.name="github-actions" -c user.email="actions@github.com" \
126-
commit -m "release images for $TAG"
127-
git tag "$TAG"
128-
git push origin "refs/tags/$TAG" --force
138+
RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}"
139+
RELEASE_URL=$RELEASE_URL python3 tools/build/package_ota.py
129140
130141
- name: create release
131-
if: steps.check-key.outputs.has_key == 'true'
132142
env:
133143
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134144
run: |
@@ -139,22 +149,10 @@ jobs:
139149
git tag -d "$TAG" 2>/dev/null || true
140150
git push origin ":refs/tags/$TAG" 2>/dev/null || true
141151
142-
MANIFEST_URL="https://github.com/${{ github.repository_owner }}/vamos-images/raw/${TAG}/manifest.json"
143-
144-
# Create release linking to manifest
145-
NOTES="Automated release from commit ${{ github.sha }}
146-
147-
Manifest: ${MANIFEST_URL}"
152+
# Create release with all images and manifest
148153
gh release create "$TAG" \
149154
--title "vamOS $TAG" \
150155
--target "${{ github.sha }}" \
151-
--notes "$NOTES"
152-
153-
- name: post setup instructions
154-
if: steps.check-key.outputs.has_key == 'false'
155-
run: |
156-
echo "::warning::VAMOS_IMAGES_DEPLOY_KEY is not configured. To enable image publishing:"
157-
echo "::warning::1. Create a ${{ github.repository_owner }}/vamos-images repo"
158-
echo "::warning::2. Generate an SSH deploy key: ssh-keygen -t ed25519 -f vamos-images-deploy-key -N \"\""
159-
echo "::warning::3. Add the public key to ${{ github.repository_owner }}/vamos-images as a deploy key with write access"
160-
echo "::warning::4. Add the private key as VAMOS_IMAGES_DEPLOY_KEY secret in ${{ github.repository }}"
156+
--notes "Automated release from commit ${{ github.sha }}" \
157+
build/ota/*.img \
158+
build/ota/manifest.json

tools/build/package_ota.py

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
OTA_OUTPUT_DIR = OUTPUT_DIR / "ota"
1313

1414
SECTOR_SIZE = 4096
15-
CHUNK_SIZE = 52_428_800 # 50 MB - must be under raw.githubusercontent.com's 100 MB limit
1615

17-
VERSION = open(ROOT / "userspace" / "root" / "VERSION").read().strip()
18-
IMAGES_URL = os.environ.get("IMAGES_URL", f"https://github.com/commaai/vamos-images/raw/v{VERSION}")
16+
RELEASE_URL = os.environ.get("RELEASE_URL", "https://github.com/commaai/vamos/releases/download/untagged")
1917

2018
GPT = namedtuple('GPT', ['lun', 'name', 'path', 'start_sector', 'num_sectors', 'has_ab', 'full_check'])
2119
GPTS = [
@@ -75,30 +73,14 @@ def process_file(entry):
7573
sha256.update(b'\x00' * ((SECTOR_SIZE - (size % SECTOR_SIZE)) % SECTOR_SIZE))
7674
ondevice_hash = sha256.hexdigest()
7775

78-
base_name = f"{entry.name}-{hash_raw}.img"
79-
80-
# Write file(s) to output directory, splitting into chunks if needed
81-
chunks = None
82-
if size > CHUNK_SIZE:
83-
chunks = []
84-
chunk_idx = 0
85-
with open(entry.path, 'rb') as f:
86-
while True:
87-
data = f.read(CHUNK_SIZE)
88-
if not data:
89-
break
90-
chunk_name = f"{base_name}.{chunk_idx:02d}"
91-
(OTA_OUTPUT_DIR / chunk_name).write_bytes(data)
92-
chunks.append({"url": f"{IMAGES_URL}/{chunk_name}", "size": len(data)})
93-
print(f" chunk {chunk_idx}: {chunk_name} ({len(data)} bytes)")
94-
chunk_idx += 1
95-
else:
96-
print(f" copying to {base_name}")
97-
shutil.copy(entry.path, OTA_OUTPUT_DIR / base_name)
76+
# Copy to output directory
77+
out_fn = OTA_OUTPUT_DIR / f"{entry.name}-{hash_raw}.img"
78+
print(f" copying to {out_fn.name}")
79+
shutil.copy(entry.path, out_fn)
9880

9981
ret = {
10082
"name": entry.name,
101-
"url": f"{IMAGES_URL}/{base_name}",
83+
"url": f"{RELEASE_URL}/{out_fn.name}",
10284
"hash": hash,
10385
"hash_raw": hash_raw,
10486
"size": size,
@@ -108,10 +90,6 @@ def process_file(entry):
10890
"ondevice_hash": ondevice_hash,
10991
}
11092

111-
if chunks:
112-
ret["url"] = ""
113-
ret["chunks"] = chunks
114-
11593
if isinstance(entry, GPT):
11694
ret["gpt"] = {
11795
"lun": entry.lun,

0 commit comments

Comments
 (0)