Skip to content

Commit 4be7cf4

Browse files
authored
Merge branch 'main' into feature/mcp-temporal-params
2 parents b5d0efd + 496e066 commit 4be7cf4

31 files changed

Lines changed: 1820 additions & 905 deletions

File tree

.env.development

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ SOURCEBOT_TELEMETRY_DISABLED=true # Disables telemetry collection
7777
# Controls the number of concurrent indexing jobs that can run at once
7878
# INDEX_CONCURRENCY_MULTIPLE=
7979

80-
# Controls the version of the web app
81-
# NEXT_PUBLIC_SOURCEBOT_VERSION=
82-
8380
# CONFIG_MAX_REPOS_NO_TOKEN=
8481
NODE_ENV=development
8582
# SOURCEBOT_TENANCY_MODE=single

.github/workflows/_gcp-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ jobs:
5454
${{ env.IMAGE_PATH }}:${{ github.sha }}
5555
${{ env.IMAGE_PATH }}:latest
5656
build-args: |
57-
NEXT_PUBLIC_SOURCEBOT_VERSION=${{ github.ref_name }}
5857
NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT=${{ vars.NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT }}
5958
NEXT_PUBLIC_SENTRY_ENVIRONMENT=${{ vars.NEXT_PUBLIC_SENTRY_ENVIRONMENT }}
6059
NEXT_PUBLIC_SENTRY_WEBAPP_DSN=${{ vars.NEXT_PUBLIC_SENTRY_WEBAPP_DSN }}
@@ -65,6 +64,7 @@ jobs:
6564
SENTRY_ORG=${{ vars.SENTRY_ORG }}
6665
SENTRY_WEBAPP_PROJECT=${{ vars.SENTRY_WEBAPP_PROJECT }}
6766
SENTRY_BACKEND_PROJECT=${{ vars.SENTRY_BACKEND_PROJECT }}
67+
SENTRY_RELEASE=${{ github.ref_name }}
6868
6969
7070
- name: Deploy to GCP

.github/workflows/ghcr-publish.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
push:
88
branches: ["main"]
99
tags: ["v*.*.*"]
10+
workflow_call:
11+
inputs:
12+
version:
13+
description: 'Version tag (e.g., v4.10.5)'
14+
required: false
15+
type: string
1016

1117
env:
1218
# Use docker.io for Docker Hub if empty
@@ -40,6 +46,7 @@ jobs:
4046
- name: Checkout repository
4147
uses: actions/checkout@v4
4248
with:
49+
ref: ${{ inputs.version || github.ref_name }}
4350
submodules: "true"
4451

4552
# Extract metadata (tags, labels) for Docker
@@ -77,8 +84,6 @@ jobs:
7784
cache-to: type=gha,mode=max,scope=${{ env.PLATFORM_PAIR }}
7885
platforms: ${{ matrix.platform }}
7986
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true,annotation.org.opencontainers.image.description=Blazingly fast code search
80-
build-args: |
81-
NEXT_PUBLIC_SOURCEBOT_VERSION=${{ github.ref_name }}
8287

