Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sync develop with newest 7.x version changes #72

Merged
merged 15 commits into from
Nov 13, 2024
6 changes: 3 additions & 3 deletions .github/workflows/force_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
ref: ${{ github.ref_name }}
path: server-snap

- name: Set variables
id: prepare
working-directory: server-snap
Expand All @@ -34,11 +34,11 @@ jobs:
id: snap-build
with:
path: server-snap

- name: 'Clone tests repository'
uses: actions/checkout@v3
with:
repository: debdutdeb/rocket.chat.tests
repository: RocketChat/public-releases
submodules: true
path: tests

Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,34 @@ on:
required: true
github-token:
required: true
workflow_dispatch:
# this trigger uses existing version for release

jobs:
prereqs:
runs-on: ubuntu-latest
outputs:
version: ${{ steps._id.outputs.version }}
steps:
- shell: bash
id: _id
run: |
tag=
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
tag="$(awk -F: '/^version:/ snap/snapcraft.yaml {print $2}' | tr -d '[:space:]')"
else
tag="${{inputs.tag}}"
fi

echo "tag: $tag"
echo "version=$tag" >> $GITHUB_OUTPUT


build-and-test:
needs: [ prereqs ]
uses: RocketChat/server-snap/.github/workflows/test.yml@develop
with:
tag: ${{ inputs.tag }}
tag: ${{ needs.prereqs.outputs.version }}

release:
if: '! contains(inputs.tag, ''rc'')'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Build and test snap
on:
pull_request:
branches: '**'
# - develop

jobs:
variables:
Expand All @@ -20,9 +19,12 @@ jobs:
echo "tag=$tag" >> $GITHUB_OUTPUT

build-and-test:
uses: RocketChat/server-snap/.github/workflows/test.yml@develop
# uses: RocketChat/server-snap/.github/workflows/test.yml@${{ github.head_ref || github.ref_name }}
uses: RocketChat/server-snap/.github/workflows/[email protected]
needs: [variables]
with:
tag: ${{ needs.variables.outputs.tag }}
test-only: 'true'
secrets:
snapcraft-credential: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}

18 changes: 17 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
required: false
type: string
default: 'false'
secrets:
snapcraft-credential:
required: false
outputs:
snap-basename:
value: ${{ jobs.build.outputs.snap-basename }}
Expand All @@ -35,8 +38,11 @@ jobs:
commit: ${{ steps.prepare.outputs.commit }}
run: ${{ steps.prepare.outputs.run }}
candidate: ${{ steps.prepare.outputs.candidate }}
last-channel: ${{ steps.prepare.outputs.last-channel }}
runs-on: ubuntu-latest
steps:
- uses: samuelmeuli/action-snapcraft@v2
name: 'Install snapcraft'
- name: 'Clone repository'
uses: actions/checkout@v3
with:
Expand All @@ -45,6 +51,8 @@ jobs:
- name: 'Prepare for next steps'
id: prepare
shell: bash
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.snapcraft-credential }}
run: |
version=${{ inputs.tag }}
snap_track="${version:0:1}.x"
Expand Down Expand Up @@ -86,6 +94,13 @@ jobs:
echo "run=$run" >> $GITHUB_OUTPUT
echo "commit=$commit" >>$GITHUB_OUTPUT

if ! snapcraft list-revisions rocketchat-server | tail -n '+2' | grep -q "$snap_track/stable"; then
last_channel="$((${version:0:1}-1)).x/stable"
fi

echo "last_channel: $last_channel"
echo "last-channel=$last_channel" >> $GITHUB_OUTPUT

build:
needs:
- prepare
Expand Down Expand Up @@ -139,12 +154,13 @@ jobs:
- name: 'Clone tests repository'
uses: actions/checkout@v3
with:
repository: debdutdeb/rocket.chat.tests
repository: RocketChat/public-releases
submodules: true

- name: 'Run tests'
shell: bash
env:
ROCKETCHAT_PREVIOUS_CHANNEL: ${{ needs.prepare.outputs.last-channel }}
ROCKETCHAT_TAG: ${{ inputs.tag }}
run: |
sudo apt-get --no-install-recommends install jo jq -y
Expand Down
2 changes: 1 addition & 1 deletion MONGO_UPDATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## 1. Enable migration

```sh
chmod +x migrations/pre_refresh/feature_compatibility/00-adopt-version.sh
chmod +x migrations/pre_refresh/feature_compatibility/00-adopt_version.sh
```

This migration or pre-refresh script will make sure the feature compatibility version of the existing mongodb instance is set correctly for the update to pass through successfully.
Expand Down
5 changes: 5 additions & 0 deletions helpers/mongo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ MAX_MONGOD_START_RETRY_COUNT=30
MAX_MONGOD_PRIMARY_WAIT_SECONDS=5
MAX_MONGOD_PRIMARY_RETRY_COUNT=10

