Mattermost-server: [webapp] v4.8.0-rc1 build failure if not in git repository

Created on 26 Feb 2018  ·  5Comments  ·  Source: mattermost/mattermost-server

Summary

Unlike mattermost-server, mattermost-webapp fails to build if the webapp folder is not inside a git repository.

Steps to reproduce

Download Mattermost server/webapp using the v4.8.0-rc1 Github releases.
Try to build Mattermost using those tarballs.

Expected behavior

In v4.7.0 the build succeeded. v4.8.0-rc1 should behave similar.

Observed behavior (that appears unintentional)

Building the webapp fails (log):

$ cross-env NODE_ENV=production webpack --display-error-details --progress
fatal: Not a git repository (or any of the parent directories): .git
child_process.js:644
    throw err;
    ^
Error: Command failed: git rev-parse HEAD
fatal: Not a git repository (or any of the parent directories): .git

Possible fixes

Catch the error thrown by childprocess.execSync (introduced by this pull request) and return an empty string. (Like BUILD_HASH = $(shell git rev-parse HEAD) in mattermost-server/Makefile.)

Most helpful comment

Thanks for the report. It's probably this line in the webpack.config.js that's causing the issue since we recently added it to show the web app's build hash in the About Mattermost modal.

I've filed a ticket in Jira here if you'd like to follow that, but in the mean time, you could have your script comment out that line from the webpack.config.js to have it build correctly.

All 5 comments

Thanks @SmartHoneybee,

I've asked one of our engineers to take a look and either they, or I, will post back here with feedback :)

@SmartHoneybee, can you elaborate on your workflow for modifying/building the source from the release vs. checking out the repository? You're right that this could be as simple as catching the error and returning an empty string, but just want to make sure we craft a holistic solution to other workflows.

@lieut-data, this is how I'm building Mattermost using your Github releases.

Thanks for the report. It's probably this line in the webpack.config.js that's causing the issue since we recently added it to show the web app's build hash in the About Mattermost modal.

I've filed a ticket in Jira here if you'd like to follow that, but in the mean time, you could have your script comment out that line from the webpack.config.js to have it build correctly.

Thanks @SmartHoneybee @lieut-data

I'll close off this issue here for now and we can track via the ticket that hmhealey linked above 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanmoo picture alanmoo  ·  30Comments

demedos picture demedos  ·  37Comments

kkirsche picture kkirsche  ·  37Comments

shochdoerfer picture shochdoerfer  ·  31Comments

faljse picture faljse  ·  36Comments