Skip to content

Commit a48fd40

Browse files
committed
Merge remote-tracking branch 'origin/main' into samejr/castries
2 parents ea5e324 + 97e3f0a commit a48fd40

13 files changed

Lines changed: 214 additions & 15 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Dispatch RepoOps sync
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: dispatch-repo-ops-sync
13+
cancel-in-progress: false
14+
15+
jobs:
16+
dispatch:
17+
if: vars.REPO_OPS_SYNC_ENABLED == 'true'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Create Dispatcher App token
21+
id: app-token
22+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
23+
with:
24+
app-id: ${{ vars.REPO_OPS_DISPATCHER_APP_ID }}
25+
private-key: ${{ secrets.REPO_OPS_DISPATCHER_APP_PRIVATE_KEY }}
26+
repositories: ${{ secrets.REPO_OPS_MONO_REPOSITORY }}
27+
permission-contents: write
28+
29+
- name: Dispatch the private sync worker
30+
env:
31+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
32+
PUBLIC_SHA: ${{ github.sha }}
33+
MONO_REPOSITORY: ${{ secrets.REPO_OPS_MONO_REPOSITORY }}
34+
run: |
35+
set -euo pipefail
36+
[[ "$MONO_REPOSITORY" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]]
37+
[[ "$PUBLIC_SHA" =~ ^[0-9a-f]{40}$ ]]
38+
gh api "repos/${MONO_REPOSITORY}/dispatches" \
39+
--method POST \
40+
--field event_type=repo-ops-public-push \
41+
--field "client_payload[public_sha]=$PUBLIC_SHA"
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: repo-ops-sync-gate
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, reopened, synchronize]
6+
merge_group:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
gate:
13+
if: github.event_name == 'pull_request' || vars.REPO_OPS_SYNC_ENABLED == 'true'
14+
timeout-minutes: 15
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Reject reserved RepoOps trailers
18+
if: github.event_name == 'pull_request'
19+
env:
20+
PR_TITLE: ${{ github.event.pull_request.title }}
21+
PR_BODY: ${{ github.event.pull_request.body }}
22+
run: |
23+
python3 - <<'PY'
24+
import os
25+
import re
26+
import sys
27+
28+
text = f"{os.environ.get('PR_TITLE', '')}\n{os.environ.get('PR_BODY', '')}"
29+
match = re.search(r"(?m)^(?:OSS-RevId|Mono-RevId):", text)
30+
if match:
31+
print(f"BLOCKED: PR title/body contains reserved RepoOps trailer {match.group(0)!r}", file=sys.stderr)
32+
raise SystemExit(1)
33+
print("ok: no reserved RepoOps trailers")
34+
PY
35+
36+
- name: Pull request check context
37+
if: github.event_name == 'pull_request'
38+
run: echo 'State is checked again against the live tips by merge queue.'
39+
40+
- name: Create read-only Dispatcher App token
41+
if: github.event_name == 'merge_group'
42+
id: app-token
43+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
44+
with:
45+
app-id: ${{ vars.REPO_OPS_DISPATCHER_APP_ID }}
46+
private-key: ${{ secrets.REPO_OPS_DISPATCHER_APP_PRIVATE_KEY }}
47+
repositories: ${{ secrets.REPO_OPS_MONO_REPOSITORY }}
48+
permission-contents: read
49+
50+
- name: Wait for pending mono changes
51+
if: github.event_name == 'merge_group'
52+
env:
53+
APP_TOKEN: ${{ steps.app-token.outputs.token }}
54+
PUBLIC_TOKEN: ${{ github.token }}
55+
MONO_BASELINE: ${{ vars.REPO_OPS_MONO_BASELINE }}
56+
PUBLIC_BASELINE: ${{ vars.REPO_OPS_PUBLIC_BASELINE }}
57+
MONO_REPOSITORY: ${{ secrets.REPO_OPS_MONO_REPOSITORY }}
58+
PUBLIC_REPOSITORY: ${{ github.repository }}
59+
run: |
60+
set -euo pipefail
61+
[[ "$MONO_REPOSITORY" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]]
62+
[[ "$PUBLIC_REPOSITORY" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]]
63+
git clone --filter=blob:none --no-tags \
64+
"https://x-access-token:${PUBLIC_TOKEN}@github.com/${PUBLIC_REPOSITORY}.git" public
65+
git clone --filter=blob:none --no-tags \
66+
"https://x-access-token:${APP_TOKEN}@github.com/${MONO_REPOSITORY}.git" mono
67+
68+
for _ in $(seq 1 60); do
69+
git -C public fetch --no-tags origin \
70+
+refs/heads/main:refs/remotes/origin/main
71+
git -C mono fetch --no-tags origin \
72+
+refs/heads/main:refs/remotes/origin/main
73+
output="$(mktemp)"
74+
mono/tooling/plan-repo-ops-outbound.sh \
75+
mono public "$(git -C mono rev-parse origin/main)" \
76+
"$MONO_BASELINE" "$PUBLIC_BASELINE" "$output"
77+
native_count="$(grep -E '^native_count=' "$output" | cut -d= -f2)"
78+
rm -f "$output"
79+
80+
if (( native_count == 0 )); then
81+
echo 'No unsynced native mono oss/ commits.'
82+
exit 0
83+
fi
84+
echo "Waiting for $native_count native mono oss/ commit(s)."
85+
sleep 10
86+
done
87+
echo 'Timed out waiting for mono-to-public sync.' >&2
88+
exit 1

.repo-ops-baseline

Whitespace-only changes.

.repo-ops-private-to-public-test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Repository synchronization test.

