From 28cd12ace5a4afe274b67c0a8983b1e110d67afb Mon Sep 17 00:00:00 2001 From: Matthew Ball Date: Fri, 22 May 2026 03:25:26 -0700 Subject: [PATCH 1/4] replace git hash with build number in UI footer --- frontend/{git-version.js => build-version.js} | 16 +++++------ frontend/package.json | 6 ++--- .../component/dashboard.component.html | 2 +- .../component/dashboard.component.scss | 2 +- .../component/dashboard.component.ts | 2 +- .../execute-workflow.service.ts | 2 +- frontend/yarn.lock | 27 ++++++++----------- 7 files changed, 25 insertions(+), 32 deletions(-) rename frontend/{git-version.js => build-version.js} (82%) diff --git a/frontend/git-version.js b/frontend/build-version.js similarity index 82% rename from frontend/git-version.js rename to frontend/build-version.js index 54cfdf8d3f5..97a3bbd1c84 100644 --- a/frontend/git-version.js +++ b/frontend/build-version.js @@ -17,17 +17,12 @@ * under the License. */ -const { gitDescribeSync } = require("git-describe"); +const { generate } = require("build-number-generator"); const { version } = require("./package.json"); const { resolve, relative } = require("path"); const { writeFileSync, existsSync, mkdirSync } = require("fs-extra"); -const gitInfo = gitDescribeSync({ - dirtyMark: false, - dirtySemver: false, -}); - -gitInfo.version = version; +const buildNumber = generate(version); if (!existsSync(__dirname + "/src/environments")) { mkdirSync(__dirname + "/src/environments"); @@ -37,10 +32,13 @@ writeFileSync( file, `// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! /* tslint:disable */ -export const Version = ${JSON.stringify(gitInfo, null, 4)}; +export const Version = { + "buildNumber": ${JSON.stringify(buildNumber)}, + "version": ${JSON.stringify(version)} +}; /* tslint:enable */ `, { encoding: "utf-8" } ); -console.log(`Wrote version info ${gitInfo.raw} to ${relative(resolve(__dirname, ".."), file)}`); +console.log(`Wrote build number ${buildNumber} to ${relative(resolve(__dirname, ".."), file)}`); diff --git a/frontend/package.json b/frontend/package.json index 481e720d976..dc19e8e20a6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "gui", - "version": "0.0.0", + "version": "1.1.0-incubating-SNAPSHOT", "engines": { "node": ">=24.0.0" }, @@ -17,7 +17,7 @@ "eslint:fix": "yarn eslint --fix ./src", "format:fix": "yarn prettier-eslint --write \"src/**/*.{ts,js,html,scss,less,json}\"", "format:ci": "yarn prettier-eslint --list-different \"src/**/*.{ts,js,html,scss,less,json}\" && yarn eslint ./src", - "postinstall": "node git-version.js" + "postinstall": "node build-version.js" }, "private": true, "dependencies": { @@ -122,12 +122,12 @@ "@vitest/browser": "4.1.5", "@vitest/browser-playwright": "4.1.5", "@vitest/coverage-v8": "4.1.5", + "build-number-generator": "3.1.0", "concurrently": "7.4.0", "eslint": "8.57.0", "eslint-plugin-rxjs": "5.0.3", "eslint-plugin-rxjs-angular": "2.0.1", "fs-extra": "10.0.1", - "git-describe": "4.1.0", "jsdom": "25.0.1", "nodecat": "2.0.0", "nx": "22.7.0", diff --git a/frontend/src/app/dashboard/component/dashboard.component.html b/frontend/src/app/dashboard/component/dashboard.component.html index 9edea629159..27e4af82dd5 100644 --- a/frontend/src/app/dashboard/component/dashboard.component.html +++ b/frontend/src/app/dashboard/component/dashboard.component.html @@ -201,7 +201,7 @@ About - Git hash: {{ gitCommitHash }} + Build: {{ buildNumber }} diff --git a/frontend/src/app/dashboard/component/dashboard.component.scss b/frontend/src/app/dashboard/component/dashboard.component.scss index edbe88658fb..3e404ecf6f7 100644 --- a/frontend/src/app/dashboard/component/dashboard.component.scss +++ b/frontend/src/app/dashboard/component/dashboard.component.scss @@ -100,7 +100,7 @@ nz-content { padding: 5px 0; } -#git-commit-id { +#build-number { position: absolute; left: 5px; bottom: 5px; diff --git a/frontend/src/app/dashboard/component/dashboard.component.ts b/frontend/src/app/dashboard/component/dashboard.component.ts index 57e6e8e284e..99c346a8dd9 100644 --- a/frontend/src/app/dashboard/component/dashboard.component.ts +++ b/frontend/src/app/dashboard/component/dashboard.component.ts @@ -83,7 +83,7 @@ export class DashboardComponent implements OnInit { isAdmin: boolean = this.userService.isAdmin(); isLogin = this.userService.isLogin(); - public gitCommitHash: string = Version.raw; + public buildNumber: string = Version.buildNumber; displayForum: boolean = true; displayNavbar: boolean = true; isCollapsed: boolean = false; diff --git a/frontend/src/app/workspace/service/execute-workflow/execute-workflow.service.ts b/frontend/src/app/workspace/service/execute-workflow/execute-workflow.service.ts index d3d7d23d179..eb86194e7cf 100644 --- a/frontend/src/app/workspace/service/execute-workflow/execute-workflow.service.ts +++ b/frontend/src/app/workspace/service/execute-workflow/execute-workflow.service.ts @@ -248,7 +248,7 @@ export class ExecuteWorkflowService { const workflowExecuteRequest = { executionName: executionName, - engineVersion: version.hash, + engineVersion: version.buildNumber, logicalPlan: logicalPlan, replayFromExecution: replayExecutionInfo, workflowSettings: workflowSettings, diff --git a/frontend/yarn.lock b/frontend/yarn.lock index b929da0c62c..46a49e1e1ec 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -6397,7 +6397,7 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7.3.12, @types/semver@npm:^7.3.8": +"@types/semver@npm:^7.3.12": version: 7.7.1 resolution: "@types/semver@npm:7.7.1" checksum: 10c0/c938aef3bf79a73f0f3f6037c16e2e759ff40c54122ddf0b2583703393d8d3127130823facb880e694caa324eb6845628186aac1997ee8b31dc2d18fafe26268 @@ -8135,6 +8135,15 @@ __metadata: languageName: node linkType: hard +"build-number-generator@npm:3.1.0": + version: 3.1.0 + resolution: "build-number-generator@npm:3.1.0" + bin: + buildnumgen: bin/buildnumgen.js + checksum: 10c0/10d2366b74493a12aa7390e08dc5cd27f77ba600234c757e59ae9436eb7b7dde837322d34f0e177de5e5da3f4e5cabb089a03f9fcb32195ceaecd3ebab0b3c5b + languageName: node + linkType: hard + "bundle-name@npm:^4.1.0": version: 4.1.0 resolution: "bundle-name@npm:4.1.0" @@ -10869,20 +10878,6 @@ __metadata: languageName: node linkType: hard -"git-describe@npm:4.1.0": - version: 4.1.0 - resolution: "git-describe@npm:4.1.0" - dependencies: - "@types/semver": "npm:^7.3.8" - lodash: "npm:^4.17.21" - semver: "npm:^5.6.0" - dependenciesMeta: - semver: - optional: true - checksum: 10c0/2e5cbb0f5aa4a6f4dc9135276a85a29ec627a88dd0d73b63d1a3cd2ec2477a8d1d5fc83ae480a00c587c0ea8a193c6a9696a5b549dc6af02db0be74cdfac0eb5 - languageName: node - linkType: hard - "glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2": version: 5.1.2 resolution: "glob-parent@npm:5.1.2" @@ -11094,6 +11089,7 @@ __metadata: "@vitest/coverage-v8": "npm:4.1.5" ai: "npm:5.0.93" ajv: "npm:8.10.0" + build-number-generator: "npm:3.1.0" concaveman: "npm:2.0.0" concurrently: "npm:7.4.0" d3-shape: "npm:2.1.0" @@ -11104,7 +11100,6 @@ __metadata: file-saver: "npm:2.0.5" fs-extra: "npm:10.0.1" fuse.js: "npm:6.5.3" - git-describe: "npm:4.1.0" html2canvas: "npm:1.4.1" jointjs: "npm:3.5.4" jsdom: "npm:25.0.1" From 25a7e1a2cb3d5801c1e45fb36ae01495b68048ee Mon Sep 17 00:00:00 2001 From: "Matthew B." Date: Fri, 22 May 2026 11:58:47 -0700 Subject: [PATCH 2/4] Update version in package.json to 0.0.0 Signed-off-by: Matthew B. --- frontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/package.json b/frontend/package.json index dc19e8e20a6..6075a8dec84 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "gui", - "version": "1.1.0-incubating-SNAPSHOT", + "version": "0.0.0", "engines": { "node": ">=24.0.0" }, From 31cbe4decfc33930c74107cee1f3a84d2896c76d Mon Sep 17 00:00:00 2001 From: Matthew Ball Date: Sat, 23 May 2026 02:47:50 -0700 Subject: [PATCH 3/4] compute UI build number in source instead of postinstall script --- frontend/.gitignore | 1 - frontend/package.json | 3 +-- .../environments/version.ts} | 26 +++---------------- frontend/tsconfig.json | 1 + 4 files changed, 6 insertions(+), 25 deletions(-) rename frontend/{build-version.js => src/environments/version.ts} (51%) diff --git a/frontend/.gitignore b/frontend/.gitignore index 72bce9bf8df..7e884cdeb21 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -7,7 +7,6 @@ /dist-server /tmp /out-tsc -src/environments/version.ts # test coverage /coverage diff --git a/frontend/package.json b/frontend/package.json index dc19e8e20a6..3ea98f63ee0 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -16,8 +16,7 @@ "lint": "eslint ./src", "eslint:fix": "yarn eslint --fix ./src", "format:fix": "yarn prettier-eslint --write \"src/**/*.{ts,js,html,scss,less,json}\"", - "format:ci": "yarn prettier-eslint --list-different \"src/**/*.{ts,js,html,scss,less,json}\" && yarn eslint ./src", - "postinstall": "node build-version.js" + "format:ci": "yarn prettier-eslint --list-different \"src/**/*.{ts,js,html,scss,less,json}\" && yarn eslint ./src" }, "private": true, "dependencies": { diff --git a/frontend/build-version.js b/frontend/src/environments/version.ts similarity index 51% rename from frontend/build-version.js rename to frontend/src/environments/version.ts index 97a3bbd1c84..35889fbb9fe 100644 --- a/frontend/build-version.js +++ b/frontend/src/environments/version.ts @@ -17,28 +17,10 @@ * under the License. */ -const { generate } = require("build-number-generator"); -const { version } = require("./package.json"); -const { resolve, relative } = require("path"); -const { writeFileSync, existsSync, mkdirSync } = require("fs-extra"); +import { generate } from "build-number-generator"; +import { version } from "../../package.json"; -const buildNumber = generate(version); - -if (!existsSync(__dirname + "/src/environments")) { - mkdirSync(__dirname + "/src/environments"); -} -const file = resolve(__dirname, "src", "environments", "version.ts"); -writeFileSync( - file, - `// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! -/* tslint:disable */ export const Version = { - "buildNumber": ${JSON.stringify(buildNumber)}, - "version": ${JSON.stringify(version)} + buildNumber: generate(version), + version, }; -/* tslint:enable */ -`, - { encoding: "utf-8" } -); - -console.log(`Wrote build number ${buildNumber} to ${relative(resolve(__dirname, ".."), file)}`); diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 57bd0161ccc..5407b53efc0 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -2,6 +2,7 @@ "compileOnSave": false, "compilerOptions": { "allowSyntheticDefaultImports": true, + "resolveJsonModule": true, "paths": { "path": [ "./node_modules/path-browserify" From 9a30975ad093a12ca50d19fa979333a2310e83b8 Mon Sep 17 00:00:00 2001 From: Matthew Ball Date: Sat, 23 May 2026 19:57:16 -0700 Subject: [PATCH 4/4] generate build number at prod build time --- frontend/.gitignore | 3 ++ frontend/angular.json | 4 +++ frontend/build-version.js | 41 ++++++++++++++++++++++++++++ frontend/package.json | 4 +-- frontend/src/environments/version.ts | 5 ++-- 5 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 frontend/build-version.js diff --git a/frontend/.gitignore b/frontend/.gitignore index 7e884cdeb21..d5db9ad9937 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -30,3 +30,6 @@ # nx migration /migrations.json + +# Generated by build-version.js on prod builds. +/src/environments/version.prod.ts diff --git a/frontend/angular.json b/frontend/angular.json index b9e9961d027..4eea66f5fc2 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -62,6 +62,10 @@ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" + }, + { + "replace": "src/environments/version.ts", + "with": "src/environments/version.prod.ts" } ] }, diff --git a/frontend/build-version.js b/frontend/build-version.js new file mode 100644 index 00000000000..089c0dcb455 --- /dev/null +++ b/frontend/build-version.js @@ -0,0 +1,41 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Runs as the first step of `yarn build` / `yarn build:ci`. Writes +// version.prod.ts with a timestamped build number; Angular's production +// fileReplacements (angular.json) swaps version.ts for version.prod.ts. +// Dev builds (`yarn start`) keep the static "dev" string in version.ts. + +const { generate } = require("build-number-generator"); +const { version } = require("./package.json"); +const { resolve } = require("path"); +const { writeFileSync } = require("fs"); + +const buildNumber = generate(version); +const out = resolve(__dirname, "src", "environments", "version.prod.ts"); +writeFileSync( + out, + `// AUTO-GENERATED by build-version.js — do not edit or commit. +export const Version = { + buildNumber: ${JSON.stringify(buildNumber)}, + version: ${JSON.stringify(version)}, +}; +`, +); +console.log(`build-version: ${buildNumber}`); diff --git a/frontend/package.json b/frontend/package.json index acaded1629d..55b286be6f6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,8 +7,8 @@ "license": "Apache-2.0", "scripts": { "start": "concurrently --kill-others \"npx y-websocket\" \"ng serve\"", - "build": "node --max-old-space-size=8192 ./node_modules/@angular/cli/bin/ng build --configuration=production --progress=false --source-map=false", - "build:ci": "node --max-old-space-size=8192 ./node_modules/nx/dist/bin/nx.js build --configuration=production --progress=false --source-map=false", + "build": "node build-version.js && node --max-old-space-size=8192 ./node_modules/@angular/cli/bin/ng build --configuration=production --progress=false --source-map=false", + "build:ci": "node build-version.js && node --max-old-space-size=8192 ./node_modules/nx/dist/bin/nx.js build --configuration=production --progress=false --source-map=false", "analyze": "ng build --configuration=production --stats-json && webpack-bundle-analyzer dist/stats.json", "test": "ng test --watch=false", "test:ci": "node --max-old-space-size=8192 ./node_modules/nx/dist/bin/nx.js test --watch=false --progress=false --coverage --coverage-reporters=lcovonly", diff --git a/frontend/src/environments/version.ts b/frontend/src/environments/version.ts index 35889fbb9fe..34748af22b9 100644 --- a/frontend/src/environments/version.ts +++ b/frontend/src/environments/version.ts @@ -17,10 +17,11 @@ * under the License. */ -import { generate } from "build-number-generator"; import { version } from "../../package.json"; +// Dev placeholder. Production builds replace this file with the generated +// version.prod.ts (see angular.json fileReplacements + frontend/build-version.js). export const Version = { - buildNumber: generate(version), + buildNumber: "dev", version, };