-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding VersionStream for mattermost-10.1 (#31701)
Co-authored-by: octo-sts[bot] <[email protected]>
- Loading branch information
1 parent
e99ca48
commit 21ed9bc
Showing
1 changed file
with
220 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
package: | ||
name: mattermost-10.1 | ||
version: 10.1.1 | ||
epoch: 0 | ||
description: "Mattermost is an open source platform for secure collaboration across the entire software development lifecycle." | ||
copyright: | ||
- license: MIT | ||
- license: Apache-2.0 | ||
- license: AGPL-3.0-only | ||
dependencies: | ||
provides: | ||
- mattermost=${{package.full-version}} | ||
runtime: | ||
- bash | ||
- tzdata | ||
|
||
environment: | ||
contents: | ||
packages: | ||
- autoconf | ||
- automake | ||
- bash | ||
- build-base | ||
- ca-certificates-bundle | ||
- curl | ||
- gnupg-scdaemon | ||
- go | ||
- gpg | ||
- libimagequant-dev | ||
- libpng-dev | ||
- libtool | ||
- nodejs-20 | ||
- npm | ||
- pkgconf-dev | ||
- posix-libc-utils | ||
- wolfi-base | ||
- xmlsec-openssl | ||
- zlib-dev | ||
|
||
pipeline: | ||
- uses: git-checkout | ||
with: | ||
repository: https://github.com/mattermost/mattermost | ||
tag: v${{package.version}} | ||
expected-commit: b16e2e1dacb2ec44961573dc6a5d55ca47f77510 | ||
|
||
- runs: | | ||
mkdir -p ${{targets.contextdir}}/usr/bin | ||
for dir in bin data logs config plugins fonts i18n templates client test; do | ||
mkdir -p ${{targets.contextdir}}/etc/mattermost/$dir | ||
done | ||
- working-directory: server | ||
pipeline: | ||
- runs: make modules-tidy | ||
- runs: | | ||
# Our global LDFLAGS conflict with a Makefile parameter: `flag provided but not defined: -Wl,--as-needed,-O1,--sort-common` | ||
unset LDFLAGS | ||
make GOFLAGS="" config-reset | ||
make BUILD_ENTERPRISE=false BUILD_ENTERPRISE_READY=false BUILD_NUMBER=chainguard build-cmd | ||
make BUILD_ENTERPRISE=false BUILD_ENTERPRISE_READY=false package-linux | ||
mv ./bin/mattermost ${{targets.contextdir}}/usr/bin/ | ||
mv ./bin/mmctl ${{targets.contextdir}}/usr/bin/ | ||
mv ./dist/mattermost/* ${{targets.contextdir}}/etc/mattermost/ | ||
cp -a ./i18n/* ${{targets.contextdir}}/etc/mattermost/i18n/ | ||
mkdir -p ${{targets.contextdir}}/etc/mattermost/client/plugins | ||
cp ./config/config.json ${{targets.contextdir}}/etc/mattermost/config/config.json | ||
cp ./build/MIT-COMPILED-LICENSE.md ${{targets.contextdir}}/etc/mattermost/MIT-COMPILED-LICENSE.md | ||
cp ../LICENSE.txt ${{targets.contextdir}}/etc/mattermost/LICENSE.txt | ||
cp ./build/entrypoint.sh ${{targets.contextdir}}/usr/bin/entrypoint.sh | ||
- uses: strip | ||
|
||
subpackages: | ||
- name: ${{package.name}}-compat | ||
description: Compatibility package to place binaries in the location expected by upstream Dockerfile | ||
pipeline: | ||
- runs: | | ||
mkdir -p ${{targets.contextdir}}/mattermost | ||
for dir in data logs config plugins fonts i18n templates client; do | ||
ln -sf /etc/mattermost/$dir ${{targets.contextdir}}/mattermost/$dir | ||
done | ||
mkdir -p ${{targets.contextdir}}/mattermost/bin | ||
ln -sf /usr/bin/mattermost ${{targets.contextdir}}/mattermost/bin/mattermost | ||
ln -sf /usr/bin/mmctl ${{targets.contextdir}}/mattermost/bin/mmctl | ||
ln -sf /usr/bin/entrypoint.sh ${{targets.contextdir}}/entrypoint.sh | ||
update: | ||
enabled: true | ||
github: | ||
identifier: mattermost/mattermost | ||
strip-prefix: v | ||
tag-filter: v10.1 | ||
|
||
test: | ||
environment: | ||
contents: | ||
packages: | ||
- curl | ||
- postgresql | ||
- postgresql-client | ||
- wolfi-base | ||
- shadow | ||
- sudo-rs | ||
- glibc-locales | ||
- ${{package.name}}-compat | ||
- exim | ||
environment: | ||
PGDATA: /tmp/test_db | ||
PGUSER: mmuser | ||
PGPASS: mostest | ||
PGDB: mattermost_test | ||
pipeline: | ||
- name: "Check binaries" | ||
runs: | | ||
mattermost version | ||
mmctl version | ||
entrypoint.sh --help | ||
mattermost --help | ||
mmctl --help | ||
- name: "Fetch database dump" | ||
runs: | | ||
curl https://raw.githubusercontent.com/mattermost/mattermost/v${{package.version}}/server/scripts/mattermost-postgresql-6.0.0.sql -o /etc/mattermost/test/mattermost-postgresql-6.0.0.sql | ||
- name: "Prepare database" | ||
runs: | | ||
useradd postgres | ||
sudo -u postgres initdb -D ${PGDATA} | ||
sudo -u postgres pg_ctl -D ${PGDATA} -l /tmp/logfile start | ||
sudo -u postgres createdb ${PGDB} | ||
sudo -u postgres psql -d postgres -c "CREATE USER ${PGUSER} WITH PASSWORD '${PGPASS}';" | ||
sudo -u postgres psql -d ${PGDB} -c "GRANT ALL PRIVILEGES ON SCHEMA public TO ${PGUSER};" | ||
sudo -u postgres psql -U $PGUSER -d $PGDB -f /etc/mattermost/test/mattermost-postgresql-6.0.0.sql | ||
- name: "Prepare mailserver on port 10025" | ||
runs: | | ||
cat <<EOF > /etc/exim/exim.conf | ||
# Minimal Exim configuration | ||
# Main configuration | ||
primary_hostname = localhost | ||
daemon_smtp_ports = 10025 | ||
spool_directory = /var/spool/exim | ||
log_file_path = /var/log/exim/%s | ||
# Routers | ||
begin routers | ||
localuser: | ||
driver = accept | ||
check_local_user | ||
transport = local_delivery | ||
# Transports | ||
begin transports | ||
remote_smtp: | ||
driver = smtp | ||
local_delivery: | ||
driver = appendfile | ||
file = /var/mail/\${local_part} | ||
delivery_date_add | ||
envelope_to_add | ||
return_path_add | ||
EOF | ||
mkdir -p /var/spool/exim /var/log/exim /var/mail | ||
addgroup -S exim | ||
adduser -S -G exim exim | ||
chown -R exim:exim /var/spool/exim /var/log/exim /var/mail | ||
exim -bd -oX 10025 & | ||
- name: "Run application" | ||
runs: | | ||
cd /mattermost # Set working directory | ||
/entrypoint.sh mattermost > /tmp/logs.txt 2>&1 & | ||
PID=$! | ||
sleep 15 # ensure that enough time is given for the logs to get written | ||
logs_to_expect=" | ||
Server is initializing... | ||
Starting websocket hubs | ||
Loaded system translations | ||
Loaded config | ||
Starting workers | ||
Starting schedulers. | ||
Starting up plugins | ||
Server is listening on | ||
" | ||
echo "$logs_to_expect" | while IFS= read -r log; do | ||
if [ -z "$log" ]; then | ||
continue | ||
fi | ||
if ! grep -F -i "$log" /tmp/logs.txt; then | ||
cat /tmp/logs.txt | ||
echo "Expected log '$log' not found!" | ||
exit 1 | ||
fi | ||
done | ||
logs_to_not_expect=" | ||
connection refused | ||
unable to load | ||
" | ||
# Use a while loop with a read command to handle multi-line strings | ||
echo "$logs_to_not_expect" | while IFS= read -r log; do | ||
if [ -z "$log" ]; then | ||
continue | ||
fi | ||
if grep -F -i "$log" /tmp/logs.txt; then | ||
cat /tmp/logs.txt | ||
echo "Unexpected log '$log' found!" | ||
exit 1 | ||
fi | ||
done | ||
kill $PID |