Skip to content

Conversation

@hwakabh
Copy link
Owner

@hwakabh hwakabh commented Sep 19, 2025

Issue/PR link

N/A

What does this PR do?

Describe what changes you make in your branch:

  • ci: scaled in default minimal instance number. (a784a7e)
  • ci: added pr-commit-body-action. (a35b475)
  • chore: updated diagrams. (62210de)
  • chore: added blocks to PR templates for pr-commit-body-sync. (d385710)

(Optional) Additional Contexts

Describe additional information for reviewers (i.e. What does not included)
N/A

Summary by CodeRabbit

  • Chores
    • Updated the pull request template to include clear markers for commit sections.
    • Adjusted backend deployment to run with a lower minimum number of instances (1) for improved efficiency.
    • Added an automated workflow that syncs commit diffs/messages into pull request descriptions for better visibility and review.

@coderabbitai
Copy link

coderabbitai bot commented Sep 19, 2025

Walkthrough

Introduces PR commit markers in the pull request template, adjusts Cloud Run deploy flag from service-min-instances=3 to 1 in backend workflow, and adds a new workflow to sync commit diffs into PR bodies using technote-space/pr-commit-body-action@v1.

Changes

Cohort / File(s) Change Summary
PR template markers
\.github/PULL_REQUEST_TEMPLATE.md
Inserted HTML comment markers and after the change description prompt to delimit a PR commits section.
Backend workflow tweak
.github/workflows/backend.yaml
Updated Cloud Run deploy step to use --service-min-instances=1 instead of 3; no other workflow logic changed.
New PR sync workflow
.github/workflows/sync-commit-diffs.yaml
Added a workflow triggered on pull_request and workflow_dispatch to sync commit messages into PR body; uses actions/checkout@v5 and technote-space/pr-commit-body-action@v1 on ubuntu-24.04.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

enhancement, chore

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "ci: Cloud Run tunings and pipeline enhancement" concisely summarizes the PR's main intent—adjusting Cloud Run minimal instances and adding a PR commit-body workflow—as shown in the commits and PR objectives. It is short, CI-focused, and avoids unnecessary file lists or vague wording. A reviewer scanning the history will understand the primary changes from the title alone.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/min-scale-number

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added docs Improvements or additions to documentation ci Topics on workflows or automations deploy Features depending on application runtimes labels Sep 19, 2025
@hwakabh hwakabh changed the title Ci/min scale number ci: Cloud Run tunings and pipeline enhancement Sep 19, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
.github/workflows/sync-commit-diffs.yaml (1)

21-21: Pin 3rd‑party action to a commit SHA (supply-chain hardening).

v1 is mutable; pin to a specific SHA to prevent supply‑chain drift. This mirrors the security bot’s note.

Apply (replace with actual commit SHA):

-        uses: technote-space/pr-commit-body-action@v1
+        uses: technote-space/pr-commit-body-action@<commit-sha>

Retrieve the latest SHA for the v1 branch/tag:

#!/bin/bash
# Get the latest commit SHA for the v1 ref
gh api repos/technote-space/pr-commit-body-action/commits --jq 'map(select(.commit.message | test("Merge|release|bump")|not)) | .[0].sha' -f sha=v1
🧹 Nitpick comments (2)
.github/workflows/backend.yaml (1)

67-71: Scaling trade-off check (cold starts vs. cost).

Min instances = 1 reduces cost vs. 3 but still prevents scale-to-zero. Confirm this aligns with SLOs; if acceptable to allow cold starts, consider 0.

.github/workflows/sync-commit-diffs.yaml (1)

3-6: Add concurrency to avoid PR body race updates.

Prevents overlapping runs from reordering or clobbering the PR body.

Apply near the top level:

 name: Sync commit diff to PRs
 
 on:
   pull_request:
   workflow_dispatch:
 
+concurrency:
+  group: pr-commit-body-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 897c0ad and d385710.

