Integrate with standard release pipeline
This commit is contained in:
parent
aaba6349e5
commit
82c1ada346
|
@ -1,47 +0,0 @@
|
|||
name: Budibase Release Staging (Pro)
|
||||
|
||||
# Temporary pipeline - eventualy this will be merged with the regular one
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- pro-develop
|
||||
paths:
|
||||
- ".aws/**"
|
||||
- ".github/**"
|
||||
- "charts/**"
|
||||
- "packages/**"
|
||||
- "scripts/**"
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
|
||||
env:
|
||||
POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }}
|
||||
INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }}
|
||||
POSTHOG_URL: ${{ secrets.POSTHOG_URL }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.x
|
||||
- run: yarn
|
||||
- run: yarn bootstrap
|
||||
- run: yarn lint
|
||||
- run: yarn build
|
||||
- run: yarn test
|
||||
|
||||
- name: Build/release Docker images (Pro)
|
||||
run: |
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
|
||||
yarn build:docker:develop:pro
|
||||
yarn release:docker:pro develop
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
|
|
@ -1,41 +0,0 @@
|
|||
name: Budibase Release Selfhost (Pro)
|
||||
|
||||
# Temporary pipeline - eventualy this will be merged with the regular one
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
node-version: 14.x
|
||||
fetch_depth: 0
|
||||
|
||||
- name: Tag and release Docker images (Pro) (Self Host)
|
||||
run: |
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
|
||||
|
||||
# Get latest release version
|
||||
release_version=$(cat lerna.json | jq -r '.version')
|
||||
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
|
||||
release_tag=v$release_version
|
||||
|
||||
# Pull apps and worker images
|
||||
docker pull budibase/apps-pro:$release_tag
|
||||
docker pull budibase/worker-pro:$release_tag
|
||||
|
||||
# Tag apps and worker images
|
||||
docker tag budibase/apps-pro:$release_tag budibase/apps-pro:$SELFHOST_TAG
|
||||
docker tag budibase/worker-pro:$release_tag budibase/worker-pro:$SELFHOST_TAG
|
||||
|
||||
# Push images
|
||||
docker push budibase/apps-pro:$SELFHOST_TAG
|
||||
docker push budibase/worker-pro:$SELFHOST_TAG
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
|
||||
SELFHOST_TAG: latest
|
|
@ -1,53 +0,0 @@
|
|||
name: Budibase Release (Pro)
|
||||
|
||||
# Temporary pipeline - eventualy this will be merged with the regular one
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- pro-master
|
||||
paths:
|
||||
- ".aws/**"
|
||||
- ".github/**"
|
||||
- "charts/**"
|
||||
- "packages/**"
|
||||
- "scripts/**"
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
|
||||
env:
|
||||
POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }}
|
||||
INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }}
|
||||
POSTHOG_URL: ${{ secrets.POSTHOG_URL }}
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14.x
|
||||
- run: yarn
|
||||
- run: yarn bootstrap
|
||||
- run: yarn lint
|
||||
- run: yarn build
|
||||
- run: yarn test
|
||||
|
||||
- name: "Get Previous tag"
|
||||
id: previoustag
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||
|
||||
- name: Build/release Docker images
|
||||
run: |
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
|
||||
yarn build:docker:pro
|
||||
yarn release:docker:pro ${BUDIBASE_RELEASE_VERSION}
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
|
||||
BUDIBASE_RELEASE_VERSION: ${{ steps.previoustag.outputs.tag }}
|
|
@ -1,19 +1,19 @@
|
|||
name: Budibase Release Staging
|
||||
|
||||
on:
|
||||
push:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
paths:
|
||||
- ".aws/**"
|
||||
- ".github/**"
|
||||
- "charts/**"
|
||||
- "packages/**"
|
||||
- "scripts/**"
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
- '.aws/**'
|
||||
- '.github/**'
|
||||
- 'charts/**'
|
||||
- 'packages/**'
|
||||
- 'scripts/**'
|
||||
- 'package.json'
|
||||
- 'yarn.lock'
|
||||
- 'package.json'
|
||||
- 'yarn.lock'
|
||||
|
||||
env:
|
||||
POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }}
|
||||
|
@ -55,8 +55,8 @@ jobs:
|
|||
- name: Build/release Docker images
|
||||
run: |
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
|
||||
yarn build
|
||||
yarn build:docker:develop
|
||||
yarn release:docker develop
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
name: Budibase Release
|
||||
|
||||
on:
|
||||
push:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- ".aws/**"
|
||||
- ".github/**"
|
||||
- "charts/**"
|
||||
- "packages/**"
|
||||
- "scripts/**"
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
- '.aws/**'
|
||||
- '.github/**'
|
||||
- 'charts/**'
|
||||
- 'packages/**'
|
||||
- 'scripts/**'
|
||||
- 'package.json'
|
||||
- 'yarn.lock'
|
||||
- 'package.json'
|
||||
- 'yarn.lock'
|
||||
|
||||
env:
|
||||
POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }}
|
||||
|
@ -53,15 +53,15 @@ jobs:
|
|||
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} >> .npmrc
|
||||
yarn release
|
||||
|
||||
- name: "Get Previous tag"
|
||||
- name: 'Get Previous tag'
|
||||
id: previoustag
|
||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||
|
||||
- name: Build/release Docker images
|
||||
run: |
|
||||
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
|
||||
yarn build
|
||||
yarn build:docker
|
||||
yarn release:docker ${BUDIBASE_RELEASE_VERSION}
|
||||
env:
|
||||
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }}
|
||||
|
|
|
@ -31,34 +31,6 @@ services:
|
|||
- worker-service
|
||||
- redis-service
|
||||
|
||||
app-service-pro:
|
||||
restart: always
|
||||
image: app-service-pro
|
||||
container_name: bbapps-pro
|
||||
ports:
|
||||
- "${APP_PORT}:4002"
|
||||
environment:
|
||||
SELF_HOSTED: 1
|
||||
COUCH_DB_URL: http://${COUCH_DB_USER}:${COUCH_DB_PASSWORD}@couchdb-service:5984
|
||||
WORKER_URL: http://worker-service:4003
|
||||
MINIO_URL: http://minio-service:9000
|
||||
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
|
||||
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
|
||||
INTERNAL_API_KEY: ${INTERNAL_API_KEY}
|
||||
BUDIBASE_ENVIRONMENT: ${BUDIBASE_ENVIRONMENT}
|
||||
PORT: 4002
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
LOG_LEVEL: info
|
||||
SENTRY_DSN: https://a34ae347621946bf8acded18e5b7d4b8@o420233.ingest.sentry.io/5338131
|
||||
ENABLE_ANALYTICS: "true"
|
||||
REDIS_URL: redis-service:6379
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
||||
volumes:
|
||||
- ./logs:/logs
|
||||
depends_on:
|
||||
- worker-service
|
||||
- redis-service
|
||||
|
||||
worker-service:
|
||||
restart: always
|
||||
image: budibase.docker.scarf.sh/budibase/worker
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
tag=$1
|
||||
|
||||
if [[ ! "$tag" ]]; then
|
||||
echo "No tag present. You must pass a tag to this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Tagging images with tag: $tag"
|
||||
|
||||
docker tag app-service-pro budibase/apps-pro:$tag
|
||||
docker tag worker-service-pro budibase/worker-pro:$tag
|
||||
|
||||
docker push --all-tags budibase/apps-pro
|
||||
docker push --all-tags budibase/worker-pro
|
|
@ -1,52 +0,0 @@
|
|||
const fetch = require('node-fetch')
|
||||
const fs = require('fs')
|
||||
const util = require('util')
|
||||
const streamPipeline = util.promisify(require('stream').pipeline)
|
||||
|
||||
async function download (url, opts, path) {
|
||||
const response = await fetch(url, opts)
|
||||
if (!response.ok) throw new Error(`unexpected response ${response.statusText}`)
|
||||
await streamPipeline(response.body, fs.createWriteStream(path))
|
||||
}
|
||||
|
||||
const install = async () => {
|
||||
// get github token
|
||||
const token = process.env.GITHUB_TOKEN
|
||||
if (!token) {
|
||||
throw new Error("Missing token")
|
||||
}
|
||||
|
||||
// get version from package.json
|
||||
let packageJson = JSON.parse(fs.readFileSync('package.json'))
|
||||
let version = packageJson.dependencies['@budibase/pro']
|
||||
if (version.startsWith('^')) {
|
||||
version = version.substring(1)
|
||||
}
|
||||
const ghVersion = `v${version}`
|
||||
|
||||
// get the package url
|
||||
// TODO: Add semver support
|
||||
// TODO: Potentially can use yarn to download directly from github if pro becomes a non monorepo
|
||||
const resp = await fetch(`https://api.github.com/repos/budibase/budibase-pro/releases`, {
|
||||
headers: {
|
||||
Authorization: `token ${token}`,
|
||||
Accept: "application/vnd.github.v3.raw"
|
||||
}
|
||||
})
|
||||
|
||||
if (!resp.ok) {
|
||||
throw new Error("Failed to get release info. Aborting")
|
||||
}
|
||||
const releases = await resp.json()
|
||||
const release = releases.filter(r => r.name === ghVersion)[0]
|
||||
const url = release.assets.filter(a => a.name === "pro.zip")[0].url
|
||||
|
||||
console.log("Downloading pro package")
|
||||
// download the package
|
||||
await download(url, { headers: { Authorization: `token ${token}`, Accept: 'application/octet-stream' }}, './pro.zip')
|
||||
}
|
||||
|
||||
install().catch(e => {
|
||||
console.error(e)
|
||||
process.exit(1)
|
||||
})
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ ! -z "${PRO}" ]]; then
|
||||
echo "Installing pro package"
|
||||
rm -rf node_modules/@budibase/pro
|
||||
unzip pro.zip -d node_modules/@budibase
|
||||
rm pro.zip
|
||||
fi
|
|
@ -19,7 +19,6 @@
|
|||
},
|
||||
"scripts": {
|
||||
"setup": "node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev",
|
||||
"install:pro": "lerna run install:pro --",
|
||||
"bootstrap": "lerna link && lerna bootstrap",
|
||||
"build": "lerna run build",
|
||||
"publishnpm": "yarn build && lerna publish --force-publish",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -8,5 +8,3 @@ db/dev.db/
|
|||
dist
|
||||
coverage/
|
||||
watchtower-hook.json
|
||||
pro.zip
|
||||
scripts/pro/*
|
|
@ -17,18 +17,11 @@ ENV BUDIBASE_ENVIRONMENT=PRODUCTION
|
|||
COPY . ./
|
||||
RUN yarn
|
||||
|
||||
RUN apt-get install unzip
|
||||
|
||||
# add the pro package if PRO is set
|
||||
ARG PRO
|
||||
ENV PRO=$PRO
|
||||
RUN yarn install:pro
|
||||
|
||||
# build
|
||||
RUN yarn build
|
||||
|
||||
# Install client for oracle datasource
|
||||
RUN apt-get install libaio1
|
||||
RUN apt-get install unzip libaio1
|
||||
RUN /bin/bash -e scripts/integrations/oracle/instantclient/linux/x86-64/install.sh
|
||||
|
||||
EXPOSE 4001
|
||||
|
|
|
@ -13,12 +13,8 @@
|
|||
"postbuild": "copyfiles -u 1 src/**/*.svelte dist/ && copyfiles -u 1 src/**/*.hbs dist/ && copyfiles -u 1 src/**/*.json dist/",
|
||||
"test": "jest --coverage --maxWorkers=2",
|
||||
"test:watch": "jest --watch",
|
||||
"predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client && copyfiles -f ../../hosting/scripts/pro/install.sh scripts/pro",
|
||||
"predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client",
|
||||
"build:docker": "yarn run predocker && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION",
|
||||
"download:pro": "node ../../hosting/scripts/pro/download.js",
|
||||
"predocker:pro": "yarn run predocker && yarn download:pro",
|
||||
"build:docker:pro": "yarn run predocker:pro && docker build --build-arg PRO=1 . -t app-service-pro --label version=$BUDIBASE_RELEASE_VERSION",
|
||||
"install:pro": "./scripts/pro/install.sh",
|
||||
"build:docs": "node ./scripts/docs/generate.js open",
|
||||
"run:docker": "node dist/index.js",
|
||||
"dev:stack:up": "node scripts/dev/manage.js up",
|
||||
|
|
|
@ -3,24 +3,9 @@ import { ExtendableContext } from "koa"
|
|||
|
||||
import * as env from "./environment"
|
||||
|
||||
// check we can import pro types no matter the installation method (budibase-pro or budibase)
|
||||
import * as pro from "@budibase/pro"
|
||||
import { poc, License } from "@budibase/pro"
|
||||
|
||||
// check we can use pro types no matter the installation
|
||||
const license: License = { id: "123" }
|
||||
console.log(license)
|
||||
|
||||
// log the difference between how pro is imported
|
||||
// in budibase these will be undefined
|
||||
// in budibase-pro these will be defined
|
||||
console.log(poc)
|
||||
console.log(pro)
|
||||
|
||||
if (env.PRO) {
|
||||
// check only pro logic runs in pro
|
||||
console.log("PRO")
|
||||
}
|
||||
// temp for testing
|
||||
import * as poc from "./pro-poc"
|
||||
poc.run()
|
||||
|
||||
const CouchDB = require("./db")
|
||||
require("@budibase/backend-core").init(CouchDB)
|
||||
|
|
|
@ -50,7 +50,6 @@ module.exports = {
|
|||
JEST_WORKER_ID: process.env.JEST_WORKER_ID,
|
||||
BUDIBASE_ENVIRONMENT: process.env.BUDIBASE_ENVIRONMENT,
|
||||
DISABLE_ACCOUNT_PORTAL: process.env.DISABLE_ACCOUNT_PORTAL,
|
||||
PRO: process.env.PRO,
|
||||
// minor
|
||||
SALT_ROUNDS: process.env.SALT_ROUNDS,
|
||||
LOGGER: process.env.LOGGER,
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
import * as pro from "@budibase/pro"
|
||||
import { poc, License } from "@budibase/pro"
|
||||
|
||||
export const run = () => {
|
||||
if (process.env.PRO) {
|
||||
const license: License = { id: "123" }
|
||||
console.log(license)
|
||||
console.log(poc)
|
||||
console.log(pro)
|
||||
console.log("PRO")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue