diff --git a/.github/workflows/release-develop.yml b/.github/workflows/release-develop.yml index 675707453e..1ac6b20003 100644 --- a/.github/workflows/release-develop.yml +++ b/.github/workflows/release-develop.yml @@ -194,5 +194,5 @@ jobs: PAYLOAD_VERSION: ${{ env.RELEASE_VERSION }} with: repository: budibase/budibase-deploys - event: deploy-develop-to-qa + event: deploy-budibase-develop-to-qa github_pat: ${{ secrets.GH_ACCESS_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/smoke_test.yaml b/.github/workflows/smoke_test.yaml index cffb914aaf..29c7f5f85a 100644 --- a/.github/workflows/smoke_test.yaml +++ b/.github/workflows/smoke_test.yaml @@ -18,30 +18,18 @@ jobs: - run: yarn - run: yarn bootstrap - run: yarn build - - name: Pull cypress.env.yaml from budibase-infra + - name: Pull from budibase-infra run: | curl -H "Authorization: token ${{ secrets.GH_PERSONAL_TOKEN }}" \ -H 'Accept: application/vnd.github.v3.raw' \ - -o packages/builder/cypress.env.json \ - -L https://api.github.com/repos/budibase/budibase-infra/contents/test/cypress.env.json - wc -l packages/builder/cypress.env.json - - - name: Cypress run - id: cypress - continue-on-error: true - uses: cypress-io/github-action@v2 - with: - record: true - install: false - tag: nightly - command: yarn test:e2e:ci:record - env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + -o + -L + wc -l - uses: actions/upload-artifact@v3 with: name: Test Reports - path: packages/builder/cypress/reports/testReport.html + path: # TODO: enable once running in QA test env # - name: Configure AWS Credentials @@ -54,11 +42,3 @@ jobs: # - name: Upload test results HTML # uses: aws-actions/configure-aws-credentials@v1 # run: aws s3 cp packages/builder/cypress/reports/testReport.html s3://{{ secrets.BUDI_QA_REPORTS_BUCKET_NAME }}/$GITHUB_RUN_ID/index.html - - - name: Cypress Discord Notify - run: yarn test:e2e:ci:notify - env: - CYPRESS_WEBHOOK_URL: ${{ secrets.BUDI_QA_WEBHOOK }} - CYPRESS_OUTCOME: ${{ steps.cypress.outcome }} - CYPRESS_DASHBOARD_URL: ${{ steps.cypress.outputs.dashboardUrl }} - GITHUB_RUN_URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID diff --git a/lerna.json b/lerna.json index 4f3e8c24f9..5ae449aa0e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.2.12-alpha.55", + "version": "2.2.12-alpha.64", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/package.json b/package.json index 7da8db506d..6290930269 100644 --- a/package.json +++ b/package.json @@ -51,10 +51,6 @@ "lint:fix:eslint": "eslint --fix packages qa-core", "lint:fix:prettier": "prettier --write \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\" && prettier --write \"qa-core/**/*.{js,ts,svelte}\"", "lint:fix": "yarn run lint:fix:prettier && yarn run lint:fix:eslint", - "test:e2e": "lerna run cy:test --stream", - "test:e2e:ci": "lerna run cy:ci --stream", - "test:e2e:ci:record": "lerna run cy:ci:record --stream", - "test:e2e:ci:notify": "lerna run cy:ci:notify", "build:specs": "lerna run specs", "build:docker": "lerna run build:docker && npm run build:docker:proxy && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION && cd -", "build:docker:pre": "lerna run build && lerna run predocker", @@ -84,4 +80,4 @@ "install:pro": "bash scripts/pro/install.sh", "dep:clean": "yarn clean && yarn bootstrap" } -} +} \ No newline at end of file diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 160c1b1100..94e3c84972 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.2.12-alpha.55", + "version": "2.2.12-alpha.64", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -23,7 +23,7 @@ }, "dependencies": { "@budibase/nano": "10.1.1", - "@budibase/types": "2.2.12-alpha.55", + "@budibase/types": "2.2.12-alpha.64", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/backend-core/src/db/couch/DatabaseImpl.ts b/packages/backend-core/src/db/couch/DatabaseImpl.ts index 9b4761d961..a60a748bdc 100644 --- a/packages/backend-core/src/db/couch/DatabaseImpl.ts +++ b/packages/backend-core/src/db/couch/DatabaseImpl.ts @@ -15,18 +15,47 @@ import { getCouchInfo } from "./connections" import { directCouchCall } from "./utils" import { getPouchDB } from "./pouchDB" import { WriteStream, ReadStream } from "fs" +import { newid } from "../../newid" + +function buildNano(couchInfo: { url: string; cookie: string }) { + return Nano({ + url: couchInfo.url, + requestDefaults: { + headers: { + Authorization: couchInfo.cookie, + }, + }, + parseUrl: false, + }) +} + +export function DatabaseWithConnection( + dbName: string, + connection: string, + opts?: DatabaseOpts +) { + if (!connection) { + throw new Error("Must provide connection details") + } + return new DatabaseImpl(dbName, opts, connection) +} export class DatabaseImpl implements Database { public readonly name: string private static nano: Nano.ServerScope + private readonly instanceNano?: Nano.ServerScope private readonly pouchOpts: DatabaseOpts - constructor(dbName?: string, opts?: DatabaseOpts) { + constructor(dbName?: string, opts?: DatabaseOpts, connection?: string) { if (dbName == null) { throw new Error("Database name cannot be undefined.") } this.name = dbName this.pouchOpts = opts || {} + if (connection) { + const couchInfo = getCouchInfo(connection) + this.instanceNano = buildNano(couchInfo) + } if (!DatabaseImpl.nano) { DatabaseImpl.init() } @@ -34,15 +63,7 @@ export class DatabaseImpl implements Database { static init() { const couchInfo = getCouchInfo() - DatabaseImpl.nano = Nano({ - url: couchInfo.url, - requestDefaults: { - headers: { - Authorization: couchInfo.cookie, - }, - }, - parseUrl: false, - }) + DatabaseImpl.nano = buildNano(couchInfo) } async exists() { @@ -50,6 +71,10 @@ export class DatabaseImpl implements Database { return response.status === 200 } + private nano() { + return this.instanceNano || DatabaseImpl.nano + } + async checkSetup() { let shouldCreate = !this.pouchOpts?.skip_setup // check exists in a lightweight fashion @@ -58,9 +83,9 @@ export class DatabaseImpl implements Database { throw new Error("DB does not exist") } if (!exists) { - await DatabaseImpl.nano.db.create(this.name) + await this.nano().db.create(this.name) } - return DatabaseImpl.nano.db.use(this.name) + return this.nano().db.use(this.name) } private async updateOutput(fnc: any) { @@ -101,6 +126,13 @@ export class DatabaseImpl implements Database { return this.updateOutput(() => db.destroy(_id, _rev)) } + async post(document: AnyDocument, opts?: DatabasePutOpts) { + if (!document._id) { + document._id = newid() + } + return this.put(document, opts) + } + async put(document: AnyDocument, opts?: DatabasePutOpts) { if (!document._id) { throw new Error("Cannot store document without _id field.") @@ -146,7 +178,7 @@ export class DatabaseImpl implements Database { async destroy() { try { - await DatabaseImpl.nano.db.destroy(this.name) + await this.nano().db.destroy(this.name) } catch (err: any) { // didn't exist, don't worry if (err.statusCode === 404) { diff --git a/packages/backend-core/src/db/couch/connections.ts b/packages/backend-core/src/db/couch/connections.ts index a2206de634..06c661f350 100644 --- a/packages/backend-core/src/db/couch/connections.ts +++ b/packages/backend-core/src/db/couch/connections.ts @@ -1,7 +1,7 @@ import env from "../../environment" -export const getCouchInfo = () => { - const urlInfo = getUrlInfo() +export const getCouchInfo = (connection?: string) => { + const urlInfo = getUrlInfo(connection) let username let password if (env.COUCH_DB_USERNAME) { diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 3afd638637..dbafc7e8f9 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "2.2.12-alpha.55", + "version": "2.2.12-alpha.64", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "2.2.12-alpha.55", + "@budibase/string-templates": "2.2.12-alpha.64", "@spectrum-css/accordion": "3.0.24", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", diff --git a/packages/bbui/src/ActionButton/ActionButton.svelte b/packages/bbui/src/ActionButton/ActionButton.svelte index 640f696458..663128160f 100644 --- a/packages/bbui/src/ActionButton/ActionButton.svelte +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -9,7 +9,6 @@ export let longPressable = false export let disabled = false export let icon = "" - export let dataCy = null export let size = "M" export let active = false export let fullWidth = false @@ -37,7 +36,6 @@
- $goto("./forgot")}> - Forgot password + $goto("./forgot")}> + Forgot password?
diff --git a/packages/builder/src/pages/builder/invite/index.svelte b/packages/builder/src/pages/builder/invite/index.svelte index 4b786db497..35231117c4 100644 --- a/packages/builder/src/pages/builder/invite/index.svelte +++ b/packages/builder/src/pages/builder/invite/index.svelte @@ -68,7 +68,7 @@ - + logo Join {company} @@ -175,6 +175,7 @@