Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 97 additions & 54 deletions .github/workflows/clp-artifact-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ concurrency:
jobs:
filter-relevant-changes:
name: "filter-relevant-changes"
runs-on: &runner >-
${{
github.repository_owner == 'y-scope'
&& fromJSON('["self-hosted", "x64", "ubuntu-noble"]')
|| 'ubuntu-24.04'
}}
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
outputs:
centos_stream_9_image_changed: "${{steps.filter.outputs.centos_stream_9_image}}"
manylinux_2_28_image_changed: "${{steps.filter.outputs.manylinux_2_28_image}}"
Expand Down Expand Up @@ -124,7 +120,8 @@ jobs:
name: "centos-stream-9-deps-image"
if: "needs.filter-relevant-changes.outputs.centos_stream_9_image_changed == 'true'"
needs: "filter-relevant-changes"
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down Expand Up @@ -155,9 +152,11 @@ jobs:
matrix:
include:
- arch: "amd64"
runner: *runner
runner: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
- arch: "arm64"
runner: "ubuntu-24.04-arm"
runner: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_LIGHT_ARM64 || '["ubuntu-24.04-arm"]') }}
runs-on: "${{matrix.runner}}"
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
Expand Down Expand Up @@ -193,7 +192,8 @@ jobs:
&& needs.manylinux_2_28-deps-image.result == 'success'
needs:
- "manylinux_2_28-deps-image"
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- name: "Login to Image Registry"
uses: "docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121" # v4.1.0
Expand Down Expand Up @@ -230,7 +230,8 @@ jobs:
&& needs.musllinux_1_2-deps-image.result == 'success'
needs:
- "musllinux_1_2-deps-image"
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- name: "Login to Image Registry"
uses: "docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121" # v4.1.0
Expand Down Expand Up @@ -264,9 +265,11 @@ jobs:
matrix:
include:
- arch: "amd64"
runner: *runner
runner: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
- arch: "arm64"
runner: "ubuntu-24.04-arm"
runner: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_LIGHT_ARM64 || '["ubuntu-24.04-arm"]') }}
runs-on: "${{matrix.runner}}"
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
Expand Down Expand Up @@ -294,7 +297,8 @@ jobs:
name: "ubuntu-jammy-x86_64-deps-image"
if: "needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'true'"
needs: "filter-relevant-changes"
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down Expand Up @@ -323,7 +327,8 @@ jobs:
&& github.event_name != 'pull_request'
&& github.ref == 'refs/heads/main'
needs: "filter-relevant-changes"
runs-on: "ubuntu-24.04-arm"
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_LIGHT_ARM64 || '["ubuntu-24.04-arm"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down Expand Up @@ -358,7 +363,8 @@ jobs:
use_shared_libs: [true, false]
name: "centos-stream-9-${{matrix.use_shared_libs == true && 'dynamic' || 'static'}}-linked-bins"
continue-on-error: true
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down Expand Up @@ -402,7 +408,8 @@ jobs:
name: >-
manylinux_2_28-x86_64-${{matrix.use_shared_libs == true && 'dynamic' || 'static'}}-linked-bins
continue-on-error: true
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down Expand Up @@ -445,7 +452,8 @@ jobs:
OS_NAME: "manylinux_2_28"
name: "manylinux_2_28-x86_64-python-wheels"
continue-on-error: true
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down Expand Up @@ -503,7 +511,8 @@ jobs:
name: >-
musllinux_1_2-x86_64-${{matrix.use_shared_libs == true && 'dynamic' || 'static'}}-linked-bins
continue-on-error: true
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down Expand Up @@ -553,7 +562,8 @@ jobs:
OS_NAME: "ubuntu-jammy"
name: "ubuntu-jammy-${{matrix.use_shared_libs == true && 'dynamic' || 'static'}}-linked-bins"
continue-on-error: true
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down Expand Up @@ -601,7 +611,8 @@ jobs:
# Run if the ancestor jobs were successful/skipped and building clp was successful.
if: "!cancelled() && !failure() && needs.ubuntu-jammy-binaries.result == 'success'"
needs: "ubuntu-jammy-binaries"
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
env:
OS_NAME: "ubuntu-jammy"
TMP_OUTPUT_DIR: "/tmp"
Expand Down Expand Up @@ -668,7 +679,8 @@ jobs:
needs:
- "filter-relevant-changes"
- "ubuntu-jammy-x86_64-deps-image"
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down Expand Up @@ -737,7 +749,8 @@ jobs:

ubuntu-jammy-integration-tests-core:
needs: "ubuntu-jammy-binaries"
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
Comment on lines 750 to +753

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Set explicit least-privilege permissions for the new jobs.

These jobs inherit the repository-default GITHUB_TOKEN scope. Set contents: "read" for ubuntu-jammy-integration-tests-core. Set contents: "read" and packages: "write" for package-image-amd64, because its trusted main path publishes to GHCR.

  • .github/workflows/clp-artifact-build.yaml#L750-L753: add permissions: { contents: "read" }.
  • .github/workflows/clp-artifact-build.yaml#L799-L810: add permissions with contents: "read" and packages: "write".
Proposed fix
   ubuntu-jammy-integration-tests-core:
+    permissions:
+      contents: "read"
     needs: "ubuntu-jammy-binaries"

   package-image-amd64:
+    permissions:
+      contents: "read"
+      packages: "write"
     name: "package-image-amd64"

Based on learnings, GitHub Actions workflows should grant only the permissions required by each job.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ubuntu-jammy-integration-tests-core:
needs: "ubuntu-jammy-binaries"
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
ubuntu-jammy-integration-tests-core:
permissions:
contents: "read"
needs: "ubuntu-jammy-binaries"
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
package-image-amd64:
permissions:
contents: "read"
packages: "write"
name: "package-image-amd64"
if: >-
!cancelled() && !failure() && (
needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false'
|| needs.ubuntu-jammy-x86_64-deps-image.result == 'success'
)
needs:
- "filter-relevant-changes"
- "ubuntu-jammy-x86_64-deps-image"
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
🧰 Tools
🪛 zizmor (1.29.0)

[warning] 750-797: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[info] 750-750: workflow or action definition without a name (anonymous-definition): this job

(anonymous-definition)

📍 Affects 1 file
  • .github/workflows/clp-artifact-build.yaml#L750-L753 (this comment)
  • .github/workflows/clp-artifact-build.yaml#L799-L810
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/clp-artifact-build.yaml around lines 750 - 753, Add
job-level permissions to ubuntu-jammy-integration-tests-core at
.github/workflows/clp-artifact-build.yaml:750-753, granting only contents:
"read". Also update package-image-amd64 at
.github/workflows/clp-artifact-build.yaml:799-810 with contents: "read" and
packages: "write" permissions for GHCR publishing.

Sources: Learnings, Linters/SAST tools

env:
OS_NAME: "ubuntu-jammy"
BUILD_DIR: "build"
Expand Down Expand Up @@ -783,36 +796,64 @@ jobs:
path: "${{env.BUILD_DIR}}/integration_tests/test_logs"
retention-days: 3

package-image:
name: "package-image-${{matrix.arch}}"
# NOTE: The aarch64 job is skipped on PRs, so we accept both 'success' and 'skipped'.
package-image-amd64:
name: "package-image-amd64"
if: >-
!cancelled() && !failure() && (
needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false' ||
(needs.ubuntu-jammy-x86_64-deps-image.result == 'success'
&& (needs.ubuntu-jammy-aarch64-deps-image.result == 'success'
|| needs.ubuntu-jammy-aarch64-deps-image.result == 'skipped'))
needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false'
|| needs.ubuntu-jammy-x86_64-deps-image.result == 'success'
)
needs:
- "filter-relevant-changes"
- "ubuntu-jammy-x86_64-deps-image"
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
submodules: "recursive"

- name: "Workaround actions/runner-images/issues/6775"
shell: "bash"
run: "chown $(id -u):$(id -g) -R ."

- name: "Build the package without the package image"
uses: "./.github/actions/run-on-image"
env:
OS_NAME: "ubuntu-jammy"
with:
image_name: "${{format('{0}ubuntu-jammy', env.DEPS_IMAGE_NAME_PREFIX_X86)}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
run_command: >-
CLP_CPP_MAX_PARALLELISM_PER_BUILD_TASK=$(getconf _NPROCESSORS_ONLN)
HOME=/tmp
task package-build-deps

- uses: "./.github/actions/clp-build-runtime-image"
with:
image_registry: "ghcr.io"
image_registry_username: "${{github.actor}}"
image_registry_password: "${{secrets.GITHUB_TOKEN}}"
arch: "amd64"
platform_version_codename: "jammy"
Comment thread
coderabbitai[bot] marked this conversation as resolved.

package-image-arm64:
name: "package-image-arm64"
# Only build arm64 images on push to main to save CI resources on PRs.
if: >-
!cancelled() && !failure()
&& github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
Comment thread
jackluo923 marked this conversation as resolved.
&& (
needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false'
|| needs.ubuntu-jammy-aarch64-deps-image.result == 'success'
)
needs:
- "filter-relevant-changes"
- "ubuntu-jammy-aarch64-deps-image"
strategy:
matrix:
# Only build arm64 images on push to main to save CI resources on PRs.
arch: >-
${{github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
&& fromJSON('["amd64", "arm64"]') || fromJSON('["amd64"]')}}
runs-on: >-
${{
matrix.arch == 'amd64'
&& (github.repository_owner == 'y-scope'
&& fromJSON('["self-hosted", "x64", "ubuntu-noble"]')
|| 'ubuntu-24.04')
|| (github.repository_owner == 'y-scope'
&& fromJSON('["self-hosted", "arm64", "ubuntu-noble"]')
|| 'ubuntu-24.04-arm')
}}
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_ARM64 || '["ubuntu-24.04-arm"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand All @@ -827,10 +868,7 @@ jobs:
env:
OS_NAME: "ubuntu-jammy"
with:
image_name: >-
${{format('{0}ubuntu-jammy',
matrix.arch == 'amd64' && env.DEPS_IMAGE_NAME_PREFIX_X86
|| env.DEPS_IMAGE_NAME_PREFIX_AARCH64)}}
image_name: "${{format('{0}ubuntu-jammy', env.DEPS_IMAGE_NAME_PREFIX_AARCH64)}}"
use_published_image: >-
${{needs.filter-relevant-changes.outputs.ubuntu_jammy_image_changed == 'false'
|| (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')}}
Expand All @@ -844,17 +882,21 @@ jobs:
image_registry: "ghcr.io"
image_registry_username: "${{github.actor}}"
image_registry_password: "${{secrets.GITHUB_TOKEN}}"
arch: "${{matrix.arch}}"
arch: "arm64"
platform_version_codename: "jammy"

package-image-multiarch-manifest:
name: "package-image-multiarch-manifest"
if: >-
github.event_name != 'pull_request'
&& github.ref == 'refs/heads/main'
&& needs.package-image.result == 'success'
needs: "package-image"
runs-on: *runner
&& needs.package-image-amd64.result == 'success'
&& needs.package-image-arm64.result == 'success'
needs:
- "package-image-amd64"
- "package-image-arm64"
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- name: "Login to Image Registry"
uses: "docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121" # v4.1.0
Expand Down Expand Up @@ -896,7 +938,8 @@ jobs:
needs:
- "filter-relevant-changes"
- "ubuntu-jammy-x86_64-deps-image"
runs-on: *runner
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
permissions:
# To check out the repository.
contents: "read"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/clp-core-build-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ concurrency:
jobs:
build-macos:
name: "build-macos"
if: "vars.GH_DISABLE_MACOS != 'true'"
strategy:
matrix:
os:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/clp-docs-generated-code-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ concurrency:

jobs:
check-generated:
# Runs only on Ubuntu Jammy (22.04) since the Rust components are only built on this platform.
runs-on: "ubuntu-22.04"
# CPU-bound (cargo build --release codegen), so uses GH_RUNNER_LINUX_HEAVY_X64.
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_HEAVY_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/clp-docs-macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "clp-docs-macos"

on:
pull_request:
push:
schedule:
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
- cron: "15 0 * * *"
workflow_dispatch:

permissions: {}

concurrency:
group: "${{github.workflow}}-${{github.ref}}"
# Cancel in-progress jobs for efficiency
cancel-in-progress: true

jobs:
build-macos:
if: "vars.GH_DISABLE_MACOS != 'true'"
name: "build-macos"
runs-on: "macos-15"
permissions:
# To check out the repository.
contents: "read"
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
persist-credentials: false
lfs: "true"
submodules: "recursive"
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- uses: "./tools/yscope-dev-utils/exports/github/actions/install-python"

- uses: "./tools/yscope-dev-utils/exports/github/actions/install-go-task"
with:
version: "3.48.0"

- name: "Build docs"
shell: "bash"
run: "task docs:site"
9 changes: 2 additions & 7 deletions .github/workflows/clp-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ concurrency:
jobs:
build:
name: "build"
strategy:
matrix:
os:
- "macos-15"
- "ubuntu-24.04"
runs-on: "${{matrix.os}}"
runs-on: >-
${{ fromJSON(vars.GH_RUNNER_LINUX_LIGHT_X64 || '["ubuntu-24.04"]') }}
steps:
- uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
with:
Expand All @@ -42,7 +38,6 @@ jobs:
- if: >-
contains(fromJSON('["push", "workflow_dispatch"]'), github.event_name)
&& ('refs/heads/main' == github.ref || startsWith(github.ref, 'refs/tags/v'))
&& 'ubuntu-24.04' == matrix.os
uses: "actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02"
with:
name: "docs-html"
Expand Down
Loading
Loading