mirror of
https://github.com/SmartHoneybee/ubiquitous-memory
synced 2025-04-29 23:29:39 +02:00
* Bump github.com/mattermost/mattermost-server/v6 in /dependabot Bumps [github.com/mattermost/mattermost-server/v6](https://github.com/mattermost/mattermost-server) from 6.2.1 to 6.3.0. - [Release notes](https://github.com/mattermost/mattermost-server/releases) - [Changelog](https://github.com/mattermost/mattermost-server/blob/master/CHANGELOG.md) - [Commits](https://github.com/mattermost/mattermost-server/compare/v6.2.1...v6.3.0) --- updated-dependencies: - dependency-name: github.com/mattermost/mattermost-server/v6 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Add python2 dependency Apparently something in 6.3.0 is using python2 for the first time? * Use node v15 by default We are now getting this error when building: /build/.node-gyp/16.13.2/include/node/v8-internal.h:492:38: error: 'remove_cv_t' is not a member of 'std' which the internet suggests is a problem with node 16 and node-sass. According to https://stackoverflow.com/questions/67241196/error-no-template-named-remove-cv-t-in-namespace-std-did-you-mean-remove , supposedly newer versions of node-sass support node 16, and the other solution is to pass -std=c++14 instead of c++0x (which is what is being done right now), but I can't say for sure whether this build script will work with CXXFLAGS or not. The other fix would seem to be to update node-sass to a version that supports node16, but that would presumably be more patching of files, this time in mattermost-webapp, so I'm trying the least-invasive option first. * Update release.mk patch * Update how we retrieve the Mattermost version With mmctl in the require list in the go.mod, mattermost-server no longer appears on the same line as the require statement, so splitting by spaces means we now need the second split entry instead of the third. We could also fix this by removing mmctl from the go.mod, which I was going to do, but that means every Dependabot update would no longer work. So going forward we will need to ensure that the go.mod always has the mattermost-server require on its own line instead of inline with the require statement. Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: parnic-sks <chris@straykitestudios.com>
136 lines
5.9 KiB
Bash
Executable File
136 lines
5.9 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eux
|
|
# build user
|
|
BUILD_USER_HOME="${BUILD_USER_HOME:-/build}"
|
|
BUILD_USER_NAME="${BUILD_USER_NAME:-build}"
|
|
# Debian release used during build
|
|
DEBIAN_RELEASE="${DEBIAN_RELEASE:-stretch}"
|
|
# Mattermost version to build
|
|
MATTERMOST_RELEASE="${MATTERMOST_RELEASE:-v5.26.0}"
|
|
MMCTL_RELEASE="${MMCTL_RELEASE:-v5.26.0}"
|
|
# node key id and release
|
|
NODE_KEY="${NODE_KEY:-9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280}"
|
|
NODE_RELEASE="${NODE_RELEASE:-15}"
|
|
# golang version
|
|
GO_VERSION="${GO_VERSION:-1.16.7}"
|
|
|
|
if [ "$(id -u)" -eq 0 ]; then # as root user
|
|
# create build user, if needed
|
|
set +e
|
|
if ! id -u "${BUILD_USER_NAME}"; then # create build user
|
|
set -e
|
|
useradd --create-home --home-dir "${BUILD_USER_HOME}" --skel "${PWD}" \
|
|
"${BUILD_USER_NAME}"
|
|
fi
|
|
set -e
|
|
# configure apt
|
|
printf 'APT::Install-Recommends "0";' \
|
|
> '/etc/apt/apt.conf.d/99-no-install-recommends'
|
|
printf 'APT::Install-Suggests "0";' \
|
|
> '/etc/apt/apt.conf.d/99-no-install-suggests'
|
|
printf 'APT::Get::Assume-Yes "true";' \
|
|
> '/etc/apt/apt.conf.d/99-assume-yes'
|
|
# update repositories
|
|
apt-get update
|
|
# dependencies to setup repositories
|
|
apt-get install --quiet \
|
|
gnupg2 dirmngr apt-transport-https ca-certificates curl
|
|
# receive missing key
|
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
|
|
# add required additional repositories
|
|
printf 'deb-src http://deb.debian.org/debian %s main' "${DEBIAN_RELEASE}" \
|
|
> "/etc/apt/sources.list.d/${DEBIAN_RELEASE}-source.list"
|
|
printf 'deb http://deb.debian.org/debian %s-backports main' "${DEBIAN_RELEASE}" \
|
|
> "/etc/apt/sources.list.d/${DEBIAN_RELEASE}-backports.list"
|
|
printf 'deb https://deb.nodesource.com/node_%s.x %s main' "${NODE_RELEASE}" "${DEBIAN_RELEASE}" \
|
|
> '/etc/apt/sources.list.d/nodesource.list'
|
|
# update repositories
|
|
apt-get update
|
|
# install dependencies
|
|
apt-get install --quiet \
|
|
wget build-essential patch git nodejs python2
|
|
# install 'pngquant' build dependencies (required by node module)
|
|
apt-get build-dep --quiet \
|
|
pngquant
|
|
# install go from golang.org
|
|
wget https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz
|
|
tar -xvf go${GO_VERSION}.linux-amd64.tar.gz
|
|
mv go /usr/local
|
|
export GOROOT=/usr/local/go
|
|
export PATH=$GOROOT/bin:$PATH
|
|
# FIXME go (executed by build user) writes to GOROOT
|
|
install --directory --owner="${BUILD_USER_NAME}" \
|
|
"$(go env GOROOT)/pkg/$(go env GOOS)_$(go env GOARCH)"
|
|
# Re-invoke this build.sh script with the 'build' user
|
|
runuser -u "${BUILD_USER_NAME}" -- "${0}"
|
|
# salvage build artifacts
|
|
cp --verbose \
|
|
"${BUILD_USER_HOME}/mattermost-${MATTERMOST_RELEASE}-$(go env GOOS)-$(go env GOARCH).tar.gz" \
|
|
"${BUILD_USER_HOME}/mattermost-${MATTERMOST_RELEASE}-$(go env GOOS)-$(go env GOARCH).tar.gz.sha512sum" \
|
|
"${HOME}"
|
|
exit 0
|
|
fi
|
|
# as non-root user
|
|
export GOROOT=/usr/local/go
|
|
export PATH=$GOROOT/bin:$PATH
|
|
cd "${HOME}"
|
|
# download and extract Mattermost sources
|
|
for COMPONENT in server webapp; do
|
|
install --directory "${HOME}/go/src/github.com/mattermost/mattermost-${COMPONENT}"
|
|
wget --quiet --continue --output-document="mattermost-${COMPONENT}.tar.gz" \
|
|
"https://github.com/mattermost/mattermost-${COMPONENT}/archive/${MATTERMOST_RELEASE}.tar.gz"
|
|
tar --directory="${HOME}/go/src/github.com/mattermost/mattermost-${COMPONENT}" \
|
|
--strip-components=1 --extract --file="mattermost-${COMPONENT}.tar.gz"
|
|
done
|
|
# prepare the go build environment
|
|
install --directory "${HOME}/go/bin"
|
|
if [ "$(go env GOOS)_$(go env GOARCH)" != 'linux_amd64' ]; then
|
|
ln --symbolic \
|
|
"${HOME}/go/bin/$(go env GOOS)_$(go env GOARCH)" \
|
|
"${HOME}/go/bin/linux_amd64"
|
|
fi
|
|
# build mmctl
|
|
install --directory "${HOME}/go/src/github.com/mattermost/mmctl"
|
|
wget --quiet --continue --output-document="mmctl.tar.gz" \
|
|
"https://github.com/mattermost/mmctl/archive/${MMCTL_RELEASE}.tar.gz"
|
|
tar --directory="${HOME}/go/src/github.com/mattermost/mmctl" \
|
|
--strip-components=1 --extract --file="mmctl.tar.gz"
|
|
find "${HOME}/go/src/github.com/mattermost/mmctl/" -type f -name '*.go' | xargs \
|
|
sed -i \
|
|
-e 's#//go:build linux || darwin#//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd#' \
|
|
-e 's#// +build linux darwin#// +build linux darwin dragonfly freebsd netbsd openbsd#'
|
|
make --directory="${HOME}/go/src/github.com/mattermost/mmctl" \
|
|
BUILD_NUMBER="dev-$(go env GOOS)-$(go env GOARCH)-${MMCTL_RELEASE}" \
|
|
ADVANCED_VET=0 \
|
|
GO="GOARCH= GOOS= $(command -v go)"
|
|
# build Mattermost webapp
|
|
npm set progress false
|
|
sed -i -e 's#--verbose#--display minimal#' \
|
|
"${HOME}/go/src/github.com/mattermost/mattermost-webapp/package.json"
|
|
make --directory="${HOME}/go/src/github.com/mattermost/mattermost-webapp" \
|
|
build
|
|
# build Mattermost server
|
|
patch --directory="${HOME}/go/src/github.com/mattermost/mattermost-server" \
|
|
--strip=1 -t < "${HOME}/build-release.patch"
|
|
sed -i \
|
|
-e 's#go generate#env --unset=GOOS --unset=GOARCH go generate#' \
|
|
-e 's#$(GO) generate#env --unset=GOOS --unset=GOARCH go generate#' \
|
|
-e 's#PWD#CURDIR#' \
|
|
"${HOME}/go/src/github.com/mattermost/mattermost-server/Makefile" \
|
|
"${HOME}/go/src/github.com/mattermost/mattermost-server/build/release.mk"
|
|
make --directory="${HOME}/go/src/github.com/mattermost/mattermost-server" \
|
|
config-reset \
|
|
BUILD_NUMBER="dev-$(go env GOOS)-$(go env GOARCH)-${MATTERMOST_RELEASE}" \
|
|
GO="GOARCH= GOOS= $(command -v go)" \
|
|
PLUGIN_PACKAGES=''
|
|
make --directory="${HOME}/go/src/github.com/mattermost/mattermost-server" \
|
|
build-linux package-linux \
|
|
BUILD_NUMBER="dev-$(go env GOOS)-$(go env GOARCH)-${MATTERMOST_RELEASE}" \
|
|
GO="GOARCH=$(go env GOARCH) GOOS=$(go env GOOS) $(command -v go)" \
|
|
PLUGIN_PACKAGES=''
|
|
# rename archive and calculate its SHA512 sum
|
|
mv "${HOME}/go/src/github.com/mattermost/mattermost-server/dist/mattermost-team-linux-amd64.tar.gz" \
|
|
"${HOME}/mattermost-${MATTERMOST_RELEASE}-$(go env GOOS)-$(go env GOARCH).tar.gz"
|
|
sha512sum "${HOME}/mattermost-${MATTERMOST_RELEASE}-$(go env GOOS)-$(go env GOARCH).tar.gz" | \
|
|
tee "${HOME}/mattermost-${MATTERMOST_RELEASE}-$(go env GOOS)-$(go env GOARCH).tar.gz.sha512sum"
|