Skip to content

Commit e692933

Browse files
committed
Add FOSS license runtime stub
1 parent ace067e commit e692933

2 files changed

Lines changed: 95 additions & 2 deletions

File tree

.github/workflows/devsh-foss-image.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,98 @@ jobs:
190190
find /tmp/dist/bundle/programs/web.browser -type f -name "*.map" -delete || true
191191
du -sh /tmp/dist/bundle
192192
193+
- name: Install FOSS runtime license stub
194+
if: steps.cache-bundle.outputs.cache-hit != 'true'
195+
run: |
196+
set -euo pipefail
197+
license_dir=/tmp/dist/bundle/programs/server/npm/node_modules/@rocket.chat/license
198+
mkdir -p "${license_dir}/src/validation"
199+
cat > "${license_dir}/package.json" <<'JSON'
200+
{
201+
"name": "@rocket.chat/license",
202+
"version": "0.0.0-devsh-foss",
203+
"main": "index.js"
204+
}
205+
JSON
206+
cat > "${license_dir}/index.js" <<'JS'
207+
class DuplicatedLicenseError extends Error {
208+
constructor(message = 'Duplicated license') {
209+
super(message);
210+
this.name = 'DuplicatedLicense';
211+
}
212+
}
213+
214+
const noop = () => undefined;
215+
const noopAsync = async () => undefined;
216+
const falseSync = () => false;
217+
const falseAsync = async () => false;
218+
const emptyArray = () => [];
219+
220+
const License = {
221+
encryptedLicense: undefined,
222+
validateFormat: () => true,
223+
hasModule: falseSync,
224+
getModules: emptyArray,
225+
getExternalModules: emptyArray,
226+
getModuleDefinition: () => undefined,
227+
getTags: emptyArray,
228+
hasValidLicense: falseSync,
229+
getLicense: noopAsync,
230+
getGuestPermissions: noopAsync,
231+
shouldPreventAction: falseAsync,
232+
isLimitReached: falseAsync,
233+
onValidFeature: noop,
234+
onInvalidFeature: noop,
235+
onToggledFeature: noop,
236+
onModule: noop,
237+
onValidateLicense: noop,
238+
onInvalidateLicense: noop,
239+
onLimitReached: noop,
240+
onBehaviorTriggered: noop,
241+
onLicense: noop,
242+
getMaxActiveUsers: () => 0,
243+
getAppsConfig: () => ({}),
244+
getUnmodifiedLicenseAndModules: noop,
245+
overwriteClassOnLicense: (value) => value,
246+
setLicenseLimitCounter: noop,
247+
getCurrentValueForLicenseLimit: async () => 0,
248+
remove: noop,
249+
setLicense: falseAsync,
250+
revalidateLicense: noopAsync,
251+
sync: noopAsync
252+
};
253+
254+
const AirGappedRestriction = {
255+
restricted: false,
256+
computeRestriction: noopAsync,
257+
isWarningPeriod: falseSync,
258+
on: noop,
259+
off: noop
260+
};
261+
262+
const applyLicense = falseAsync;
263+
const applyLicenseOrRemove = falseAsync;
264+
265+
class LicenseManager {}
266+
class MockedLicenseBuilder {}
267+
268+
module.exports = {
269+
AirGappedRestriction,
270+
DuplicatedLicenseError,
271+
License,
272+
LicenseManager,
273+
MockedLicenseBuilder,
274+
applyLicense,
275+
applyLicenseOrRemove
276+
};
277+
JS
278+
cat > "${license_dir}/src/validation/validateLimit.js" <<'JS'
279+
module.exports = {
280+
validateLimit: () => false,
281+
validateWarnLimit: () => false
282+
};
283+
JS
284+
193285
- name: Store Meteor bundle cache artifact
194286
if: steps.cache-bundle.outputs.cache-hit != 'true'
195287
run: |

DEVSH.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ The `DevSH FOSS image` workflow builds a fully self-hosted FOSS Rocket.Chat imag
1818
3. Build shared packages.
1919
4. Run `yarn fossify`, which removes Enterprise and commercial source directories.
2020
5. Build the Meteor production bundle.
21-
6. Build and verify the Docker image.
22-
7. Publish immutable semver-compatible tags to `ghcr.io/devsh-graphics-programming/rocketchat-foss`.
21+
6. Add the DevSH FOSS runtime stub for the license package expected by shared Community code paths.
22+
7. Build the Docker image.
23+
8. Publish immutable semver-compatible tags to `ghcr.io/devsh-graphics-programming/rocketchat-foss`.
2324

2425
Runtime validation happens after deployment through the TerraInfra Rocket.Chat E2E checks. The image workflow stays focused on producing and publishing the DevSH FOSS container.
2526

0 commit comments

Comments
 (0)