From 64051134b8e05c19d4be0bb526a5cd12be965141 Mon Sep 17 00:00:00 2001 From: Jesse Hallam Date: Thu, 30 Mar 2023 11:02:26 -0300 Subject: [PATCH] Remove Webapp Build Hash (#22706) * Remove Webapp Build Hash A discrete webapp build hash is no longer needed with the mono-repo. * i18n-extract --- model/version.go | 3 -- server/Makefile | 9 ------ server/config/client.go | 3 -- server/playbooks/product/playbooks_product.go | 4 +-- .../about_build_modal.test.tsx.snap | 28 ------------------- .../about_build_modal.test.tsx | 2 -- .../about_build_modal/about_build_modal.tsx | 16 ----------- .../about_build_modal_cloud.tsx | 9 ------ webapp/channels/src/i18n/en.json | 1 - webapp/channels/webpack.config.js | 3 -- webapp/platform/types/src/config.ts | 3 -- 11 files changed, 2 insertions(+), 79 deletions(-) diff --git a/model/version.go b/model/version.go index 7ebb083d16..1683e810d5 100644 --- a/model/version.go +++ b/model/version.go @@ -118,9 +118,6 @@ var BuildDate string var BuildHash string var BuildHashEnterprise string var BuildEnterpriseReady string -var BuildHashBoards string -var BuildBoards string -var BuildHashPlaybooks string var versionsWithoutHotFixes []string func init() { diff --git a/server/Makefile b/server/Makefile index 0f3aaa18e3..861425e1e6 100644 --- a/server/Makefile +++ b/server/Makefile @@ -87,14 +87,8 @@ else endif # Boards -BUILD_BOARDS = true -BUILD_HASH_BOARDS = $(BUILD_HASH) export MM_FEATUREFLAGS_BoardsProduct=true -# Playbooks -BUILD_PLAYBOOKS ?= true -BUILD_HASH_PLAYBOOKS = $(BUILD_HASH) - # We need current user's UID for `run-haserver` so docker compose does not run server # as root and mess up file permissions for devs. When running like this HOME will be blank # and docker will add '/', so we need to set the go-build cache location or we'll get @@ -116,9 +110,6 @@ LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildDate=$(BUIL LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildHash=$(BUILD_HASH)" LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildHashEnterprise=$(BUILD_HASH_ENTERPRISE)" LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildEnterpriseReady=$(BUILD_ENTERPRISE_READY)" -LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildHashBoards=$(BUILD_HASH_BOARDS)" -LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildBoards=$(BUILD_BOARDS)" -LDFLAGS += -X "github.com/mattermost/mattermost-server/v6/model.BuildHashPlaybooks=$(BUILD_HASH_PLAYBOOKS)" GO_MAJOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1) GO_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) diff --git a/server/config/client.go b/server/config/client.go index 5efbc671b7..df004b381f 100644 --- a/server/config/client.go +++ b/server/config/client.go @@ -223,9 +223,6 @@ func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *m props["BuildHash"] = model.BuildHash props["BuildHashEnterprise"] = model.BuildHashEnterprise props["BuildEnterpriseReady"] = model.BuildEnterpriseReady - props["BuildHashBoards"] = model.BuildHashBoards - props["BuildBoards"] = model.BuildBoards - props["BuildHashPlaybooks"] = model.BuildHashPlaybooks props["EnableBotAccountCreation"] = strconv.FormatBool(*c.ServiceSettings.EnableBotAccountCreation) props["EnableFile"] = strconv.FormatBool(*c.LogSettings.EnableFile) diff --git a/server/playbooks/product/playbooks_product.go b/server/playbooks/product/playbooks_product.go index 8f2f98dcdf..9769c2d470 100644 --- a/server/playbooks/product/playbooks_product.go +++ b/server/playbooks/product/playbooks_product.go @@ -341,7 +341,7 @@ func (pp *playbooksProduct) Start() error { logrus.Info("Rudder credentials are set. Enabling analytics.") diagnosticID := pp.serviceAdapter.GetDiagnosticID() serverVersion := pp.serviceAdapter.GetServerVersion() - pp.telemetryClient, err = telemetry.NewRudder(rudderDataplaneURL, rudderWriteKey, diagnosticID, model.BuildHashPlaybooks, serverVersion) + pp.telemetryClient, err = telemetry.NewRudder(rudderDataplaneURL, rudderWriteKey, diagnosticID, model.BuildHash, serverVersion) if err != nil { return errors.Wrapf(err, "failed init telemetry client") } @@ -569,7 +569,7 @@ func (pp *playbooksProduct) Stop() error { func newMetricsInstance() *metrics.Metrics { // Init metrics instanceInfo := metrics.InstanceInfo{ - Version: model.BuildHashPlaybooks, + Version: model.BuildHash, InstallationID: os.Getenv("MM_CLOUD_INSTALLATION_ID"), } return metrics.NewMetrics(instanceInfo) diff --git a/webapp/channels/src/components/about_build_modal/__snapshots__/about_build_modal.test.tsx.snap b/webapp/channels/src/components/about_build_modal/__snapshots__/about_build_modal.test.tsx.snap index fca30719a4..aad61ae4ed 100644 --- a/webapp/channels/src/components/about_build_modal/__snapshots__/about_build_modal.test.tsx.snap +++ b/webapp/channels/src/components/about_build_modal/__snapshots__/about_build_modal.test.tsx.snap @@ -282,13 +282,6 @@ exports[`components/AboutBuildModal should match snapshot for enterprise edition /> 0123456789abcdef -
- - - 0a1b2c3d4f

-
- - - 0a1b2c3d4f

-
- - - 0a1b2c3d4f

-
- - - 0a1b2c3d4f

{ , @@ -211,7 +210,6 @@ describe('components/AboutBuildModal', () => { const allProps = { show, onExited, - webappBuildHash: '0a1b2c3d4f', config, license, ...props, diff --git a/webapp/channels/src/components/about_build_modal/about_build_modal.tsx b/webapp/channels/src/components/about_build_modal/about_build_modal.tsx index e9808e5f08..c0ecc69a9a 100644 --- a/webapp/channels/src/components/about_build_modal/about_build_modal.tsx +++ b/webapp/channels/src/components/about_build_modal/about_build_modal.tsx @@ -32,11 +32,6 @@ type Props = { * Global license object */ license: ClientLicense; - - /** - * Webapp build hash override. By default, webpack sets this (so it must be overridden in tests). - */ - webappBuildHash?: string; }; type State = { @@ -330,17 +325,6 @@ export default class AboutBuildModal extends React.PureComponent { /> {config.BuildHashEnterprise} -
- - - { - /* global COMMIT_HASH */ this.props. - webappBuildHash || - (typeof COMMIT_HASH === 'undefined' ? '' : COMMIT_HASH) - }

void; }; -// Webpack global var -declare const COMMIT_HASH: string; - export default function AboutBuildModalCloud(props: Props) { const config = props.config; const license = props.license; @@ -162,12 +159,6 @@ export default function AboutBuildModalCloud(props: Props) { defaultMessage='EE Build Hash:' /> {config.BuildHashEnterprise} -
- - {typeof COMMIT_HASH === 'undefined' ? '' : COMMIT_HASH}

server, desktop and mobile apps.", "about.privacy": "Privacy Policy", diff --git a/webapp/channels/webpack.config.js b/webapp/channels/webpack.config.js index 64aa4bef6e..c0572b63ff 100644 --- a/webapp/channels/webpack.config.js +++ b/webapp/channels/webpack.config.js @@ -171,9 +171,6 @@ var config = { new webpack.ProvidePlugin({ process: 'process/browser', }), - new webpack.DefinePlugin({ - COMMIT_HASH: JSON.stringify(childProcess.execSync('git rev-parse HEAD || echo dev').toString()), - }), new MiniCssExtractPlugin({ filename: '[name].[contenthash].css', chunkFilename: '[name].[contenthash].css', diff --git a/webapp/platform/types/src/config.ts b/webapp/platform/types/src/config.ts index 15b2736161..42705fa9e0 100644 --- a/webapp/platform/types/src/config.ts +++ b/webapp/platform/types/src/config.ts @@ -18,13 +18,10 @@ export type ClientConfig = { BannerColor: string; BannerText: string; BannerTextColor: string; - BuildBoards: string; BuildDate: string; BuildEnterpriseReady: string; BuildHash: string; - BuildHashBoards: string; BuildHashEnterprise: string; - BuildHashPlaybooks: string; BuildNumber: string; CollapsedThreads: CollapsedThreads; CustomBrandText: string;