From 6bdf138e6a1bc3c6e998e7256e288d2853500307 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue, 3 Jun 2025 17:16:41 +0100 Subject: [PATCH 1/7] improve app version output --- .../OrganizationSettingsSideMenu.tsx | 40 +++++++++++++++++-- .../route.tsx | 19 ++++++--- 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx index 694ac87560..57e982ce7c 100644 --- a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx +++ b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx @@ -22,16 +22,26 @@ import { SideMenuItem } from "./SideMenuItem"; import { useCurrentPlan } from "~/routes/_app.orgs.$organizationSlug/route"; import { Paragraph } from "../primitives/Paragraph"; import { Badge } from "../primitives/Badge"; +import { useHasAdminAccess } from "~/hooks/useUser"; + +export type BuildInfo = { + appVersion: string | undefined; + packageVersion: string; + buildTimestampSeonds: string | undefined; + gitSha: string | undefined; + gitRefName: string | undefined; +}; export function OrganizationSettingsSideMenu({ organization, - version, + buildInfo, }: { organization: MatchedOrganization; - version: string; + buildInfo: BuildInfo; }) { const { isManagedCloud } = useFeatures(); const currentPlan = useCurrentPlan(); + const isAdmin = useHasAdminAccess(); return (
- v{version} + {buildInfo.appVersion || `v${buildInfo.packageVersion}`}
+ {isAdmin && buildInfo.buildTimestampSeonds && ( +
+ + + {new Date(Number(buildInfo.buildTimestampSeonds) * 1000).toISOString()} + +
+ )} + {isAdmin && buildInfo.gitRefName && ( +
+ + + {buildInfo.gitRefName} + +
+ )} + {isAdmin && buildInfo.gitSha && ( +
+ + + {buildInfo.gitSha.slice(0, 9)} + +
+ )}
diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx index 735959e451..56ebded113 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx @@ -1,25 +1,34 @@ import { Outlet } from "@remix-run/react"; import { type LoaderFunctionArgs } from "@remix-run/server-runtime"; -import { VERSION } from "@trigger.dev/core"; +import { VERSION as coreVersion } from "@trigger.dev/core"; import { typedjson, useTypedLoaderData } from "remix-typedjson"; import { AppContainer, MainBody } from "~/components/layout/AppLayout"; -import { OrganizationSettingsSideMenu } from "~/components/navigation/OrganizationSettingsSideMenu"; +import { + type BuildInfo, + OrganizationSettingsSideMenu, +} from "~/components/navigation/OrganizationSettingsSideMenu"; import { useOrganization } from "~/hooks/useOrganizations"; export const loader = async ({ request, params }: LoaderFunctionArgs) => { return typedjson({ - version: VERSION, + buildInfo: { + appVersion: process.env.BUILD_APP_VERSION, + packageVersion: coreVersion, + gitSha: process.env.BUILD_GIT_SHA, + gitRefName: process.env.BUILD_GIT_REF_NAME, + buildTimestampSeonds: process.env.BUILD_TIMESTAMP_SECONDS, + } satisfies BuildInfo, }); }; export default function Page() { - const { version } = useTypedLoaderData(); + const { buildInfo } = useTypedLoaderData(); const organization = useOrganization(); return (
- + From c1f6da5ac93e10f26bdde5be2e764fb56ff2546a Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue, 3 Jun 2025 17:17:07 +0100 Subject: [PATCH 2/7] set build info --- .github/workflows/publish-webapp.yml | 16 ++++++++++++++++ docker/Dockerfile | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/.github/workflows/publish-webapp.yml b/.github/workflows/publish-webapp.yml index 246a8ea31d..caf7d7416c 100644 --- a/.github/workflows/publish-webapp.yml +++ b/.github/workflows/publish-webapp.yml @@ -56,6 +56,17 @@ jobs: echo "image_tags=${image_tags}" >> "$GITHUB_OUTPUT" + - name: 📝 Set the build info + id: set_build_info + run: | + tag=${{ steps.get_tag.outputs.tag }} + if [[ "${{ steps.get_tag.outputs.is_semver }}" == true ]]; then + echo "BUILD_APP_VERSION=${tag}" >> "$GITHUB_OUTPUTS" + fi + echo "BUILD_GIT_SHA=${{ github.sha }}" >> "$GITHUB_OUTPUTS" + echo "BUILD_GIT_REF_NAME=${{ github.ref_name }}" >> "$GITHUB_OUTPUTS" + echo "BUILD_TIMESTAMP_SECONDS=$(date +%s)" >> "$GITHUB_OUTPUTS" + - name: 🐙 Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -70,3 +81,8 @@ jobs: platforms: linux/amd64,linux/arm64 tags: ${{ steps.set_tags.outputs.image_tags }} push: true + build-args: | + BUILD_APP_VERSION=${{ steps.set_build_info.outputs.BUILD_APP_VERSION }} + BUILD_GIT_SHA=${{ steps.set_build_info.outputs.BUILD_GIT_SHA }} + BUILD_GIT_REF_NAME=${{ steps.set_build_info.outputs.BUILD_GIT_REF_NAME }} + BUILD_TIMESTAMP_SECONDS=${{ steps.set_build_info.outputs.BUILD_TIMESTAMP_SECONDS }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 210de7f309..86a77b5a2f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -82,6 +82,16 @@ COPY --from=builder --chown=node:node /triggerdotdev/scripts ./scripts COPY --from=builder /usr/local/bin/goose /usr/local/bin/goose COPY --from=builder --chown=node:node /triggerdotdev/internal-packages/clickhouse/schema /triggerdotdev/internal-packages/clickhouse/schema +# Build info +ARG BUILD_APP_VERSION +ARG BUILD_GIT_SHA +ARG BUILD_GIT_REF_NAME +ARG BUILD_TIMESTAMP_SECONDS +ENV BUILD_APP_VERSION=${BUILD_APP_VERSION} \ + BUILD_GIT_SHA=${BUILD_GIT_SHA} \ + BUILD_GIT_REF_NAME=${BUILD_GIT_REF_NAME} \ + BUILD_TIMESTAMP_SECONDS=${BUILD_TIMESTAMP_SECONDS} + EXPOSE 3000 USER node From cbdb493baf7f958b9184fff2dbc5aba18449b582 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue, 3 Jun 2025 17:27:22 +0100 Subject: [PATCH 3/7] fix typo --- .github/workflows/publish-webapp.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-webapp.yml b/.github/workflows/publish-webapp.yml index caf7d7416c..ed5a259a85 100644 --- a/.github/workflows/publish-webapp.yml +++ b/.github/workflows/publish-webapp.yml @@ -61,11 +61,11 @@ jobs: run: | tag=${{ steps.get_tag.outputs.tag }} if [[ "${{ steps.get_tag.outputs.is_semver }}" == true ]]; then - echo "BUILD_APP_VERSION=${tag}" >> "$GITHUB_OUTPUTS" + echo "BUILD_APP_VERSION=${tag}" >> "$GITHUB_OUTPUT" fi - echo "BUILD_GIT_SHA=${{ github.sha }}" >> "$GITHUB_OUTPUTS" - echo "BUILD_GIT_REF_NAME=${{ github.ref_name }}" >> "$GITHUB_OUTPUTS" - echo "BUILD_TIMESTAMP_SECONDS=$(date +%s)" >> "$GITHUB_OUTPUTS" + echo "BUILD_GIT_SHA=${{ github.sha }}" >> "$GITHUB_OUTPUT" + echo "BUILD_GIT_REF_NAME=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" + echo "BUILD_TIMESTAMP_SECONDS=$(date +%s)" >> "$GITHUB_OUTPUT" - name: 🐙 Login to GitHub Container Registry uses: docker/login-action@v3 From 30f40190aacae0e47b7d7644d3a85ad0b9bbec93 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue, 3 Jun 2025 17:56:48 +0100 Subject: [PATCH 4/7] always show additional build info when self-hosting --- .../components/navigation/OrganizationSettingsSideMenu.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx index 57e982ce7c..fd8fbf1417 100644 --- a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx +++ b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx @@ -42,6 +42,7 @@ export function OrganizationSettingsSideMenu({ const { isManagedCloud } = useFeatures(); const currentPlan = useCurrentPlan(); const isAdmin = useHasAdminAccess(); + const showBuildInfo = isAdmin || !isManagedCloud; return (
- {isAdmin && buildInfo.buildTimestampSeonds && ( + {showBuildInfo && buildInfo.buildTimestampSeonds && (
@@ -115,7 +116,7 @@ export function OrganizationSettingsSideMenu({
)} - {isAdmin && buildInfo.gitRefName && ( + {showBuildInfo && buildInfo.gitRefName && (
@@ -123,7 +124,7 @@ export function OrganizationSettingsSideMenu({
)} - {isAdmin && buildInfo.gitSha && ( + {showBuildInfo && buildInfo.gitSha && (
From 75f06d3c5d25916cd0d0d8dd4425130902522f2a Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Wed, 4 Jun 2025 10:37:18 +0100 Subject: [PATCH 5/7] Update apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .../app/routes/_app.orgs.$organizationSlug.settings/route.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx index 56ebded113..97fa202578 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx @@ -16,7 +16,7 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => { packageVersion: coreVersion, gitSha: process.env.BUILD_GIT_SHA, gitRefName: process.env.BUILD_GIT_REF_NAME, - buildTimestampSeonds: process.env.BUILD_TIMESTAMP_SECONDS, + buildTimestampSeconds: process.env.BUILD_TIMESTAMP_SECONDS, } satisfies BuildInfo, }); }; From 2ac8bda800b2d3be2d6cbdcea0b23e3906313000 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Wed, 4 Jun 2025 10:37:48 +0100 Subject: [PATCH 6/7] Update apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .../app/components/navigation/OrganizationSettingsSideMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx index fd8fbf1417..8fb7789df5 100644 --- a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx +++ b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx @@ -27,7 +27,7 @@ import { useHasAdminAccess } from "~/hooks/useUser"; export type BuildInfo = { appVersion: string | undefined; packageVersion: string; - buildTimestampSeonds: string | undefined; + buildTimestampSeconds: string | undefined; gitSha: string | undefined; gitRefName: string | undefined; }; From e9f0fcfa56d9aac4a67ba2d3e7af50fd09b64393 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Wed, 4 Jun 2025 10:39:05 +0100 Subject: [PATCH 7/7] fix build timestamp name --- .../components/navigation/OrganizationSettingsSideMenu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx index 8fb7789df5..fe9d146521 100644 --- a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx +++ b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx @@ -108,11 +108,11 @@ export function OrganizationSettingsSideMenu({ {buildInfo.appVersion || `v${buildInfo.packageVersion}`}
- {showBuildInfo && buildInfo.buildTimestampSeonds && ( + {showBuildInfo && buildInfo.buildTimestampSeconds && (
- {new Date(Number(buildInfo.buildTimestampSeonds) * 1000).toISOString()} + {new Date(Number(buildInfo.buildTimestampSeconds) * 1000).toISOString()}
)}