8388
- name: Export digest
8489
run: |
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Release Sourcebot
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bump_type:
7+
description: "Type of version bump to apply"
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
15+
concurrency:
16+
group: release-sourcebot
17+
cancel-in-progress: false
18+
19+
jobs:
20+
release:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
outputs:
25+
version: ${{ steps.calculate_version.outputs.version }}
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
ref: main
32+
fetch-depth: 0
33+
34+
- name: Calculate new version
35+
id: calculate_version
36+
run: |
37+
# Extract current version from CHANGELOG.md
38+
CURRENT_VERSION=$(grep -oP '## \[\K[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md | head -n 1)
39+
40+
if [ -z "$CURRENT_VERSION" ]; then
41+
echo "Error: Could not extract current version from CHANGELOG.md"
42+
exit 1
43+
fi
44+
45+
echo "Current version: $CURRENT_VERSION"
46+
47+
# Parse version components
48+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
49+
50+
# Apply bump based on input
51+
BUMP_TYPE="${{ inputs.bump_type }}"
52+
case "$BUMP_TYPE" in
53+
major)
54+
MAJOR=$((MAJOR + 1))
55+
MINOR=0
56+
PATCH=0
57+
;;
58+
minor)
59+
MINOR=$((MINOR + 1))
60+
PATCH=0
61+
;;
62+
patch)
63+
PATCH=$((PATCH + 1))
64+
;;
65+
*)
66+
echo "Error: Invalid bump type: $BUMP_TYPE"
67+
exit 1
68+
;;
69+
esac
70+
71+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
72+
echo "New version: $NEW_VERSION"
73+
74+
# Export to GITHUB_ENV for use in subsequent steps within this job
75+
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
76+
77+
# Export to GITHUB_OUTPUT for use in other jobs
78+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
79+
80+
- name: Check if version already exists
81+
run: |
82+
if grep -q "## \[$VERSION\]" CHANGELOG.md; then
83+
echo "Error: Version $VERSION already exists in CHANGELOG.md"
84+
exit 1
85+
fi
86+
if git tag | grep -q "^v$VERSION$"; then
87+
echo "Error: Tag v$VERSION already exists"
88+
exit 1
89+
fi
90+
91+
- name: Update CHANGELOG.md and version.ts
92+
run: |
93+
DATE=$(date +%Y-%m-%d)
94+
95+
# Insert the new version header after the [Unreleased] line
96+
sed -i "/## \[Unreleased\]/a\\
97+
\\
98+
## [$VERSION] - $DATE" CHANGELOG.md
99+
100+
echo "Updated CHANGELOG.md with version $VERSION"
101+
cat CHANGELOG.md | head -n 15
102+
103+
# Update version.ts
104+
cat > packages/shared/src/version.ts << EOF
105+
// This file is auto-generated by .github/workflows/release-sourcebot.yml
106+
export const SOURCEBOT_VERSION = "v$VERSION";
107+
EOF
108+
echo "Updated version.ts with version v$VERSION"
109+
cat packages/shared/src/version.ts
110+
111+
- name: Configure git
112+
run: |
113+
git config user.name "github-actions[bot]"
114+
git config user.email "github-actions[bot]@users.noreply.github.com"
115+
116+
- name: Commit changes
117+
run: |
118+
git add CHANGELOG.md packages/shared/src/version.ts
119+
git commit -m "Release v$VERSION"
120+
121+
- name: Create annotated tag
122+
run: |
123+
git tag -a "v$VERSION" -m "sourcebot v$VERSION"
124+
125+
- name: Push changes
126+
run: |
127+
git push origin main
128+
git push origin --tags
129+
130+
- name: Create GitHub release
131+
env:
132+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133+
run: |
134+
gh release create "v$VERSION" \
135+
--verify-tag \
136+
--generate-notes \
137+
--latest
138+
139+
publish:
140+
needs: release
141+
uses: ./.github/workflows/ghcr-publish.yml
142+
with:
143+
version: v${{ needs.release.outputs.version }}
144+
permissions:
145+
contents: read
146+
packages: write
147+
id-token: write

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- Bake Sourcebot version into code rather than relying on build arg. [#680](https://github.com/sourcebot-dev/sourcebot/pull/680)
12+
13+
## [4.10.4] - 2025-12-18
14+
1015
### Fixed
1116
- Fixed issue where parenthesis in query params were not being encoded, resulting in a poor experience when embedding links in Markdown. [#674](https://github.com/sourcebot-dev/sourcebot/pull/674)
17+
- Gitlab clone respects host protocol setting in environment variable. [#676](https://github.com/sourcebot-dev/sourcebot/pull/676)
18+
- Fixed performance issues with `/repos` page. [#677](https://github.com/sourcebot-dev/sourcebot/pull/677)
1219

1320
## [4.10.3] - 2025-12-12
1421

Dockerfile

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# in the webapp.
99
# @see: https://docs.docker.com/build/building/variables/#scoping
1010

11-
ARG NEXT_PUBLIC_SOURCEBOT_VERSION
1211
ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT
1312
ARG NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
1413
ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
@@ -51,8 +50,6 @@ RUN yarn workspace @sourcebot/query-language install
5150
FROM node-alpine AS web-builder
5251
ENV SKIP_ENV_VALIDATION=1
5352
# -----------
54-
ARG NEXT_PUBLIC_SOURCEBOT_VERSION
55-
ENV NEXT_PUBLIC_SOURCEBOT_VERSION=$NEXT_PUBLIC_SOURCEBOT_VERSION
5653
ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT
5754
ENV NEXT_PUBLIC_SENTRY_ENVIRONMENT=$NEXT_PUBLIC_SENTRY_ENVIRONMENT
5855
ARG NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
@@ -72,7 +69,8 @@ ARG SENTRY_ORG
7269
ENV SENTRY_ORG=$SENTRY_ORG
7370
ARG SENTRY_WEBAPP_PROJECT
7471
ENV SENTRY_WEBAPP_PROJECT=$SENTRY_WEBAPP_PROJECT
75-
ENV SENTRY_RELEASE=$NEXT_PUBLIC_SOURCEBOT_VERSION
72+
ARG SENTRY_RELEASE
73+
ENV SENTRY_RELEASE=$SENTRY_RELEASE
7674
# SMUAT = Source Map Upload Auth Token
7775
ARG SENTRY_SMUAT
7876
ENV SENTRY_SMUAT=$SENTRY_SMUAT
@@ -102,8 +100,6 @@ ENV SKIP_ENV_VALIDATION=0
102100
FROM node-alpine AS backend-builder
103101
ENV SKIP_ENV_VALIDATION=1
104102
# -----------
105-
ARG NEXT_PUBLIC_SOURCEBOT_VERSION
106-
ENV NEXT_PUBLIC_SOURCEBOT_VERSION=$NEXT_PUBLIC_SOURCEBOT_VERSION
107103

108104
# To upload source maps to Sentry, we need to set the following build-time args.
109105
# It's important that we don't set these for oss builds, otherwise the Sentry
@@ -115,6 +111,8 @@ ENV SENTRY_BACKEND_PROJECT=$SENTRY_BACKEND_PROJECT
115111
# SMUAT = Source Map Upload Auth Token
116112
ARG SENTRY_SMUAT
117113
ENV SENTRY_SMUAT=$SENTRY_SMUAT
114+
ARG SENTRY_RELEASE
115+
ENV SENTRY_RELEASE=$SENTRY_RELEASE
118116
# -----------
119117

120118
WORKDIR /app
@@ -132,12 +130,12 @@ RUN yarn workspace @sourcebot/backend install
132130
RUN yarn workspace @sourcebot/backend build
133131

134132
# Upload source maps to Sentry if we have the necessary build-time args.
135-
RUN if [ -n "$SENTRY_SMUAT" ] && [ -n "$SENTRY_ORG" ] && [ -n "$SENTRY_BACKEND_PROJECT" ] && [ -n "$NEXT_PUBLIC_SOURCEBOT_VERSION" ]; then \
133+
RUN if [ -n "$SENTRY_SMUAT" ] && [ -n "$SENTRY_ORG" ] && [ -n "$SENTRY_BACKEND_PROJECT" ] && [ -n "$SENTRY_RELEASE" ]; then \
136134
apk add --no-cache curl; \
137135
curl -sL https://sentry.io/get-cli/ | sh; \
138136
sentry-cli login --auth-token $SENTRY_SMUAT; \
139-
sentry-cli sourcemaps inject --org $SENTRY_ORG --project $SENTRY_BACKEND_PROJECT --release $NEXT_PUBLIC_SOURCEBOT_VERSION ./packages/backend/dist; \
140-
sentry-cli sourcemaps upload --org $SENTRY_ORG --project $SENTRY_BACKEND_PROJECT --release $NEXT_PUBLIC_SOURCEBOT_VERSION ./packages/backend/dist; \
137+
sentry-cli sourcemaps inject --org $SENTRY_ORG --project $SENTRY_BACKEND_PROJECT --release $SENTRY_RELEASE ./packages/backend/dist; \
138+
sentry-cli sourcemaps upload --org $SENTRY_ORG --project $SENTRY_BACKEND_PROJECT --release $SENTRY_RELEASE ./packages/backend/dist; \
141139
fi
142140

143141
ENV SKIP_ENV_VALIDATION=0
@@ -146,8 +144,6 @@ ENV SKIP_ENV_VALIDATION=0
146144
# ------ Runner ------
147145
FROM node-alpine AS runner
148146
# -----------
149-
ARG NEXT_PUBLIC_SOURCEBOT_VERSION
150-
ENV NEXT_PUBLIC_SOURCEBOT_VERSION=$NEXT_PUBLIC_SOURCEBOT_VERSION
151147
ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT
152148
ENV NEXT_PUBLIC_SENTRY_ENVIRONMENT=$NEXT_PUBLIC_SENTRY_ENVIRONMENT
153149
ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
@@ -160,8 +156,6 @@ ARG NEXT_PUBLIC_LANGFUSE_BASE_URL
160156
ENV NEXT_PUBLIC_LANGFUSE_BASE_URL=$NEXT_PUBLIC_LANGFUSE_BASE_URL
161157
# -----------
162158

163-
RUN echo "Sourcebot Version: $NEXT_PUBLIC_SOURCEBOT_VERSION"
164-
165159
WORKDIR /app
166160
ENV NODE_ENV=production
167161
ENV NEXT_TELEMETRY_DISABLED=1

entrypoint.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,20 @@ else
6363
export REDIS_EMBEDDED="false"
6464
fi
6565

66+
# Extract version from version.ts
67+
VERSION_FILE="/app/packages/shared/src/version.ts"
68+
if [ -f "$VERSION_FILE" ]; then
69+
SOURCEBOT_VERSION=$(grep -o '"v[^"]*"' "$VERSION_FILE" | tr -d '"')
70+
# Validate extraction succeeded
71+
if [ -z "$SOURCEBOT_VERSION" ]; then
72+
echo -e "\e[33m[Warning] Failed to extract version from $VERSION_FILE. Setting to 'unknown'.\e[0m" >&2
73+
SOURCEBOT_VERSION="unknown"
74+
fi
75+
else
76+
SOURCEBOT_VERSION="unknown"
77+
fi
6678

67-
echo -e "\e[34m[Info] Sourcebot version: $NEXT_PUBLIC_SOURCEBOT_VERSION\e[0m"
79+
echo -e "\e[34m[Info] Sourcebot version: $SOURCEBOT_VERSION\e[0m"
6880

6981
if [ -n "$SOURCEBOT_TELEMETRY_DISABLED" ]; then
7082
# Validate that SOURCEBOT_TELEMETRY_DISABLED is either "true" or "false"
@@ -157,7 +169,7 @@ if [ ! -f "$FIRST_RUN_FILE" ]; then
157169
"event": "install",
158170
"distinct_id": "'"$SOURCEBOT_INSTALL_ID"'",
159171
"properties": {
160-
"sourcebot_version": "'"$NEXT_PUBLIC_SOURCEBOT_VERSION"'"
172+
"sourcebot_version": "'"$SOURCEBOT_VERSION"'"
161173
}
162174
}' https://us.i.posthog.com/capture/ ) then
163175
echo -e "\e[33m[Warning] Failed to send install event.\e[0m"
@@ -168,8 +180,8 @@ else
168180
PREVIOUS_VERSION=$(cat "$FIRST_RUN_FILE" | jq -r '.version')
169181

170182
# If the version has changed, we assume an upgrade has occurred.
171-
if [ "$PREVIOUS_VERSION" != "$NEXT_PUBLIC_SOURCEBOT_VERSION" ]; then
172-
echo -e "\e[34m[Info] Upgraded from version $PREVIOUS_VERSION to $NEXT_PUBLIC_SOURCEBOT_VERSION\e[0m"
183+
if [ "$PREVIOUS_VERSION" != "$SOURCEBOT_VERSION" ]; then
184+
echo -e "\e[34m[Info] Upgraded from version $PREVIOUS_VERSION to $SOURCEBOT_VERSION\e[0m"
173185

174186
if [ "$SOURCEBOT_TELEMETRY_DISABLED" = "false" ]; then
175187
if ! ( curl -L --output /dev/null --silent --fail --header "Content-Type: application/json" -d '{
@@ -178,7 +190,7 @@ else
178190
"distinct_id": "'"$SOURCEBOT_INSTALL_ID"'",
179191
"properties": {
180192
"from_version": "'"$PREVIOUS_VERSION"'",
181-
"to_version": "'"$NEXT_PUBLIC_SOURCEBOT_VERSION"'"
193+
"to_version": "'"$SOURCEBOT_VERSION"'"
182194
}
183195
}' https://us.i.posthog.com/capture/ ) then
184196
echo -e "\e[33m[Warning] Failed to send upgrade event.\e[0m"
@@ -187,7 +199,7 @@ else
187199
fi
188200
fi
189201

190-
echo "{\"version\": \"$NEXT_PUBLIC_SOURCEBOT_VERSION\", \"install_id\": \"$SOURCEBOT_INSTALL_ID\"}" > "$FIRST_RUN_FILE"
202+
echo "{\"version\": \"$SOURCEBOT_VERSION\", \"install_id\": \"$SOURCEBOT_INSTALL_ID\"}" > "$FIRST_RUN_FILE"
191203

192204
# Start the database and wait for it to be ready before starting any other service
193205
if [ "$DATABASE_EMBEDDED" = "true" ]; then

packages/backend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@
4444
"fast-deep-equal": "^3.1.3",
4545
"git-url-parse": "^16.1.0",
4646
"gitea-js": "^1.22.0",
47-
"glob": "^11.0.0",
47+
"glob": "^11.1.0",
4848
"groupmq": "^1.0.0",
4949
"ioredis": "^5.4.2",
5050
"lowdb": "^7.0.1",
5151
"micromatch": "^4.0.8",
5252
"p-limit": "^7.2.0",
53-
"posthog-node": "^4.2.1",
53+
"posthog-node": "^5.17.4",
5454
"prom-client": "^15.1.3",
5555
"simple-git": "^3.27.0",
5656
"zod": "^3.25.74"

packages/backend/src/instrument.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as Sentry from "@sentry/node";
2-
import { createLogger } from "@sourcebot/shared";
2+
import { createLogger, SOURCEBOT_VERSION } from "@sourcebot/shared";
33
import { env } from "@sourcebot/shared/client";
44

55
const logger = createLogger('instrument');
66

77
if (!!env.NEXT_PUBLIC_SENTRY_BACKEND_DSN && !!env.NEXT_PUBLIC_SENTRY_ENVIRONMENT) {
88
Sentry.init({
99
dsn: env.NEXT_PUBLIC_SENTRY_BACKEND_DSN,
10-
release: env.NEXT_PUBLIC_SOURCEBOT_VERSION,
10+
release: SOURCEBOT_VERSION,
1111
environment: env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,
1212
});
1313
} else {

0 commit comments

Comments
 (0)