Merge branch 'develop' into fix/backend-core-test-types
This commit is contained in:
commit
0f0533ff2b
|
@ -115,77 +115,4 @@ This job is responsible for deploying to our production, cloud kubernetes enviro
|
|||
### Rollback A Bad Cloud Deployment
|
||||
- Kick off cloud deploy job
|
||||
- Ensure you are running off master
|
||||
- Enter the version number of the last known good version of budibase. For example `1.0.0`
|
||||
|
||||
## Pro
|
||||
|
||||
| **NOTE**: When developing for both pro / budibase repositories, your branch names need to match, or else the correct pro doesn't get run within your CI job.
|
||||
|
||||
### Installing Pro
|
||||
|
||||
The pro package is always installed from source in our CI jobs.
|
||||
|
||||
This is done to prevent pro needing to be published prior to CI runs in budiabse. This is required for two reasons:
|
||||
- To reduce developer need to manually bump versions, i.e:
|
||||
- release pro, bump pro dep in budibase, now ci can run successfully
|
||||
- The cyclic dependency on backend-core, i.e:
|
||||
- pro depends on backend-core
|
||||
- server depends on pro
|
||||
- backend-core lives in the monorepo, so it can't be released independently to be used in pro
|
||||
- therefore the only option is to pull pro from source and release it as a part of the monorepo release, as if it were a mono package
|
||||
|
||||
The install is performed using the same steps as local development, via the `yarn bootstrap` command, see the [Contributing Guide#Pro](../../docs/CONTRIBUTING.md#pro)
|
||||
|
||||
The branch to install pro from can vary depending on ref of the commit that triggered the budibase CI job. This is done to enable branches which have changes in both the monorepo and the pro repo to have their CI pass successfully.
|
||||
|
||||
This is done using the [pro/install.sh](../../scripts/pro/install.sh) script. The script will:
|
||||
- Clone pro to it's default branch (`develop`)
|
||||
- Check if the clone worked, on forked versions of budibase this will fail due to no access
|
||||
- This is fine as the `yarn` command will install the version from NPM
|
||||
- Community PRs should never touch pro so this will always work
|
||||
- Checkout the `BRANCH` argument, if this fails fallback to `BASE_BRANCH`
|
||||
- This enables the more complex case of a feature branch being merged to another feature branch, e.g.
|
||||
- I am working on a branch `epic/stonks` which exists on budibase and pro.
|
||||
- I want to merge a change to this branch in budibase from `feature/stonks-ui`, which only exists in budibase
|
||||
- The base branch ensures that `epic/stonks` in pro will still be checked out for the CI run, rather than falling back to `develop`
|
||||
- Run `yarn setup` to build and install dependencies
|
||||
- `yarn`
|
||||
- `yarn bootstrap`
|
||||
- `yarn build`
|
||||
- The will build .ts files, and also update the `main` and `types` of `package.json` to point to `dist` rather than src
|
||||
- The build command will only ever work in CI, it is prevented in local dev
|
||||
|
||||
#### `BRANCH` and `BASE_BRANCH` arguments
|
||||
These arguments are supplied by the various budibase build and release pipelines
|
||||
- `budibase_ci`
|
||||
- `BRANCH: ${{ github.event.pull_request.head.ref }}` -> The branch being merged
|
||||
- `BASE_BRANCH: ${{ github.event.pull_request.base.ref}}` -> The base branch
|
||||
- `release-develop`
|
||||
- `BRANCH: develop` -> always use the `develop` branch in pro
|
||||
- `release`
|
||||
- `BRANCH: master` -> always use the `master` branch in pro
|
||||
|
||||
|
||||
### Releasing Pro
|
||||
After budibase dependencies have been released we will release the new version of pro to match the release version of budibase dependencies. This is to ensure that we are always keeping the version of `backend-core` in sync in the pro package and in budibase packages. Without this we could run into scenarios where different versions are being used when installed via `yarn` inside the docker images, creating very difficult to debug cases.
|
||||
|
||||
Pro is released using the [pro/release.sh](../../scripts/pro/release.sh) script. The script will:
|
||||
- Inspect the `VERSION` from the `lerna.json` file in budibase
|
||||
- Determine whether to use the `latest` or `develop` tag based on the command argument
|
||||
- Go to pro directory
|
||||
- install npm creds
|
||||
- update the version of `backend-core` to be `VERSION`, the version just released by lerna
|
||||
- publish to npm. Uses a `lerna publish` command, pro itself is a mono repo.
|
||||
- force the version to be the same as `VERSION` to keep pro and budibase in sync
|
||||
- reverts the changes to `main` and `types` in `package.json` that were made by the build step, to point back to source
|
||||
- commit & push: `Prep next development iteration`
|
||||
- Go to budibase
|
||||
- Update to the new version of pro in `server` and `worker` so the latest pro version is used in the docker builds
|
||||
- commit & push: `Update pro version to $VERSION`
|
||||
|
||||
|
||||
#### `COMMAND` argument
|
||||
This argument is supplied by the existing `release` and `release:develop` budibase commands, which invoke the pro release
|
||||
- `release` will supply no command and default to use `latest`
|
||||
- `release:develop` will supply `develop`
|
||||
|
||||
- Enter the version number of the last known good version of budibase. For example `1.0.0`
|
|
@ -67,7 +67,6 @@ jobs:
|
|||
- name: Bootstrap and build (CLI)
|
||||
run: |
|
||||
yarn
|
||||
yarn bootstrap
|
||||
yarn build
|
||||
|
||||
- name: Build OpenAPI spec
|
||||
|
|
|
@ -55,7 +55,7 @@ yarn setup
|
|||
The yarn setup command runs several build steps i.e.
|
||||
|
||||
```
|
||||
node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev
|
||||
node ./hosting/scripts/setup.js && yarn && yarn build && yarn dev
|
||||
```
|
||||
|
||||
So this command will actually run the application in dev mode. It creates .env files under `./packages/server` and `./packages/worker` and runs docker containers for each service via docker-compose.
|
||||
|
|
|
@ -55,7 +55,7 @@ yarn setup
|
|||
The yarn setup command runs several build steps i.e.
|
||||
|
||||
```
|
||||
node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev
|
||||
node ./hosting/scripts/setup.js && yarn && yarn build && yarn dev
|
||||
```
|
||||
|
||||
So this command will actually run the application in dev mode. It creates .env files under `./packages/server` and `./packages/worker` and runs docker containers for each service via docker-compose.
|
||||
|
|
|
@ -74,7 +74,7 @@ yarn setup
|
|||
The yarn setup command runs several build steps i.e.
|
||||
|
||||
```
|
||||
node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev
|
||||
node ./hosting/scripts/setup.js && yarn && yarn build && yarn dev
|
||||
```
|
||||
|
||||
So this command will actually run the application in dev mode. It creates .env files under `./packages/server` and `./packages/worker` and runs docker containers for each service via docker-compose.
|
||||
|
|
|
@ -58,7 +58,6 @@ Node setup:
|
|||
```
|
||||
node ./hosting/scripts/setup.js
|
||||
yarn
|
||||
yarn bootstrap
|
||||
yarn build
|
||||
```
|
||||
#### Build Image
|
||||
|
|
|
@ -47,7 +47,6 @@ Node setup:
|
|||
```
|
||||
node ./hosting/scripts/setup.js
|
||||
yarn
|
||||
yarn bootstrap
|
||||
yarn build
|
||||
```
|
||||
#### Build Image
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "2.9.39-alpha.1",
|
||||
"version": "2.9.39-alpha.3",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
|
|
12
package.json
12
package.json
|
@ -33,21 +33,18 @@
|
|||
"scripts": {
|
||||
"preinstall": "node scripts/syncProPackage.js",
|
||||
"setup": "git config submodule.recurse true && git submodule update && node ./hosting/scripts/setup.js && yarn && yarn build && yarn dev",
|
||||
"bootstrap": "./scripts/link-dependencies.sh && echo '***BOOTSTRAP ONLY REQUIRED FOR USE WITH ACCOUNT PORTAL***'",
|
||||
"build": "lerna run build --stream",
|
||||
"build:dev": "lerna run --stream prebuild && yarn nx run-many --target=build --output-style=dynamic --watch --preserveWatchOutput",
|
||||
"check:types": "lerna run check:types",
|
||||
"backend:bootstrap": "./scripts/scopeBackend.sh && yarn run bootstrap",
|
||||
"backend:build": "./scripts/scopeBackend.sh 'lerna run --stream build'",
|
||||
"build:sdk": "lerna run --stream build:sdk",
|
||||
"deps:circular": "madge packages/server/dist/index.js packages/worker/src/index.ts packages/backend-core/dist/src/index.js packages/cli/src/index.js --circular",
|
||||
"release": "lerna publish from-package --yes --force-publish --no-git-tag-version --no-push --no-git-reset",
|
||||
"release:develop": "yarn release --dist-tag develop",
|
||||
"restore": "yarn run clean && yarn run bootstrap && yarn run build",
|
||||
"restore": "yarn run clean && yarn && yarn run build",
|
||||
"nuke": "yarn run nuke:packages && yarn run nuke:docker",
|
||||
"nuke:packages": "yarn run restore",
|
||||
"nuke:docker": "lerna run --stream dev:stack:nuke",
|
||||
"clean": "lerna clean",
|
||||
"clean": "lerna clean -y",
|
||||
"kill-builder": "kill-port 3000",
|
||||
"kill-server": "kill-port 4001 4002",
|
||||
"kill-all": "yarn run kill-builder && yarn run kill-server",
|
||||
|
@ -93,9 +90,8 @@
|
|||
"mode:account": "yarn mode:cloud && yarn env:account:enable",
|
||||
"security:audit": "node scripts/audit.js",
|
||||
"postinstall": "husky install",
|
||||
"dep:clean": "yarn clean -y && yarn bootstrap",
|
||||
"submodules:load": "git submodule init && git submodule update && yarn && yarn bootstrap",
|
||||
"submodules:unload": "git submodule deinit --all && yarn && yarn bootstrap"
|
||||
"submodules:load": "git submodule init && git submodule update && yarn",
|
||||
"submodules:unload": "git submodule deinit --all && yarn"
|
||||
},
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
|
|
|
@ -380,8 +380,8 @@ export function getDBRoleID(roleName: string) {
|
|||
export function getExternalRoleID(roleId: string, version?: string) {
|
||||
// for built-in roles we want to remove the DB role ID element (role_)
|
||||
if (
|
||||
(roleId.startsWith(DocumentType.ROLE) && isBuiltin(roleId)) ||
|
||||
version === RoleIDVersion.NAME
|
||||
roleId.startsWith(DocumentType.ROLE) &&
|
||||
(isBuiltin(roleId) || version === RoleIDVersion.NAME)
|
||||
) {
|
||||
return roleId.split(`${DocumentType.ROLE}${SEPARATOR}`)[1]
|
||||
}
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
import { context, db, env, roles } from "@budibase/backend-core"
|
||||
import { db, env, roles } from "@budibase/backend-core"
|
||||
import { features } from "@budibase/pro"
|
||||
import {
|
||||
DocumentType,
|
||||
PermissionLevel,
|
||||
PermissionSource,
|
||||
PlanType,
|
||||
Role,
|
||||
VirtualDocumentType,
|
||||
} from "@budibase/types"
|
||||
import {
|
||||
extractViewInfoFromID,
|
||||
getRoleParams,
|
||||
isViewID,
|
||||
} from "../../../db/utils"
|
||||
import { extractViewInfoFromID, isViewID } from "../../../db/utils"
|
||||
import {
|
||||
CURRENTLY_SUPPORTED_LEVELS,
|
||||
getBasePermissions,
|
||||
|
@ -84,13 +79,8 @@ export async function allowsExplicitPermissions(resourceId: string) {
|
|||
export async function getResourcePerms(
|
||||
resourceId: string
|
||||
): Promise<ResourcePermissions> {
|
||||
const db = context.getAppDB()
|
||||
const body = await db.allDocs(
|
||||
getRoleParams(null, {
|
||||
include_docs: true,
|
||||
})
|
||||
)
|
||||
const rolesList = body.rows.map<Role>(row => row.doc)
|
||||
const rolesList = await roles.getAllRoles()
|
||||
|
||||
let permissions: ResourcePermissions = {}
|
||||
|
||||
const permsToInherit = await getInheritablePermissions(resourceId)
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
echo "Linking backend-core"
|
||||
cd packages/backend-core
|
||||
yarn unlink
|
||||
yarn link
|
||||
cd -
|
||||
|
||||
echo "Linking string-templates"
|
||||
cd packages/string-templates
|
||||
yarn unlink
|
||||
yarn link
|
||||
cd -
|
||||
|
||||
echo "Linking types"
|
||||
cd packages/types
|
||||
yarn unlink
|
||||
yarn link
|
||||
cd -
|
||||
|
||||
echo "Linking bbui"
|
||||
cd packages/bbui
|
||||
yarn unlink
|
||||
yarn link
|
||||
cd -
|
||||
|
||||
echo "Linking frontend-core"
|
||||
cd packages/frontend-core
|
||||
yarn unlink
|
||||
yarn link
|
||||
cd -
|
||||
|
||||
echo "Linking shared-core"
|
||||
cd packages/shared-core
|
||||
yarn unlink
|
||||
yarn link
|
||||
cd -
|
||||
|
||||
if [ -d packages/pro/src ]; then
|
||||
pro_loaded_locally=true
|
||||
else
|
||||
pro_loaded_locally=false
|
||||
fi
|
||||
|
||||
if [ $pro_loaded_locally = true ]; then
|
||||
echo "Linking pro"
|
||||
cd packages/pro
|
||||
yarn unlink
|
||||
yarn link
|
||||
cd -
|
||||
fi
|
||||
|
||||
if [ -d "../account-portal" ]; then
|
||||
cd ../account-portal
|
||||
echo "Bootstrapping account-portal"
|
||||
yarn bootstrap
|
||||
|
||||
cd packages/server
|
||||
echo "Linking backend-core to account-portal (server)"
|
||||
yarn link "@budibase/backend-core"
|
||||
|
||||
echo "Linking string-templates to account-portal (server)"
|
||||
yarn link "@budibase/string-templates"
|
||||
|
||||
echo "Linking types to account-portal (server)"
|
||||
yarn link "@budibase/types"
|
||||
|
||||
echo "Linking shared-core to account-portal (server)"
|
||||
yarn link "@budibase/shared-core"
|
||||
|
||||
if [ $pro_loaded_locally = true ]; then
|
||||
echo "Linking pro to account-portal (server)"
|
||||
yarn link "@budibase/pro"
|
||||
fi
|
||||
|
||||
cd ../ui
|
||||
echo "Linking bbui to account-portal (ui)"
|
||||
yarn link "@budibase/bbui"
|
||||
|
||||
echo "Linking shared-core to account-portal (ui)"
|
||||
yarn link "@budibase/shared-core"
|
||||
|
||||
echo "Linking string-templates to account-portal (ui)"
|
||||
yarn link "@budibase/string-templates"
|
||||
|
||||
echo "Linking types to account-portal (ui)"
|
||||
yarn link "@budibase/types"
|
||||
|
||||
echo "Linking frontend-core to account-portal (ui)"
|
||||
yarn link "@budibase/frontend-core"
|
||||
fi
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Define the packages
|
||||
PACKAGES=("@budibase/backend-core" "@budibase/worker" "@budibase/server" "@budibase/string-templates" "@budibase/types" "@budibase/shared-core")
|
||||
|
||||
# Generate the scope arguments
|
||||
SCOPE_ARGS=""
|
||||
for PACKAGE in "${PACKAGES[@]}"; do
|
||||
SCOPE_ARGS+="--scope $PACKAGE "
|
||||
done
|
||||
|
||||
# Run the commands with the scope arguments
|
||||
for COMMAND in "$@"; do
|
||||
echo "Running: $COMMAND $SCOPE_ARGS"
|
||||
yarn $COMMAND $SCOPE_ARGS
|
||||
done
|
Loading…
Reference in New Issue