Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 250 additions & 0 deletions mattermost-11.3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
package:
name: mattermost-11.3
# Note the npm version has been pinned to 10.8.3 to avoid the error:
# "npm error notsup Required: {"node":">=18.10.0","npm":"^9.0.0 || ^10.0.0"}"
version: "11.3.0"
epoch: 0 # GHSA-rwvp-r38j-9rgg
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=10.9.2 # Have to specify older version, or: "npm error notsup Required: {"node":">=18.10.0","npm":"^9.0.0 || ^10.0.0"}"
- 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: d27a2195068ddfa3ce17cf470f9739e4edb94b83

- 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

- runs: |
# Avoid go mod tidy from pulling enterprise go modules.
# Enterprise go modules need authentication to be fetched.
# This is reversed post go/bump
mv server/enterprise/external_imports.go server/enterprise/external_imports.go.orig

- runs: |
# Restore code importing enterprise go modules.
mv server/enterprise/external_imports.go.orig server/enterprise/external_imports.go

- 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
# test added by a robot (compat)
test:
pipeline:
- runs: |
readlink -v /entrypoint.sh
readlink -v /mattermost/bin/mattermost
readlink -v /mattermost/bin/mmctl
readlink -v /mattermost/client
readlink -v /mattermost/config
readlink -v /mattermost/data
readlink -v /mattermost/fonts
readlink -v /mattermost/i18n
readlink -v /mattermost/logs
readlink -v /mattermost/plugins
readlink -v /mattermost/templates

update:
enabled: true
git:
strip-prefix: v
tag-filter-prefix: v11.3

test:
environment:
contents:
packages:
- curl
- postgresql
- postgresql-client
- 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 &
# Additional delay required, otherwise mattermost can start before the mail server does.
sleep 10
- name: "Run application"
runs: |
# Make sure the exim mail server is still running
ps -elf| grep "exim"

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
Loading