⛔ Files ignored due to path filters (1)
  • app-diagram.drawio.svg is excluded by !**/*.svg
📒 Files selected for processing (3)
  • .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
  • .github/workflows/backend.yaml (1 hunks)
  • .github/workflows/sync-commit-diffs.yaml (1 hunks)
🔇 Additional comments (3)
.github/PULL_REQUEST_TEMPLATE.md (1)

8-9: Confirm markers match the action’s expected placeholders.

Ensure technote-space/pr-commit-body-action targets and replaces content between these exact markers; if not, set its inputs accordingly.

.github/workflows/sync-commit-diffs.yaml (1)

7-10: Fork PR behavior: verify write permissions.

Editing PR bodies on forked PRs often lacks write perms even with pull-requests: write. Confirm you only need this for same-repo PRs or gate by repository_owner == sender.login.

.github/workflows/backend.yaml (1)

67-67: Use the correct Cloud Run flag: --min (service-level) or --min-instances (revision-level).

gcloud run deploy accepts --min for service-level minimum instances and --min-instances for revision-level; --service-min-instances is not the documented deploy flag and appears only in some alpha/multi-region subcommands. (cloud.google.com)

  • If you intend a service-level minimum, change to: flags: '--min=1'
  • If you intend a revision-level minimum, change to: flags: '--min-instances=1'

Location: .github/workflows/backend.yaml (line 67)

Likely an incorrect or invalid review comment.

@hwakabh hwakabh merged commit 8adf94b into main Sep 19, 2025
8 checks passed
@hwakabh hwakabh deleted the ci/min-scale-number branch September 19, 2025 19:24
@hwakabh
Copy link
Owner Author

hwakabh commented Sep 22, 2025

As the CI for applying this PR had not been triggered since no files changed in ./api-server/ directory, manually triggered the CI from GitHub UI.
https://github.com/hwakabh/hwakabh.github.io/actions/runs/17902098065

@hwakabh
Copy link
Owner Author

hwakabh commented Sep 22, 2025

Also, as Cloud Run has several options on minimal instances: --service-min-instances & --min-instances.
In workflow configurations, we defined as --service-min-instances=3 in this PR, but this still create 3 replicas unless the parameter --min-instances=3 removed.

Regarding the option for revision-level minimal instances, we manually updated with gcloud command:

25-09-22 10:46:36 git/hwakabh.github.io [main] % gcloud run services update gh-pages-api-server --region=us-central1 --min-instances=1
✓ Deploying... Done.                                                                                                                                                                                               
  ✓ Creating Revision...                                                                                                                                                                                           
  ✓ Routing traffic...                                                                                                                                                                                             
Done.                                                                                                                                                                                                              
Service [gh-pages-api-server] revision [gh-pages-api-server-00108-5rs] has been deployed and is serving 100 percent of traffic.
Service URL: https://gh-pages-api-server-1037550336239.us-central1.run.app

# Check
25-09-22 10:47:08 git/hwakabh.github.io [main] % gcloud run services describe gh-pages-api-server --region=us-central1                
✔ Service gh-pages-api-server in region us-central1
commit-sha:ff862e653d01be44420e7162ddfd80d42b72fd74 managed-by:github-actions
 
URL:     https://gh-pages-api-server-1037550336239.us-central1.run.app
Ingress: all
Traffic:
  100% LATEST (currently gh-pages-api-server-00108-5rs)
 
Service-level Min Instances: 1
 
Last updated on 2025-09-22T01:47:04.826226Z by hrykwkbys1024@gmail.com:
  Revision gh-pages-api-server-00108-5rs
  commit-sha:ff862e653d01be44420e7162ddfd80d42b72fd74 managed-by:github-actions
  Container api-1
    Image:           us-central1-docker.pkg.dev/hwakabh-dev/ghcr/hwakabh/gh-pages-api:latest
    Port:            8080
    Memory:          512Mi
    CPU:             1000m
    Env vars:
      MAIL_API_KEY   *****
      TUMBLR_CONSUMER_KEY *****
    Startup Probe:
      TCP every 240s
      Port:          8080
      Initial delay: 0s
      Timeout:       240s
      Failure threshold: 1
      Type:          Default
  Service account:   1037550336239-compute@developer.gserviceaccount.com
  Concurrency:       80
  Min Instances:     1
  Max Instances:     100
  Timeout:           300s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Topics on workflows or automations deploy Features depending on application runtimes docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants