From 21ed9bcbe389468771f112760e0f1ccb4527a0fb Mon Sep 17 00:00:00 2001 From: "octo-sts[bot]" <157150467+octo-sts[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:56:02 +0100 Subject: [PATCH] Adding VersionStream for mattermost-10.1 (#31701) Co-authored-by: octo-sts[bot] <157150467+octo-sts@users.noreply.github.com> --- mattermost-10.1.yaml | 220 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 mattermost-10.1.yaml diff --git a/mattermost-10.1.yaml b/mattermost-10.1.yaml new file mode 100644 index 00000000000..14d62a72426 --- /dev/null +++ b/mattermost-10.1.yaml @@ -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 < /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