Unverified Commit c5b3a5cc authored by Morgan Jones's avatar Morgan Jones
Browse files

mattermost: 10.11.15 -> 11.6.1

Note that this is not yet an ESR. However, 10 -> 11 will be breaking and
11.6 -> 11.7 (which is an ESR) will not be. So push mattermost to be
identical to mattermostLatest until the two diverge.
parent 1812f150
Loading
Loading
Loading
Loading
+16 −18
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
  buildGoModule,
  fetchFromGitHub,
  buildNpmPackage,
  nodejs_22,
  nodejs,
  nix-update-script,
  npm-lockfile-fix,
  fetchNpmDeps,
@@ -13,20 +13,21 @@
  nixosTests,

  versionInfo ? {
    # ESR releases only.
    # See https://docs.mattermost.com/upgrade/extended-support-release.html
    # ESR releases only. Note: if NixOS would release with an ESR that goes out
    # of support during the lifetime of the NixOS release, it is acceptable
    # to put the latest non-ESR release here if we change it to an ESR shortly after
    # the NixOS release.
    #
    # See <https://docs.mattermost.com/upgrade/extended-support-release.html>.
    # When a new ESR version is available (e.g. 8.1.x -> 9.5.x), update
    # the version regex here as well.
    #
    # Ensure you also check ../mattermostLatest/package.nix.
    regex = "^v(10\\.11\\.[0-9]+)$";
    version = "10.11.15";
    srcHash = "sha256-b/hXZHYULl9nNJZT4GtKsaOfX8BEzz/v3Uy3EEbzN8U=";
    vendorHash = "sha256-Z94d1eCIkuMG72Mlvk5su/99+4kJoaeHxaeZuk96Hlc=";
    npmDepsHash = "sha256-p9dq31qw0EZDQIl2ysKE38JgDyLA6XvSv+VtHuRh+8A=";
    lockfileOverlay = ''
      unlock(.; "@floating-ui/react"; "channels/node_modules/@floating-ui/react")
    '';
    regex = "^v(11\\.[67]\\.[0-9]+)$";
    version = "11.6.1";
    srcHash = "sha256-0TUh5qKi64jt3YhgCTceoizOGzqyt70Rh8VH+bSfS5o=";
    vendorHash = "sha256-bWl1rdVRTOJzS2HKKsSRhzVcH1sPgEAlRLjrc+/o0lo=";
    npmDepsHash = "sha256-30xwoizNh6fAWS0YdEheXtcO6I9MjoFdCekvLnnoBMc=";
  },
  ...
}:
@@ -223,9 +224,7 @@ buildMattermost rec {
          --replace-fail 'options: {}' 'options: { disable: true }'
      '';

      # https://github.com/NixOS/nixpkgs/issues/474535
      nodejs = nodejs_22;

      inherit nodejs;
      npmDepsHash = npmDeps.hash;
      makeCacheWritable = true;
      forceGitDeps = true;
@@ -235,10 +234,9 @@ buildMattermost rec {
      buildPhase = ''
        runHook preBuild

        npm run build --workspace=platform/types
        npm run build --workspace=platform/client
        npm run build --workspace=platform/components
        npm run build --workspace=channels
        for ws in platform/{types,client,components,shared} channels; do
          npm run build --workspace="$ws"
        done

        runHook postBuild
      '';
+0 −86
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@
  gotestsum,
  which,
  postgresql,
  mariadb,
  redis,
  curl,
  net-tools,
@@ -20,7 +19,6 @@ mattermost.overrideAttrs (
    nativeCheckInputs = [
      which
      postgresql
      mariadb
      redis
      curl
      net-tools
@@ -113,11 +111,6 @@ mattermost.overrideAttrs (
        fi
      }

      # Waits for MySQL to come up or down.
      wait_mysql() {
        wait_cmd mysql "$1" mysqladmin ping
      }

      # Waits for Postgres to come up or down.
      wait_postgres() {
        wait_cmd postgres "$1" pg_isready -h localhost
@@ -128,33 +121,6 @@ mattermost.overrideAttrs (
        wait_cmd redis "$1" redis-cli ping
      }

      # Starts MySQL.
      start_mysql() {
        echo "Starting MySQL at $MYSQL_HOME" >&2
        mysqld &
        mysql_pid=$!
        echo "... PID $mysql_pid" >&2
        wait_mysql up
      }

      # Stops MySQL.
      stop_mysql() {
        if [ "$mysql_pid" -gt 0 ]; then
          echo "Terminating MySQL at $MYSQL_HOME (PID $mysql_pid)" >&2
          mysqladmin --host=127.0.0.1 --user=root --password=mostest --wait-for-all-slaves --shutdown-timeout=30 shutdown
          wait_mysql down
          wait_cmd 'mysql pid' down kill -0 "$mysql_pid"

          # Make sure the worker PID went down too (but it may be already gone).
          local worker_pid="$(<"$MYSQL_HOME"/mysqld.pid || echo 0)"
          if [ -n "$worker_pid" ] && [ $worker_pid -gt 0 ]; then
            wait_cmd 'mysql workers' down kill -0 "$worker_pid"
          fi

          mysql_pid=0
        fi
      }

      # Starts Postgres.
      start_postgres() {
        echo "Starting Postgres at $PGDATA" >&2
@@ -186,52 +152,6 @@ mattermost.overrideAttrs (
        redis_pid=0
      }

      # Configure MySQL.
      export MYSQL_HOME="$NIX_BUILD_TOP/.mysql"
      mkdir -p "$MYSQL_HOME"
      cat <<EOF >"$MYSQL_HOME/my.cnf"
      [client]
      port = 3306
      default-character-set = utf8mb4
      socket = $MYSQL_HOME/mysqld.sock

      [mysqld]
      skip-host-cache
      skip-name-resolve
      basedir = ${mariadb}
      datadir = $MYSQL_HOME/
      pid-file = $MYSQL_HOME/mysqld.pid
      socket = $MYSQL_HOME/mysqld.sock
      port = 3306
      explicit_defaults_for_timestamp
      collation-server = utf8mb4_general_ci
      init-connect = 'SET NAMES utf8mb4'
      character-set-server = utf8mb4
      EOF

      # Start MySQL.
      mysql_install_db --skip-name-resolve --auth-root-authentication-method=normal
      start_mysql

      # Init MySQL.
      cat <<EOF | mysql --defaults-file="$MYSQL_HOME/my.cnf" -u root -v
      -- This is the admin password for tests; see the docker-compose:
      -- https://github.com/mattermost/mattermost/blob/v${final.version}/server/docker-compose.yaml
      create user if not exists 'mmuser' identified by 'mostest';
      create database if not exists mattermost_test;
      grant all privileges on *.* to 'mmuser' with grant option;

      -- Also need to set up root (tests seem to override the user to root)
      alter user 'root'@'127.0.0.1' identified by 'mostest';

      flush privileges;
      show grants for 'root'@'127.0.0.1';
      show grants for 'mmuser';
      EOF

      # Need to change this so we use 127.0.0.1 in tests.
      export TEST_DATABASE_MYSQL_DSN='root:mostest@tcp(127.0.0.1:3306)/mattermost_test?charset=utf8mb4&readTimeout=30s&writeTimeout=30s'

      # Start Postgres.
      export PGDATA="$NIX_BUILD_TOP/.postgres"
      initdb -E UTF8 -U postgres
@@ -284,12 +204,6 @@ mattermost.overrideAttrs (
    '';

    postCheck = ''
      # Clean up MySQL.
      if [ -d "$MYSQL_HOME" ]; then
        stop_mysql
        rm -rf "$MYSQL_HOME"
      fi

      # Clean up Postgres.
      if [ -d "$PGDATA" ]; then
        stop_postgres
+1 −22
Original line number Diff line number Diff line
@@ -3,25 +3,4 @@
  ...
}@args:

mattermost.override (
  {
    versionInfo = {
      # Latest, non-RC releases only.
      # If the latest is an ESR (Extended Support Release),
      # duplicate it here to facilitate the update script.
      # See https://docs.mattermost.com/about/mattermost-server-releases.html
      # and make sure the version regex is up to date here.
      # Ensure you also check ../mattermost/package.nix for ESR releases.
      regex = "^v(11\\.[0-9]+\\.[0-9]+)$";
      version = "11.5.3";
      srcHash = "sha256-r7rfiQ4C0E511QWdpQihydsuoRZCzboodmh1iT4a8r4=";
      vendorHash = "sha256-/ts6j86tvbYFjVACkJwcSnXDd+8BXzpaFVdV9DRHkqY=";
      npmDepsHash = "sha256-r7iq1pCAJjFyspZBdeNWe00W7A3l73PGC6rrsZ7O6Uw=";
      lockfileOverlay = ''
        unlock(.; "@floating-ui/react"; "channels/node_modules/@floating-ui/react")
      '';
      autoUpdate = ./package.nix;
    };
  }
  // args
)
mattermost.override args