Merge branch 'master' into develop

This commit is contained in:
Rory Powell 2023-06-06 11:33:23 +01:00
commit 49be2e5b3d
15 changed files with 110 additions and 56 deletions

View File

@ -16,7 +16,8 @@
"dist", "dist",
"public", "public",
"*.spec.js", "*.spec.js",
"bundle.js" "bundle.js",
"packages/pro"
], ],
"plugins": ["svelte3"], "plugins": ["svelte3"],
"extends": ["eslint:recommended"], "extends": ["eslint:recommended"],

View File

@ -2,23 +2,29 @@ name: Budibase Deploy Production
on: on:
workflow_dispatch: workflow_dispatch:
inputs:
version:
description: Budibase release version. For example - 1.0.0
required: false
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Fail if branch is not master - name: Fail if not a tag
if: github.ref != 'refs/heads/master'
run: | run: |
echo "Ref is not master, you must run this job from master." if [[ $GITHUB_REF != refs/tags/* ]]; then
echo "Workflow Dispatch can only be run on tags"
exit 1 exit 1
fi
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fail if tag is not in master
run: |
if ! git merge-base --is-ancestor ${{ github.sha }} origin/master; then
echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch"
exit 1
fi
- name: Pull values.yaml from budibase-infra - name: Pull values.yaml from budibase-infra
run: | run: |
@ -31,11 +37,7 @@ jobs:
- name: Get the latest budibase release version - name: Get the latest budibase release version
id: version id: version
run: | run: |
if [ -z "${{ github.event.inputs.version }}" ]; then
release_version=$(cat lerna.json | jq -r '.version') release_version=$(cat lerna.json | jq -r '.version')
else
release_version=${{ github.event.inputs.version }}
fi
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
- name: Configure AWS Credentials - name: Configure AWS Credentials

View File

@ -1,27 +1,35 @@
name: "deploy-preprod" name: "deploy-preprod"
on: on:
workflow_dispatch: workflow_dispatch:
inputs:
version:
description: Budibase release version. For example - 1.0.0
required: false
workflow_call: workflow_call:
jobs: jobs:
deploy-to-legacy-preprod-env: deploy-to-legacy-preprod-env:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Fail if not a tag
run: |
if [[ $GITHUB_REF != refs/tags/* ]]; then
echo "Workflow Dispatch can only be run on tags"
exit 1
fi
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fail if tag is not in master
run: |
if ! git merge-base --is-ancestor ${{ github.sha }} origin/master; then
echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch"
exit 1
fi
- name: Get the latest budibase release version - name: Get the latest budibase release version
id: version id: version
run: | run: |
if [ -z "${{ github.event.inputs.version }}" ]; then
git pull
release_version=$(cat lerna.json | jq -r '.version') release_version=$(cat lerna.json | jq -r '.version')
else
release_version=${{ github.event.inputs.version }}
fi
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
- name: Configure AWS Credentials - name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1 uses: aws-actions/configure-aws-credentials@v1

View File

@ -22,6 +22,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Fail if not a tag
run: |
if [[ $GITHUB_REF != refs/tags/* ]]; then
echo "Workflow Dispatch can only be run on tags"
exit 1
fi
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true submodules: true

View File

@ -9,12 +9,6 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+" - "v[0-9]+.[0-9]+.[0-9]+"
# Exclude all pre-releases # Exclude all pre-releases
- "!v*[0-9]+.[0-9]+.[0-9]+-*" - "!v*[0-9]+.[0-9]+.[0-9]+-*"
workflow_dispatch:
inputs:
tags:
description: "Release tag"
required: true
type: boolean
env: env:
# Posthog token used by ui at build time # Posthog token used by ui at build time
@ -33,12 +27,13 @@ jobs:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0 fetch-depth: 0
- name: Fail if branch is not master - name: Fail if tag is not in master
if: github.ref != 'refs/heads/master'
run: | run: |
echo "Ref is not master, you must run this job from master." if ! git merge-base --is-ancestor ${{ github.sha }} origin/master; then
// Change to "exit 1" when merged. Left to 0 to not fail all the pipelines and not to cause noise echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch"
exit 0 exit 1
fi
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
@ -65,7 +60,6 @@ jobs:
- name: Publish budibase packages to NPM - name: Publish budibase packages to NPM
env: env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
RELEASE_VERSION_TYPE: ${{ github.event.inputs.versioning }}
run: | run: |
# setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default # setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default
git config --global user.name "Budibase Release Bot" git config --global user.name "Budibase Release Bot"
@ -140,7 +134,6 @@ jobs:
- name: Get the latest budibase release version - name: Get the latest budibase release version
id: version id: version
run: | run: |
git pull
release_version=$(cat lerna.json | jq -r '.version') release_version=$(cat lerna.json | jq -r '.version')
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV

View File

@ -8,16 +8,24 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Fail if branch is not master - name: Fail if not a tag
if: github.ref != 'refs/heads/master'
run: | run: |
echo "Ref is not master, you must run this job from master." if [[ $GITHUB_REF != refs/tags/* ]]; then
echo "Workflow Dispatch can only be run on tags"
exit 1 exit 1
fi
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch_depth: 0 fetch_depth: 0
- name: Fail if tag is not in master
run: |
if ! git merge-base --is-ancestor ${{ github.sha }} origin/master; then
echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch"
exit 1
fi
- name: Use Node.js 14.x - name: Use Node.js 14.x
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
@ -78,7 +86,7 @@ jobs:
git config user.name "Budibase Helm Bot" git config user.name "Budibase Helm Bot"
git config user.email "<>" git config user.email "<>"
git reset --hard git reset --hard
git pull git fetch
mkdir sync mkdir sync
echo "Packaging chart to sync dir" echo "Packaging chart to sync dir"
helm package charts/budibase --version "$RELEASE_VERSION" --app-version "$RELEASE_VERSION" --destination sync helm package charts/budibase --version "$RELEASE_VERSION" --app-version "$RELEASE_VERSION" --destination sync

View File

@ -15,13 +15,24 @@ jobs:
matrix: matrix:
node-version: [14.x] node-version: [14.x]
steps: steps:
- name: Fail if branch is not master - name: Fail if not a tag
if: github.ref != 'refs/heads/master'
run: | run: |
echo "Ref is not master, you must run this job from master." if [[ $GITHUB_REF != refs/tags/* ]]; then
echo "Workflow Dispatch can only be run on tags"
exit 1 exit 1
fi
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fail if tag is not in master
run: |
if ! git merge-base --is-ancestor ${{ github.sha }} origin/master; then
echo "Tag is not in master. This pipeline can only execute tags that are present on the master branch"
exit 1
fi
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:

View File

@ -28,7 +28,7 @@ on:
required: true required: true
jobs: jobs:
tag-prerelease: tag-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -43,9 +43,11 @@ jobs:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- run: yarn - run: yarn
- name: Tag prerelease - name: Tag release
run: | run: |
# setup the username and email. # setup the username and email.
git config --global user.name "Budibase Staging Release Bot" git config --global user.name "Budibase Staging Release Bot"
git config --global user.email "<>" git config --global user.email "<>"
./scripts/versionCommit.sh ${{ github.event.inputs.versioning }} BUMP_TYPE_INPUT=${{ github.event.inputs.versioning }}
BUMP_TYPE=${BUMP_TYPE_INPUT:-"patch"}
./scripts/versionCommit.sh $BUMP_TYPE

View File

@ -1,5 +1,5 @@
{ {
"version": "2.6.24-alpha.1", "version": "2.6.27",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/backend-core", "packages/backend-core",

View File

@ -38,8 +38,8 @@
"backend:build": "./scripts/scopeBackend.sh 'lerna run --stream build'", "backend:build": "./scripts/scopeBackend.sh 'lerna run --stream build'",
"build:sdk": "lerna run --stream build:sdk", "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", "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 ${RELEASE_VERSION_TYPE:-patch} --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": "lerna publish from-package --yes --force-publish --dist-tag develop --exact --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 run bootstrap && 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",

View File

@ -3,6 +3,7 @@ import {
Event, Event,
User, User,
UserCreatedEvent, UserCreatedEvent,
UserDataCollaborationEvent,
UserDeletedEvent, UserDeletedEvent,
UserInviteAcceptedEvent, UserInviteAcceptedEvent,
UserInvitedEvent, UserInvitedEvent,
@ -173,6 +174,15 @@ async function passwordReset(user: User) {
await publishEvent(Event.USER_PASSWORD_RESET, properties) await publishEvent(Event.USER_PASSWORD_RESET, properties)
} }
// COLLABORATION
async function dataCollaboration(users: number) {
const properties: UserDataCollaborationEvent = {
users,
}
await publishEvent(Event.USER_DATA_COLLABORATION, properties)
}
export default { export default {
created, created,
updated, updated,
@ -188,4 +198,5 @@ export default {
passwordUpdated, passwordUpdated,
passwordResetRequested, passwordResetRequested,
passwordReset, passwordReset,
dataCollaboration,
} }

View File

@ -1,6 +1,6 @@
import authorized from "../middleware/authorized" import authorized from "../middleware/authorized"
import { BaseSocket } from "./websocket" import { BaseSocket } from "./websocket"
import { permissions } from "@budibase/backend-core" import { permissions, events } from "@budibase/backend-core"
import http from "http" import http from "http"
import Koa from "koa" import Koa from "koa"
import { Datasource, Table, SocketSession, ContextUser } from "@budibase/types" import { Datasource, Table, SocketSession, ContextUser } from "@budibase/types"
@ -22,6 +22,9 @@ export default class BuilderSocket extends BaseSocket {
// Reply with all users in current room // Reply with all users in current room
const sessions = await this.getRoomSessions(appId) const sessions = await this.getRoomSessions(appId)
callback({ users: sessions }) callback({ users: sessions })
// Track usage
await events.user.dataCollaboration(sessions.length)
}) })
} }

View File

@ -26,6 +26,9 @@ export enum Event {
USER_PASSWORD_RESET_REQUESTED = "user:password:reset:requested", USER_PASSWORD_RESET_REQUESTED = "user:password:reset:requested",
USER_PASSWORD_RESET = "user:password:reset", USER_PASSWORD_RESET = "user:password:reset",
// USER / COLLABORATION
USER_DATA_COLLABORATION = "user:data:collaboration",
// EMAIL // EMAIL
EMAIL_SMTP_CREATED = "email:smtp:created", EMAIL_SMTP_CREATED = "email:smtp:created",
EMAIL_SMTP_UPDATED = "email:smtp:updated", EMAIL_SMTP_UPDATED = "email:smtp:updated",
@ -233,6 +236,7 @@ export const AuditedEventFriendlyName: Record<Event, string | undefined> = {
[Event.USER_PASSWORD_FORCE_RESET]: undefined, [Event.USER_PASSWORD_FORCE_RESET]: undefined,
[Event.USER_GROUP_ONBOARDING]: undefined, [Event.USER_GROUP_ONBOARDING]: undefined,
[Event.USER_ONBOARDING_COMPLETE]: undefined, [Event.USER_ONBOARDING_COMPLETE]: undefined,
[Event.USER_DATA_COLLABORATION]: undefined,
// EMAIL // EMAIL
[Event.EMAIL_SMTP_CREATED]: `Email configuration created`, [Event.EMAIL_SMTP_CREATED]: `Email configuration created`,

View File

@ -86,3 +86,7 @@ export interface UserPasswordResetEvent extends BaseEvent {
email: string email: string
} }
} }
export interface UserDataCollaborationEvent extends BaseEvent {
users: number
}

View File

@ -2,7 +2,7 @@
if [ -z "$1" ] if [ -z "$1" ]
then then
echo "Error: version number is required. Usage: $0 [major|minor|patch|prerelease]" echo "Error: bump type is required. Usage: $0 [major|minor|patch|prerelease]"
exit 1 exit 1
fi fi