Skip to content
Draft
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
3 changes: 2 additions & 1 deletion .github/actions/test-and-upload-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ runs:
- name: Test image
if: ${{ inputs.multi-arch == 'false' && inputs.testing }}
run: |
nix run --fallback .#local-image-test ${{ inputs.image }}
# --impure is so we can pull in DOCKER_HOST for macs
nix run --fallback .#local-image-test ${{ inputs.image }} --impure
shell: bash -euo pipefail {0}

- name: Upload image
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/image-mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
name: Create nativelink-worker-lre-rs image for Mac
on:
push:
branches:
- main
pull_request:
paths-ignore:
- '.github/styles/**'
- 'web/**'

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
publish-image:
name: Publish nativelink-worker-lre-rs for Mac
runs-on: macos-26
permissions:
id-token: write
security-events: write
timeout-minutes: 90
steps:
- name: Checkout
uses: >- # v6.0.2
actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

- name: Prepare Worker
uses: ./.github/actions/prepare-nix
with:
nativelink_attic_token: ${{ secrets.NATIVELINK_ATTIC_TOKEN }}

- name: Set up Docker
id: docker
uses: >- # v5.2.0
docker/setup-docker-action@0234bb73ccb40f0c430b795634f9247e2b5c2d23
env:
# m1 chips, as seen in the GitHub CI, don't support nested hardware virtualization.
#
# We need `-machine virt` to stop Lima from providing `accel=hvf`due to this
# [QEMU issue](https://gitlab.com/qemu-project/qemu/-/issues/2981).
#
# We also need `-cpu *` to stop Lima from providing `-cpu host` as:
# 1) `-cpu host` requires `kvm` or `hvf` (which we don't have)
# 2) `-cpu host` implies `host-phys-bits=on` which is borked in this environment
# From which CPU to actually emulate, we choose what will be the most performant.
#
# We accomplish both of these goals with the methodology from
# [this comment](https://github.com/lima-vm/lima/pull/3173#issuecomment-2623130310).
QEMU_SYSTEM_AARCH64: "qemu-system-aarch64 -machine virt -cpu max,pmu=off,sve=on,sve128=on,sme=off,pauth=off"

- name: Set docker host
run: |
echo "DOCKER_HOST=${{steps.docker.outputs.sock}}" >> "$GITHUB_ENV"

- id: version
uses: ./.github/actions/generate-version

- name: Test and upload nativelink-worker-lre-rs
uses: ./.github/actions/test-and-upload-image
with:
image: nativelink-worker-lre-rs
multi-arch: false
tag: ${{ steps.version.outputs.version-string }}
GHCR_USERNAME: ${{ vars.GHCR_PUBLISH_USER }}
GHCR_PASSWORD: ${{ secrets.GHCR_PUBLISH_TOKEN }}

- name: Upload trivy scan results to GitHub Security tab
uses: >- # v4.36.2
github/codeql-action/upload-sarif@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
with:
sarif_file: 'trivy-results.sarif'
if: ${{ contains(fromJson('["refs/heads/main", "refs/pull/2457/merge"]'), github.ref) }}

- name: Teardown Worker
uses: ./.github/actions/end-nix
if: always()
with:
nativelink_attic_token: ${{ secrets.NATIVELINK_ATTIC_TOKEN }}
7 changes: 6 additions & 1 deletion tools/public/local-image-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ writeShellScriptBin "local-image-test" ''
# so we can run --debug on skopeo
# nix run .#$1.copyTo docker-daemon:''${IMAGE_TARGET}
nix build .#$1
${skopeo}/bin/skopeo --debug --insecure-policy copy nix:''${IMAGE} docker-daemon:''${IMAGE_TARGET}
EXTRA_ARGS=
if [[ -n ''${DOCKER_HOST:-} ]]; then
EXTRA_ARGS="--dest-daemon-host=''${DOCKER_HOST}"
fi
${skopeo}/bin/skopeo --debug --insecure-policy copy ''${EXTRA_ARGS} nix:''${IMAGE} docker-daemon:''${IMAGE_TARGET}
fi

# Ensure that the image has minimal closure size.
Expand All @@ -41,5 +45,6 @@ writeShellScriptBin "local-image-test" ''
# https://github.com/aquasecurity/trivy-action/issues/389
${trivy}/bin/trivy image \
''${IMAGE_TARGET} \
--timeout 15m \
--db-repository public.ecr.aws/aquasecurity/trivy-db:2
''
1 change: 1 addition & 0 deletions tools/public/trivy-report.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ writeShellScriptBin "trivy-report" ''
${trivy}/bin/trivy \
image \
--format sarif \
--timeout 15m \
$1 \
> trivy-results.sarif
else
Expand Down
4 changes: 3 additions & 1 deletion typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
conly = "conly"

[default]
# Old wrong spelling support
extend-ignore-re = [
# Old wrong spelling support
"alias = \"Cachable\"",
"old_unique_qualifier_cachable_works",
# Argument in .github/workflows/image.yaml
"sme=off",
]

[files]
Expand Down
Loading