.repo-ops-public-to-private-test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Repository synchronization test.

apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.projects/route.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NODE_RUNTIME_UPDATE_MAJOR } from "@trigger.dev/core/v3";
1+
import { needsNodeRuntimeUpdate } from "@trigger.dev/core/v3";
22
import { typedjson, useTypedLoaderData } from "remix-typedjson";
33
import { resolveOrgIdFromSlugForUser } from "~/models/organization.server";
44
import { listCurrentProductionProjectRuntimes } from "~/services/projectRuntimeUpdates.server";
@@ -54,7 +54,7 @@ export const loader = dashboardLoader(
5454
: null,
5555
};
5656

57-
if (deployment?.nodeMajor === NODE_RUNTIME_UPDATE_MAJOR) {
57+
if (deployment && needsNodeRuntimeUpdate(deployment.runtime, deployment.runtimeVersion)) {
5858
needsUpdate.push(row);
5959
} else {
6060
otherProjects.push(row);

apps/webapp/app/services/projectRuntimeUpdates.server.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,6 @@ export async function listCurrentProductionProjectRuntimes(scope: Scope) {
8585
);
8686
}
8787

88-
/**
89-
* Whether any project in the organization runs the reported Node.js major in Production.
90-
*
91-
* The SQL filter mirrors `nodeMajor(runtime, runtimeVersion) === NODE_RUNTIME_UPDATE_MAJOR`, which
92-
* the page applies in JS: keep the two in step. Scoped to the caller's membership so the side menu
93-
* cannot report on an organization the user does not belong to.
94-
*/
9588
export async function organizationHasProjectRuntimeUpdate({
9689
organizationSlug,
9790
userId,
@@ -115,8 +108,20 @@ export async function organizationHasProjectRuntimeUpdate({
115108
some: {
116109
label: CURRENT_DEPLOYMENT_LABEL,
117110
deployment: {
118-
runtime: { startsWith: "node" },
119-
runtimeVersion: { startsWith: `${NODE_RUNTIME_UPDATE_MAJOR}.` },
111+
OR: [
112+
{
113+
runtimeVersion: { startsWith: `${NODE_RUNTIME_UPDATE_MAJOR}.` },
114+
OR: [{ runtime: null }, { runtime: { startsWith: "node" } }],
115+
},
116+
{
117+
runtimeVersion: null,
118+
OR: [
119+
{ runtime: null },
120+
{ runtime: "node" },
121+
{ runtime: `node-${NODE_RUNTIME_UPDATE_MAJOR}` },
122+
],
123+
},
124+
],
120125
},
121126
},
122127
},

docs/github-integration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This eliminates the need to manually run the `trigger.dev deploy` command or set
3434
<Step title="Customize build settings (optional)">
3535
Configure how your project is built:
3636

37-
- **Trigger config file**: Path to your `trigger.config.ts` file. By default, we look for it in the root of your repository. The path should be relative to the root of your repository and contain the config file name, e.g., `apps/tasks/trigger.config.ts`.
37+
- **Trigger config file**: Auto-detected by default — we find your `trigger.config.ts` anywhere in your repository. Set a path relative to the root of your repository to override it, e.g., `apps/tasks/trigger.config.ts`. If your repository contains more than one config file, set the path of the one to use.
3838
- **Install command**: Auto-detected by default, but you can override it if necessary. The command will be run from the root of your repository.
3939
- **Pre-build command**: Run any commands before building and deploying your project, e.g., `pnpm run prisma:generate`. The command will be run from the root of your repository.
4040
</Step>

docs/snippets/cli-commands-deploy.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,34 @@ npx trigger.dev@latest deploy [path]
9898
briefly before it notices. Requires `--external-id`.
9999
</ParamField>
100100

101+
<ParamField body="Native build" type="--native-build">
102+
Use the native build server to install, bundle and build your project.
103+
</ParamField>
104+
105+
<ParamField body="Local bundle" type="--local-bundle">
106+
Install and bundle on your machine, then build the image on the build server from the uploaded
107+
bundle. Requires `--native-build`. Use it if you prefer dependencies to be installed on your
108+
machine rather than on the build server.
109+
</ParamField>
110+
111+
<ParamField body="Detach" type="--detach">
112+
Exit once the build is queued instead of streaming the build logs. The deployment continues on
113+
the build server. Requires `--native-build`.
114+
</ParamField>
115+
116+
<ParamField body="Depot build" type="--depot-build">
117+
Build the image with Depot, the default build provider.
118+
</ParamField>
119+
101120
<ParamField body="Local build" type="--local-build">
102121
Force building the deployment image locally using your local Docker. This is automatic when self-hosting.
103122
</ParamField>
104123

124+
<ParamField body="Build logs" type="--build-logs">
125+
How build logs are shown: `compact` (default, a single updating line) or `full` (every log line).
126+
CI and piped output always use `full`.
127+
</ParamField>
128+
105129
### Common options
106130

107131
These options are available on most commands.

docs/troubleshooting.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Usually there will be some useful guidance below this message. If you can't figu
8787

8888
### `resource_exhausted`
8989

90-
If you see a `resource_exhausted` error during deploy, the build may have hit resource limits on our build infrastructure. Try our [native builder](https://trigger.dev/changelog/deployments-with-native-builds).
90+
If you see a `resource_exhausted` error during deploy, the build may have hit resource limits on our build infrastructure. Try our [native builder](https://trigger.dev/changelog/deployments-with-native-builds) by deploying with the `--native-build` flag.
9191

9292
### `No loader is configured for ".node" files`
9393

0 commit comments

Comments
 (0)