Skip to content

Commit

Permalink
Merge pull request #58 from arup-group/dn/dev/2.16.0
Browse files Browse the repository at this point in the history
upstream changes until 2.16.0
  • Loading branch information
dtnaughton authored Feb 26, 2024
2 parents ffe76d4 + 2d28c3a commit 57624fb
Show file tree
Hide file tree
Showing 1,078 changed files with 125,692 additions and 16,183 deletions.
367 changes: 337 additions & 30 deletions .circleci/config.yml

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion .circleci/is_draft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@

set -euf -o pipefail

if [[ -z "$CIRCLE_PULL_REQUEST" ]]; then
if [[ -z "${CIRCLE_PULL_REQUEST}" ]]; then
echo "FALSE"
fi

if [[ -z "${GITHUB_TOKEN}" ]]; then
echo "GITHUB_TOKEN is not set"
exit 1
fi

PR_NUMBER="${CIRCLE_PULL_REQUEST//[!0-9]/}"
RESPONSE=$(curl --silent \
-H "Authorization: token ${GITHUB_TOKEN}" \
Expand Down
2 changes: 1 addition & 1 deletion .circleci/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if [[ "${IMAGE_VERSION_TAG}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+)?$ ]]; th
docker push "${DOCKER_IMAGE_TAG}:2"
fi
else
BRANCH_TAG="${NEXT_RELEASE}-branch.${BRANCH_NAME_TRUNCATED}"
BRANCH_TAG="branch.${BRANCH_NAME_TRUNCATED}"
echo "🏷 Tagging and pushing image as '${DOCKER_IMAGE_TAG}:${BRANCH_TAG}'"
docker tag "${DOCKER_IMAGE_TAG}:${IMAGE_VERSION_TAG}" "${DOCKER_IMAGE_TAG}:${BRANCH_TAG}"
docker push "${DOCKER_IMAGE_TAG}:${BRANCH_TAG}"
Expand Down
74 changes: 41 additions & 33 deletions .circleci/publish_helm_chart.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
#!/bin/bash

set -e

RELEASE_VERSION=${IMAGE_VERSION_TAG}

echo "Releasing Helm Chart version $RELEASE_VERSION"

git config --global user.email "[email protected]"
git config --global user.name "CI"

git clone [email protected]:specklesystems/helm.git ~/helm

# before overwriting the chart with the build version, check if the current chart version
# is not newer than the currently build one

CURRENT_VERSION="$(grep ^version ~/helm/charts/speckle-server/Chart.yaml | grep -o '2\..*')"
echo "${CURRENT_VERSION}"

.circleci/check_version.py "${CURRENT_VERSION}" "${RELEASE_VERSION}"
if [ $? -eq 1 ]
then
echo "The current helm chart version is newer than the currently built. Exiting"
exit 1
#!/usr/bin/env bash

set -eo pipefail

GIT_REPO=$( pwd )
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# shellcheck disable=SC1090,SC1091
source "${SCRIPT_DIR}/common.sh"

RELEASE_VERSION="${IMAGE_VERSION_TAG}"
HELM_STABLE_BRANCH="${HELM_STABLE_BRANCH:-"main"}"

echo "Releasing Helm Chart version ${RELEASE_VERSION}"

git clone [email protected]:specklesystems/helm.git "${HOME}/helm"

yq e -i ".version = \"${RELEASE_VERSION}\"" "${GIT_REPO}/utils/helm/speckle-server/Chart.yaml"
yq e -i ".appVersion = \"${RELEASE_VERSION}\"" "${GIT_REPO}/utils/helm/speckle-server/Chart.yaml"
yq e -i ".docker_image_tag = \"${RELEASE_VERSION}\"" "${GIT_REPO}/utils/helm/speckle-server/values.yaml"

if [[ -n "${CIRCLE_TAG}" || "${CIRCLE_BRANCH}" == "${HELM_STABLE_BRANCH}" ]]; then
# before overwriting the chart with the build version, check if the current chart version
# is not newer than the currently build one

CURRENT_VERSION="$(grep ^version "${HOME}/helm/charts/speckle-server/Chart.yaml" | grep -o '2\..*')"
echo "${CURRENT_VERSION}"

.circleci/check_version.py "${CURRENT_VERSION}" "${RELEASE_VERSION}"
if [ $? -eq 1 ]
then
echo "The current helm chart version '${CURRENT_VERSION}' is newer than the version '${RELEASE_VERSION}' we are attempting to publish. Exiting"
exit 1
fi
rm -rf "${HOME}/helm/charts/speckle-server"
cp -r "${GIT_REPO}/utils/helm/speckle-server" "${HOME}/helm/charts/speckle-server"
else
# overwrite the name of the chart
yq e -i ".name = \"speckle-server-branch-${BRANCH_NAME_TRUNCATED}\"" "${GIT_REPO}/utils/helm/speckle-server/Chart.yaml"
rm -rf "${HOME}/helm/charts/speckle-server-branch-${BRANCH_NAME_TRUNCATED}"
cp -r "${GIT_REPO}/utils/helm/speckle-server" "${HOME}/helm/charts/speckle-server-branch-${BRANCH_NAME_TRUNCATED}"
fi

rm -rf ~/helm/charts/speckle-server
cp -r utils/helm/speckle-server ~/helm/charts/speckle-server

sed -i 's/version: [^\s]*/version: '"${RELEASE_VERSION}"'/g' ~/helm/charts/speckle-server/Chart.yaml
sed -i 's/appVersion: [^\s]*/appVersion: '\""${RELEASE_VERSION}"\"'/g' ~/helm/charts/speckle-server/Chart.yaml

sed -i 's/docker_image_tag: [^\s]*/docker_image_tag: '"${RELEASE_VERSION}"'/g' ~/helm/charts/speckle-server/values.yaml

cd ~/helm

git add .
git commit -m "CircleCI commit"
git -c user.email="[email protected]" -c user.name="CI" commit -m "CircleCI commit for version '${RELEASE_VERSION}'"
git push
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,55 @@ GIT_ROOT="$(git rev-parse --show-toplevel)"
README_GENERATOR_DIR="${GIT_ROOT}/../readme-generator-for-helm"
HELM_DIR="${GIT_ROOT}/../speckle-helm"
HELM_GIT_TARGET_BRANCH="gh-pages"
HELM_GIT_PR_BRANCH="${HELM_GIT_TARGET_BRANCH}-$(openssl rand -hex 6)"

JSON_SCHEMA_PATH="${GIT_ROOT}/utils/helm/speckle-server/values.schema.json"

if [ ! -d "${README_GENERATOR_DIR}" ]; then
echo "🔭 Could not find readme-generator-for-helm in a sibling directory to speckle-server"
echo "👩‍👩‍👧‍👧 Proceeding with cloning readme-generator-for-helm to a sibling directory, readme-generator-for-helm"
echo "🔭 Could not find 'readme-generator-for-helm' in a sibling directory"
echo "👩‍👩‍👧‍👧 Proceeding with cloning readme-generator-for-helm to a sibling directory, 'readme-generator-for-helm'"
git clone [email protected]:bitnami-labs/readme-generator-for-helm.git "${README_GENERATOR_DIR}"
fi

if [ -n "${CI}" ]; then
git config --global user.email "[email protected]"
git config --global user.name "CI"
fi

pushd "${README_GENERATOR_DIR}"
echo "✨ Updating to the latest version of readme-generator-for-helm"
git switch main
git pull origin main
npm install
popd

if [ ! -d "${HELM_DIR}" ]; then
echo "🔭 Could not find Speckle Helm in a sibling directory (named speckle-helm) to speckle-server"
echo "👩‍👩‍👧‍👧 Proceeding with cloning Speckle's helm repository to a sibling directory, speckle-helm"
echo "🔭 Could not find Speckle Helm in a sibling directory (named 'speckle-helm')"
echo "👩‍👩‍👧‍👧 Proceeding with cloning Speckle's helm repository to a sibling directory, 'speckle-helm'"
git clone [email protected]:specklesystems/helm.git "${HELM_DIR}"
fi

pushd "${HELM_DIR}"
echo "✨ Updating to the latest version of Speckle helm"
git switch main
git pull origin main
echo "🍽 Preparing forked branch for updates"
echo "🍽 Preparing gh-pages branch for updates"
git switch "${HELM_GIT_TARGET_BRANCH}"
git pull origin "${HELM_GIT_TARGET_BRANCH}"
git switch -c "${HELM_GIT_PR_BRANCH}"
popd

pushd "${GIT_ROOT}"
echo "🏗 Generating the documentation"
node "${README_GENERATOR_DIR}/bin/index.js" \
--config "${GIT_ROOT}/utils/helm/.helm-readme-configuration.json" \
--values "${GIT_ROOT}/utils/helm/speckle-server/values.yaml" \
--readme "${HELM_DIR}/README.md" \
--schema "${JSON_SCHEMA_PATH}"

echo "🐛 Workaround for bug in generator for schema.json: https://github.com/bitnami-labs/readme-generator-for-helm/issues/34"
TMP_OUTPUT="$(mktemp -t speckle-server-json-schema)"
jq --arg replacement 'object' '(.. | .items? | select(.type == "")).type |= $replacement' "${JSON_SCHEMA_PATH}" > "${TMP_OUTPUT}" && mv "${TMP_OUTPUT}" "${JSON_SCHEMA_PATH}"
--readme "${HELM_DIR}/README.md"
popd

pushd "${HELM_DIR}"
echo "🌳 Preparing Pull Request for Helm README..."
git add README.md
git commit -m "Updating README with revised parameters from values.yaml"
git push --set-upstream origin "${HELM_GIT_PR_BRANCH}"
echo "🙏 Please create a Pull Request, ❗️selecting gh-pages as the target branch❗️: https://github.com/specklesystems/helm/pull/new/${HELM_GIT_PR_BRANCH}"
echo "🌳 Preparing commit to branch '${HELM_GIT_TARGET_BRANCH}' for Helm README..."
if [[ $(git status --porcelain) ]]; then
git add README.md
git commit -m "Updating README with revised parameters from values.yaml of Helm Chart."
git push --set-upstream origin "${HELM_GIT_TARGET_BRANCH}"
fi
popd

echo "✅ All done 🎉"
18 changes: 16 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/** @type {import("eslint").Linter.Config} */
const config = {
root: true,
parserOptions: {
ecmaVersion: 2022
},
env: {
es2021: true,
es2022: true,
node: true,
commonjs: true
},
Expand All @@ -20,13 +23,24 @@ const config = {
'prefer-const': 'warn',
'object-shorthand': 'warn'
},
overrides: [
{
files: '*.mjs',
parserOptions: {
sourceType: 'module'
}
}
],
ignorePatterns: [
'node_modules',
'dist',
'dist-*',
'public',
'events.json',
'.*.{ts,js,vue,tsx,jsx}',
'generated/**/*'
'generated/**/*',
'.nuxt',
'.output'
]
}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/matrix_environment.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["prod", "hs2", "staging", "hk", "alr", "et"]
["prod", "hs2", "staging", "hk", "alr", "et", "px-prod", "px-uat", "px-dev", "amr"]
2 changes: 1 addition & 1 deletion .github/workflows/matrix_environment_staging.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["staging"]
["staging", "px-dev"]
50 changes: 44 additions & 6 deletions .github/workflows/matrix_include.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,80 @@
"region": "eu-west-1",
"accessKey": "STAGING_AWS_ACCESS_KEY_ID",
"secretAccessKey": "STAGING_AWS_SECRET_ACCESS_KEY",
"url": "https://v2.staging-speckle.arup.com"
"url": "https://v2.staging-speckle.arup.com",
"disablePosthogTracking": "false"
},
{
"environment": "prod",
"region": "eu-west-1",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://v2.speckle.arup.com"
"url": "https://v2.speckle.arup.com",
"disablePosthogTracking": "false"
},
{
"environment": "hk",
"region": "ap-east-1",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://hk.speckle.arup.com"
"url": "https://hk.speckle.arup.com",
"disablePosthogTracking": "false"
},
{
"environment": "alr",
"region": "ap-southeast-2",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://lightrail.speckle.arup.com"
"url": "https://lightrail.speckle.arup.com",
"disablePosthogTracking": "true"
},
{
"environment": "et",
"region": "eu-west-2",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://eustontower.speckle.arup.com"
"url": "https://eustontower.speckle.arup.com",
"disablePosthogTracking": "true"
},
{
"environment": "hs2",
"region": "eu-west-2",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://hs2.speckle.arup.com"
"url": "https://hs2.speckle.arup.com",
"disablePosthogTracking": "true"
},
{
"environment": "px-prod",
"region": "us-east-1",
"accessKey": "PX_AWS_ACCESS_KEY_ID",
"secretAccessKey": "PX_AWS_SECRET_ACCESS_KEY",
"url": "",
"disablePosthogTracking": "true"
},
{
"environment": "px-uat",
"region": "us-east-1",
"accessKey": "PX_AWS_ACCESS_KEY_ID",
"secretAccessKey": "PX_AWS_SECRET_ACCESS_KEY",
"url": "",
"disablePosthogTracking": "true"
},
{
"environment": "px-dev",
"region": "us-east-1",
"accessKey": "PX_AWS_ACCESS_KEY_ID",
"secretAccessKey": "PX_AWS_SECRET_ACCESS_KEY",
"url": "",
"disablePosthogTracking": "true"
},
{
"environment": "amr",
"region": "us-east-1",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://amr.speckle.arup.com",
"disablePosthogTracking": "false"
},
{
"package": "server",
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/matrix_include_staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
"region": "eu-west-1",
"accessKey": "STAGING_AWS_ACCESS_KEY_ID",
"secretAccessKey": "STAGING_AWS_SECRET_ACCESS_KEY",
"url": "https://v2.staging-speckle.arup.com"
"url": "https://v2.staging-speckle.arup.com",
"disablePosthogTracking": "true"
},
{
"environment": "px-dev",
"region": "us-east-1",
"accessKey": "PX_AWS_ACCESS_KEY_ID",
"secretAccessKey": "PX_AWS_SECRET_ACCESS_KEY",
"url": "",
"disablePosthogTracking": "true"
},
{
"package": "server",
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/p500_speckle-v2-frontend-prod-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
file: ./packages/frontend/Dockerfile
build-args: |
VUE_APP_GRAPHQL_WS=wss://${{ secrets.P500_SPECKLE_BACKEND }}/graphql
DISABLE_POSTHOG_TRACKING=false
secrets: |
"posthog_api_key=${{ secrets.POSTHOG_API_KEY }}"
Expand Down
Loading

0 comments on commit 57624fb

Please sign in to comment.