diff --git a/.github/workflows/deploy-cloud.yaml b/.github/workflows/deploy-cloud.yaml index d8f1ee88f9..9f933746d6 100644 --- a/.github/workflows/deploy-cloud.yaml +++ b/.github/workflows/deploy-cloud.yaml @@ -1,45 +1,53 @@ name: Budibase Deploy Production on: - workflow_dispatch: + workflow_dispatch: + inputs: + version: + description: Budibase release version. For example - 1.0.0 + required: false jobs: release: runs-on: ubuntu-latest 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 + # - 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 - with: - fetch-depth: 0 + # 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: 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 - run: | + run: | curl -H "Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}" \ -H 'Accept: application/vnd.github.v3.raw' \ -o values.production.yaml \ -L https://api.github.com/repos/budibase/budibase-infra/contents/kubernetes/values.yaml wc -l values.production.yaml - + - name: Get the latest budibase release version id: version - run: | - release_version=$(cat lerna.json | jq -r '.version') + run: | + if [ -z "${{ github.event.inputs.version }}" ]; then + release_version=$(cat lerna.json | jq -r '.version') + else + release_version=${{ github.event.inputs.version }} + fi echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV - + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: @@ -66,4 +74,3 @@ jobs: webhook-url: ${{ secrets.PROD_DEPLOY_WEBHOOK_URL }} content: "Production Deployment Complete: ${{ env.RELEASE_VERSION }} deployed to Budibase Cloud." embed-title: ${{ env.RELEASE_VERSION }} - diff --git a/.github/workflows/release-develop.yml b/.github/workflows/release-develop.yml index 503fc53194..a7bf041eb5 100644 --- a/.github/workflows/release-develop.yml +++ b/.github/workflows/release-develop.yml @@ -48,19 +48,8 @@ jobs: - run: yarn install --frozen-lockfile - name: Update versions - run: | - version=$(cat lerna.json \ - | grep version \ - | head -1 \ - | awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \ - | sed 's/[",]//g') - echo "Setting version $version" - yarn lerna exec "yarn version --no-git-tag-version --new-version=$version" - echo "Updating dependencies" - node scripts/syncLocalDependencies.js $version - echo "Syncing yarn workspace" - yarn - - run: yarn build --configuration=production + run: ./scripts/updateVersions.sh + - run: yarn build - run: yarn build:sdk - name: Publish budibase packages to NPM diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index a4e679e7bf..68625ad7af 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -41,20 +41,9 @@ jobs: - run: yarn install --frozen-lockfile - name: Update versions - run: | - version=$(cat lerna.json \ - | grep version \ - | head -1 \ - | awk -F: '{gsub(/"/,"",$2);gsub(/[[:space:]]*/,"",$2); print $2}' \ - | sed 's/[",]//g') - echo "Setting version $version" - yarn lerna exec "yarn version --no-git-tag-version --new-version=$version" - echo "Updating dependencies" - node scripts/syncLocalDependencies.js $version - echo "Syncing yarn workspace" - yarn + run: ./scripts/updateVersions.sh - run: yarn lint - - run: yarn build --configuration=production + - run: yarn build - run: yarn build:sdk - name: Publish budibase packages to NPM diff --git a/.github/workflows/release-selfhost.yml b/.github/workflows/release-selfhost.yml index 1ace297ed9..f4524e99dc 100644 --- a/.github/workflows/release-selfhost.yml +++ b/.github/workflows/release-selfhost.yml @@ -1,7 +1,7 @@ name: Budibase Release Selfhost on: - workflow_dispatch: + workflow_dispatch: jobs: release: @@ -16,8 +16,10 @@ jobs: fi - uses: actions/checkout@v2 - with: - fetch_depth: 0 + with: + submodules: true + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + fetch-depth: 0 - name: Fail if tag is not in master run: | @@ -38,7 +40,7 @@ jobs: echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV - name: Tag and release Docker images (Self Host) - run: | + run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD release_tag=v${{ env.RELEASE_VERSION }} @@ -52,7 +54,7 @@ jobs: docker tag budibase/apps:$release_tag budibase/apps:$SELFHOST_TAG docker tag budibase/worker:$release_tag budibase/worker:$SELFHOST_TAG docker tag budibase/proxy:$release_tag budibase/proxy:$SELFHOST_TAG - + # Push images docker push budibase/apps:$SELFHOST_TAG docker push budibase/worker:$SELFHOST_TAG @@ -74,15 +76,15 @@ jobs: yarn yarn specs popd - - - name: Setup Helm + + - name: Setup Helm uses: azure/setup-helm@v1 id: helm-install # due to helm repo index issue: https://github.com/helm/helm/issues/7363 # we need to create new package in a different dir, merge the index and move the package back - name: Build and release helm chart - run: | + run: | git config user.name "Budibase Helm Bot" git config user.email "<>" git reset --hard diff --git a/.github/workflows/release-singleimage.yml b/.github/workflows/release-singleimage.yml index fbf972a866..5408b48ef8 100644 --- a/.github/workflows/release-singleimage.yml +++ b/.github/workflows/release-singleimage.yml @@ -5,7 +5,7 @@ on: env: CI: true - PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }} + PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} REGISTRY_URL: registry.hub.docker.com jobs: build: @@ -24,6 +24,8 @@ jobs: - name: "Checkout" uses: actions/checkout@v2 with: + submodules: true + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} fetch-depth: 0 - name: Fail if tag is not in master @@ -32,7 +34,7 @@ jobs: 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 }} uses: actions/setup-node@v1 with: @@ -44,10 +46,12 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Run Yarn run: yarn - - name: Run Yarn Bootstrap - run: yarn bootstrap + - name: Update versions + run: ./scripts/updateVersions.sh - name: Runt Yarn Lint run: yarn lint + - name: Update versions + run: ./scripts/updateVersions.sh - name: Run Yarn Build run: yarn build:docker:pre - name: Login to Docker Hub diff --git a/hosting/single/Dockerfile b/hosting/single/Dockerfile index 64a6b01365..56df8185a9 100644 --- a/hosting/single/Dockerfile +++ b/hosting/single/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16-slim as build +FROM node:14-slim as build # install node-gyp dependencies RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends apt-utils cron g++ make python @@ -11,12 +11,16 @@ RUN chmod +x /cleanup.sh # build server WORKDIR /app ADD packages/server . -RUN yarn install --frozen-lockfile --production=true && /cleanup.sh +COPY yarn.lock . +RUN yarn install --production=true +RUN /cleanup.sh # build worker WORKDIR /worker ADD packages/worker . -RUN yarn install --frozen-lockfile --production=true && /cleanup.sh +COPY yarn.lock . +RUN yarn install --production=true +RUN /cleanup.sh FROM budibase/couchdb ARG TARGETARCH diff --git a/hosting/single/runner.sh b/hosting/single/runner.sh index 0bd377cd7f..d980202f88 100644 --- a/hosting/single/runner.sh +++ b/hosting/single/runner.sh @@ -17,6 +17,7 @@ declare -a DOCKER_VARS=("APP_PORT" "APPS_URL" "ARCHITECTURE" "BUDIBASE_ENVIRONME [[ -z "${WORKER_PORT}" ]] && export WORKER_PORT=4002 [[ -z "${WORKER_URL}" ]] && export WORKER_URL=http://localhost:4002 [[ -z "${APPS_URL}" ]] && export APPS_URL=http://localhost:4001 +[[ -z "${SERVER_TOP_LEVEL_PATH}" ]] && export SERVER_TOP_LEVEL_PATH=/app # export CUSTOM_DOMAIN=budi001.custom.com # Azure App Service customisations diff --git a/lerna.json b/lerna.json index ee9375e919..eded0d214d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.6.28-alpha.0", + "version": "2.7.7-alpha.2", "npmClient": "yarn", "packages": [ "packages/backend-core", diff --git a/package.json b/package.json index ffb3fa775a..56f015f8c0 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "dev:noserver": "yarn run kill-builder && lerna run --stream dev:stack:up && lerna run --stream --parallel dev:builder --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker", "dev:server": "yarn run kill-server && lerna run --stream --parallel dev:builder --scope @budibase/worker --scope @budibase/server", "dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream --parallel dev:built", - "dev:docker": "yarn build && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0", + "dev:docker": "yarn build:docker:pre && docker-compose -f hosting/docker-compose.build.yaml -f hosting/docker-compose.dev.yaml --env-file hosting/.env up --build --scale proxy-service=0", "test": "lerna run --stream test --stream", "lint:eslint": "eslint packages && eslint qa-core", "lint:prettier": "prettier --check \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\" && prettier --check \"qa-core/**/*.{js,ts,svelte}\"", @@ -62,7 +62,7 @@ "lint:fix": "yarn run lint:fix:prettier && yarn run lint:fix:eslint", "build:specs": "lerna run --stream specs", "build:docker": "lerna run --stream build:docker && yarn build:docker:proxy && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION && cd -", - "build:docker:pre": "lerna run --stream build && lerna run --stream predocker", + "build:docker:pre": "yarn build && lerna run --stream predocker", "build:docker:proxy": "docker build hosting/proxy -t proxy-service", "build:docker:selfhost": "lerna run --stream build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh latest && cd -", "build:docker:develop": "node scripts/pinVersions && lerna run --stream build:docker && yarn build:docker:proxy && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -", diff --git a/packages/backend-core/src/middleware/passport/datasource/google.ts b/packages/backend-core/src/middleware/passport/datasource/google.ts index 2f91e01d9a..ae6b3b4913 100644 --- a/packages/backend-core/src/middleware/passport/datasource/google.ts +++ b/packages/backend-core/src/middleware/passport/datasource/google.ts @@ -1,10 +1,11 @@ import * as google from "../sso/google" import { Cookie } from "../../../constants" -import { clearCookie, getCookie } from "../../../utils" import * as configs from "../../../configs" -import { BBContext, SSOProfile } from "@budibase/types" +import * as cache from "../../../cache" +import * as utils from "../../../utils" +import { UserCtx, SSOProfile } from "@budibase/types" import { ssoSaveUserNoOp } from "../sso/sso" -import { cache, utils } from "../../../" + const GoogleStrategy = require("passport-google-oauth").OAuth2Strategy type Passport = { @@ -22,7 +23,7 @@ async function fetchGoogleCreds() { export async function preAuth( passport: Passport, - ctx: BBContext, + ctx: UserCtx, next: Function ) { // get the relevant config @@ -49,7 +50,7 @@ export async function preAuth( export async function postAuth( passport: Passport, - ctx: BBContext, + ctx: UserCtx, next: Function ) { // get the relevant config @@ -57,7 +58,7 @@ export async function postAuth( const platformUrl = await configs.getPlatformUrl({ tenantAware: false }) let callbackUrl = `${platformUrl}/api/global/auth/datasource/google/callback` - const authStateCookie = getCookie(ctx, Cookie.DatasourceAuth) + const authStateCookie = utils.getCookie(ctx, Cookie.DatasourceAuth) return passport.authenticate( new GoogleStrategy( @@ -72,7 +73,7 @@ export async function postAuth( _profile: SSOProfile, done: Function ) => { - clearCookie(ctx, Cookie.DatasourceAuth) + utils.clearCookie(ctx, Cookie.DatasourceAuth) done(null, { accessToken, refreshToken }) } ), diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 6ab750c3d6..a8fa700b90 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -13,6 +13,8 @@ Modal, notifications, Icon, + Checkbox, + DatePicker, } from "@budibase/bbui" import CreateWebhookModal from "components/automation/Shared/CreateWebhookModal.svelte" import { automationStore, selectedAutomation } from "builderStore" @@ -306,6 +308,11 @@ drawer.hide() } + function canShowField(key, value) { + const dependsOn = value.dependsOn + return !dependsOn || !!inputData[dependsOn] + } + onMount(async () => { try { await environment.loadVariables() @@ -317,210 +324,233 @@
{#each deprecatedSchemaProperties as [key, value]} -
- {#if key !== "fields"} - - {/if} - {#if value.type === "string" && value.enum} - onChange(e, key)} - value={inputData[key]} - options={Object.keys(table?.schema || {})} - /> - {:else if value.customType === "filters"} - Define filters - - - (tempFilters = e.detail)} - /> - - {:else if value.customType === "password"} - onChange(e, key)} - value={inputData[key]} - /> - {:else if value.customType === "email"} - {#if isTestModal} - onChange(e, key)} - {bindings} - fillWidth - updateOnChange={false} - /> - {:else} - onChange(e, key)} - {bindings} - allowJS={false} - updateOnChange={false} - drawerLeft="260px" - /> + {#if canShowField(key, value)} +
+ {#if key !== "fields" && value.type !== "boolean"} + {/if} - {:else if value.customType === "query"} - onChange(e, key)} - value={inputData[key]} - /> - {:else if value.customType === "cron"} - onChange(e, key)} value={inputData[key]} /> - {:else if value.customType === "queryParams"} - onChange(e, key)} - value={inputData[key]} - {bindings} - /> - {:else if value.customType === "table"} - onChange(e, key)} - /> - {:else if value.customType === "row"} - { - if (e.detail?.key) { - onChange(e, e.detail.key) - } else { - onChange(e, key) - } - }} - {bindings} - {isTestModal} - {isUpdateRow} - /> - {:else if value.customType === "webhookUrl"} - onChange(e, key)} - value={inputData[key]} - /> - {:else if value.customType === "fields"} - onChange(e, key)} - {bindings} - {isTestModal} - /> - {:else if value.customType === "triggerSchema"} - onChange(e, key)} value={inputData[key]} /> - {:else if value.customType === "code"} - - { - // need to pass without the value inside - onChange({ detail: e.detail }, key) - inputData[key] = e.detail - }} - completions={[ - jsAutocomplete([ - ...bindingsToCompletions(bindings, EditorModes.JS), - ]), - ]} - mode={EditorModes.JS} - height={500} - /> -
- -
-
Add available bindings by typing $
-
-
-
- {:else if value.customType === "loopOption"} - onChange(e, key)} + value={inputData[key]} + options={Object.keys(table?.schema || {})} + /> + {:else if value.customType === "filters"} + Define filters + + + (tempFilters = e.detail)} + /> + + {:else if value.customType === "password"} + onChange(e, key)} + value={inputData[key]} + /> + {:else if value.customType === "email"} + {#if isTestModal} + onChange(e, key)} + {bindings} + fillWidth + updateOnChange={false} + /> + {:else} onChange(e, key)} {bindings} + allowJS={false} updateOnChange={false} - placeholder={value.customType === "queryLimit" ? queryLimit : ""} drawerLeft="260px" /> -
+ {/if} + {:else if value.customType === "query"} + onChange(e, key)} + value={inputData[key]} + /> + {:else if value.customType === "cron"} + onChange(e, key)} + value={inputData[key]} + /> + {:else if value.customType === "queryParams"} + onChange(e, key)} + value={inputData[key]} + {bindings} + /> + {:else if value.customType === "table"} + onChange(e, key)} + /> + {:else if value.customType === "row"} + { + if (e.detail?.key) { + onChange(e, e.detail.key) + } else { + onChange(e, key) + } + }} + {bindings} + {isTestModal} + {isUpdateRow} + /> + {:else if value.customType === "webhookUrl"} + onChange(e, key)} + value={inputData[key]} + /> + {:else if value.customType === "fields"} + onChange(e, key)} + {bindings} + {isTestModal} + /> + {:else if value.customType === "triggerSchema"} + onChange(e, key)} + value={inputData[key]} + /> + {:else if value.customType === "code"} + + { + // need to pass without the value inside + onChange({ detail: e.detail }, key) + inputData[key] = e.detail + }} + completions={[ + jsAutocomplete([ + ...bindingsToCompletions(bindings, EditorModes.JS), + ]), + ]} + mode={EditorModes.JS} + height={500} + /> +
+ +
+
Add available bindings by typing $
+
+
+
+ {:else if value.customType === "loopOption"} +