fix: resolve CI failures from release-metadata PR feedback#233
fix: resolve CI failures from release-metadata PR feedback#233sfreeman422 merged 6 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Moonbeam “release” Slack messaging by attaching a release changelog and syncing the bot’s profile photo to the generated image, and adds build-time plumbing to generate and ship release metadata into the runtime container.
Changes:
- Add Slack
users.setPhotosupport and update Moonbeam redeploy flow to resize + upload the generated image as the bot profile photo. - Generate/read release metadata (from a file baked into the image, with git fallback) and include a short changelog in the deployment Slack blocks.
- Update Docker build + GitHub Actions to pass
PREVIOUS_RELEASE_SHAand ensure full git history is available for metadata generation.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates Docker build instructions and the “Available Scripts” listing to document the new build arg. |
| packages/backend/src/shared/services/web/web.service.ts | Adds setProfilePhoto() wrapper around Slack users.setPhoto. |
| packages/backend/src/ai/ai.service.ts | Adds release changelog generation, profile photo update via sharp, and refactors image disk writing to use buffers. |
| packages/backend/src/ai/ai.service.spec.ts | Updates redeploy test to assert changelog + profile photo update behavior. |
| packages/backend/scripts/write-release-metadata.js | New script that writes release-metadata.json from git history + env override. |
| packages/backend/package.json | Adds sharp dependency for image resizing. |
| packages/backend/Dockerfile | Generates release metadata during build and copies it into the final image. |
| package-lock.json | Locks new dependencies (sharp + transitive deps). |
| .github/workflows/deploy.yml | Ensures full checkout history and passes PREVIOUS_RELEASE_SHA into Docker build on deploy. |
| .github/workflows/ci.yml | Ensures full checkout history and passes PREVIOUS_RELEASE_SHA into Docker build in CI docker-build job. |
| .dockerignore | Stops ignoring .git so the Docker build can access git history. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | Command | Description | | ||
| | --------------------------------------------------------------------------------- | ------------------------------------ | -------------------------------------------------- | ------------------------------ | |
There was a problem hiding this comment.
The "Available Scripts" table markdown is malformed: the header row defines 2 columns, but the separator line has additional | ... | segments, which will break rendering. Update the separator line to match the actual column count (2), or split this section into multiple tables.
| | `npm run test:backend` | Run tests for the backend only | | ||
| | `npm run lint` | Lint all packages | | ||
| | `npm run lint:fix` | Lint and auto-fix issues | | ||
| | `docker build --build-arg PREVIOUS_RELEASE_SHA="$(git rev-parse HEAD^ 2>/dev/null | | true)" -f packages/backend/Dockerfile -t muzzle .` | Build the backend Docker image | |
There was a problem hiding this comment.
This table row contains literal | characters inside the shell command, which Markdown interprets as column separators. Escape the pipes (e.g., \|), or move the docker build example out of the table into a fenced code block so the command is not corrupted when rendered.
| const [imageBytes, quote, changelog] = results; | ||
| const [imageUrl] = await Promise.all([ | ||
| this.writeImageBufferToDiskAndReturnUrl(imageBytes), | ||
| this.updateMoonbeamProfilePhoto(imageBytes), |
There was a problem hiding this comment.
redeployMoonbeam awaits updateMoonbeamProfilePhoto in the same Promise.all as writing the image to disk. If the profile-photo update fails (Slack permission/token issues, sharp errors), the whole redeploy flow will skip sending the deployment message and only log the error. Consider making the profile-photo update best-effort (catch/log its failure) so the release message + image still get posted.
| this.updateMoonbeamProfilePhoto(imageBytes), | |
| this.updateMoonbeamProfilePhoto(imageBytes).catch((error) => { | |
| logError(this.aiServiceLogger, 'Failed to update Moonbeam profile photo during redeploy', error); | |
| }), |
| } catch { | ||
| continue; |
There was a problem hiding this comment.
readReleaseMetadataFromDisk swallows all read/parse errors silently. If release-metadata.json exists but is malformed, this will fail over to readReleaseMetadataFromGit() (which may not work in distroless) and you end up with an unavailable changelog with no diagnostic trail. Consider only ignoring ENOENT and logging JSON parse/other IO errors at least once (or at debug level) for easier troubleshooting.
| } catch { | |
| continue; | |
| } catch (error) { | |
| if ((error as NodeJS.ErrnoException).code === 'ENOENT') { | |
| continue; | |
| } | |
| logger.debug('Failed to read release metadata from disk', { | |
| candidatePath, | |
| error, | |
| }); |
| !.git | ||
| !.git/** |
There was a problem hiding this comment.
Including the entire .git directory in the Docker build context can significantly increase context upload time and invalidate caching frequently (large object packs change often). If the goal is only to generate release metadata, consider generating release-metadata.json outside the Docker build and copying it in, or otherwise avoid sending .git as part of the build context.
| !.git | |
| !.git/** |
| COPY package.json package-lock.json ./ | ||
| COPY tsconfig.base.json ./ | ||
| COPY .git ./.git | ||
| COPY packages/backend/package.json ./packages/backend/ | ||
| COPY packages/backend/scripts ./packages/backend/scripts |
There was a problem hiding this comment.
Copying .git into the build stage makes the build context and intermediate layers much larger and more cache-sensitive. Since the final image only needs release-metadata.json, consider producing that file outside the image build (CI step) and COPY it in, rather than copying the full Git history into the Docker build.
|
@copilot address all feedback |
…ndling, README table, and move git metadata generation out of Docker Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/6876c937-2062-4c4c-82c7-8d8b8cf882ae Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com>
All feedback addressed in commit
|
|
@copilot dont use the debug log level - please use info instead. debug is off by default in deployed state |
…ilures Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/1653283a-306b-499e-96a0-d672ef72a512 Co-authored-by: sfreeman422 <16405652+sfreeman422@users.noreply.github.com>
Changed to |
|
@copilot fix failing checks bruv |
…NOENT narrowing, Prettier formatting Agent-Logs-Url: https://github.com/dev-chat/mocker/sessions/b862833b-7f36-431d-bb98-ad866eb92ac9
Fixed in commit
|
Three CI jobs were failing after the release-metadata / Moonbeam redeploy feedback PR: the
docker-buildjob had norelease-metadata.jsontoCOPY, theno-restricted-syntaxlint rule rejected anascast in a non-spec file, and Prettier flaggedREADME.mdandai.service.ts.Changes
ci.yml— docker-build job: Addedactions/setup-node@v4+write-release-metadata.jspre-step beforedocker build, matchingdeploy.yml. Removed stale--build-arg PREVIOUS_RELEASE_SHA.ai.service.ts— ENOENT check: Replaced(error as NodeJS.ErrnoException).codewith explicit TypeScript narrowing to satisfy theno-restricted-syntaxrule banningasin non-spec files:README.mdandai.service.ts.