mongo() {
# TODO switch to mongosh commands all over
mongosh "$@"
}

is_mongod_running() {
local pid_file
if ! pid_file=$(yq -e e .processManagement.pidFilePath $SNAP_DATA/mongod.conf); then
Expand Down
3 changes: 3 additions & 0 deletions helpers/rocketchat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ start_rocketchat() {
export MONGO_OPLOG_URL=$(snapctl get mongo-oplog-url)
export ROOT_URL=$(snapctl get siteurl)
export REG_TOKEN=$(snapctl get reg-token)
export DENO_DIR="$SNAP_COMMON/deno"

[[ -d "$DENO_DIR" ]] || mkdir -p "$DENO_DIR"

# We know that mongodb IS running
# Let's save the PID someplace
Expand Down
Empty file modified migrations/pre_refresh/feature_compatibity/00-adopt_version.sh
100644 → 100755
Empty file.
34 changes: 28 additions & 6 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: rocketchat-server
title: Rocket.Chat Server
base: core20
version: 6.5.2
version: 7.0.0
summary: An Open Source Slack Alternative
description: |
Have your own Slack like online chat, built with Meteor. https://rocket.chat/

epoch: 10
epoch: 10*

grade: stable
confinement: strict
Expand Down Expand Up @@ -49,7 +49,12 @@ apps:
- network-bind

mongo:
command: bin/mongo
command: usr/bin/mongosh
environment: {LC_ALL: C}
plugs: [network]

mongosh:
command: usr/bin/mongosh
environment: {LC_ALL: C}
plugs: [network]

Expand Down Expand Up @@ -80,7 +85,8 @@ parts:
# - on amd64: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.0.27.tgz
#- on amd64: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.17.tgz
#- on amd64: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-4.4.15.tgz
- on amd64: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.15.tgz
# - on amd64: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.15.tgz
- on amd64: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.19.tgz
# - on arm64: https://fastdl.mongodb.org/linux/mongodb-linux-arm64-ubuntu1604-3.6.23.tgz
- on arm64: https://fastdl.mongodb.org/linux/mongodb-linux-arm64-ubuntu1604-4.0.28.tgz
stage-packages:
Expand Down Expand Up @@ -113,26 +119,42 @@ parts:
plugin: dump
source:
#- on amd64: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.5.0.tgz
- on amd64: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.7.0.tgz
# - on amd64: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.7.0.tgz
- on amd64: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.10.0.tgz
# - on arm64: https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-arm64-100.5.0.tgz
stage:
- bin/mongodump
- bin/mongorestore

mongosh:
plugin: dump
source: https://downloads.mongodb.com/compass/mongodb-mongosh_2.3.3_amd64.deb
source-type: deb

node:
plugin: dump
source:
#- on amd64: https://nodejs.org/download/release/v12.22.8/node-v12.22.8-linux-x64.tar.gz
#- on amd64: https://nodejs.org/download/release/v14.18.3/node-v14.18.3-linux-x64.tar.xz
#- on amd64: https://nodejs.org/download/release/v14.19.3/node-v14.19.3-linux-x64.tar.xz
- on amd64: https://nodejs.org/download/release/v14.21.2/node-v14.21.2-linux-x64.tar.xz
# - on amd64: https://nodejs.org/download/release/v14.21.2/node-v14.21.2-linux-x64.tar.xz
- on amd64: https://nodejs.org/dist/v20.18.0/node-v20.18.0-linux-x64.tar.xz
#- on arm64: https://nodejs.org/download/release/v12.22.8/node-v12.22.8-linux-arm64.tar.gz
- on arm64: https://nodejs.org/download/release/v14.18.3/node-v14.18.3-linux-arm64.tar.gz
stage:
- bin
- include
- lib

deno:
plugin: dump
# https://github.com/RocketChat/Rocket.Chat/blob/3bd70ee2165942a0fc731dbfd16482362eb5114a/apps/meteor/.docker/Dockerfile.debian#L1
source:
- on amd64: https://github.com/denoland/deno/releases/download/v1.37.1/deno-x86_64-unknown-linux-gnu.zip
source-type: zip
organize:
deno: bin/deno # https://github.com/RocketChat/public-releases/blob/96976fbc0e263658e55281472b3fd04b77defc1b/snap/snap.bats#L58

# libvips:
# source:
# - on arm64: https://github.com/libvips/libvips/releases/download/v8.12.2/vips-8.12.2.tar.gz
Expand Down
Loading