Move bootstrap to account-portal
This commit is contained in:
parent
d6a7df886f
commit
cfde7c3e58
|
@ -116,76 +116,3 @@ This job is responsible for deploying to our production, cloud kubernetes enviro
|
||||||
- Kick off cloud deploy job
|
- Kick off cloud deploy job
|
||||||
- Ensure you are running off master
|
- Ensure you are running off master
|
||||||
- Enter the version number of the last known good version of budibase. For example `1.0.0`
|
- 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`
|
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ yarn setup
|
||||||
The yarn setup command runs several build steps i.e.
|
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.
|
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.
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "node scripts/syncProPackage.js",
|
"preinstall": "node scripts/syncProPackage.js",
|
||||||
"setup": "git config submodule.recurse true && git submodule update && node ./hosting/scripts/setup.js && yarn && yarn build && yarn dev",
|
"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": "lerna run build --stream",
|
||||||
"build:dev": "lerna run --stream prebuild && yarn nx run-many --target=build --output-style=dynamic --watch --preserveWatchOutput",
|
"build:dev": "lerna run --stream prebuild && yarn nx run-many --target=build --output-style=dynamic --watch --preserveWatchOutput",
|
||||||
"check:types": "lerna run check:types",
|
"check:types": "lerna run check:types",
|
||||||
|
@ -43,11 +42,11 @@
|
||||||
"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",
|
"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": "lerna publish from-package --yes --force-publish --no-git-tag-version --no-push --no-git-reset",
|
||||||
"release:develop": "yarn release --dist-tag develop",
|
"release:develop": "yarn release --dist-tag develop",
|
||||||
"restore": "yarn run clean && yarn run bootstrap && yarn run build",
|
"restore": "yarn run dep:clean && yarn && yarn run build",
|
||||||
"nuke": "yarn run nuke:packages && yarn run nuke:docker",
|
"nuke": "yarn run nuke:packages && yarn run nuke:docker",
|
||||||
"nuke:packages": "yarn run restore",
|
"nuke:packages": "yarn run restore",
|
||||||
"nuke:docker": "lerna run --stream dev:stack:nuke",
|
"nuke:docker": "lerna run --stream dev:stack:nuke",
|
||||||
"clean": "lerna clean",
|
"clean": "lerna clean -y",
|
||||||
"kill-builder": "kill-port 3000",
|
"kill-builder": "kill-port 3000",
|
||||||
"kill-server": "kill-port 4001 4002",
|
"kill-server": "kill-port 4001 4002",
|
||||||
"kill-all": "yarn run kill-builder && yarn run kill-server",
|
"kill-all": "yarn run kill-builder && yarn run kill-server",
|
||||||
|
@ -93,7 +92,6 @@
|
||||||
"mode:account": "yarn mode:cloud && yarn env:account:enable",
|
"mode:account": "yarn mode:cloud && yarn env:account:enable",
|
||||||
"security:audit": "node scripts/audit.js",
|
"security:audit": "node scripts/audit.js",
|
||||||
"postinstall": "husky install",
|
"postinstall": "husky install",
|
||||||
"dep:clean": "yarn clean -y && yarn bootstrap",
|
|
||||||
"submodules:load": "git submodule init && git submodule update && yarn && yarn bootstrap",
|
"submodules:load": "git submodule init && git submodule update && yarn && yarn bootstrap",
|
||||||
"submodules:unload": "git submodule deinit --all && yarn && yarn bootstrap"
|
"submodules:unload": "git submodule deinit --all && yarn && yarn bootstrap"
|
||||||
},
|
},
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue