feat(circleci): adds a new step to ensure Helm Chart documentation is kept in line with Helm Chart (#1574)

* fix(helm): update documentation to match helm chart
* fix(helm): update documentation should not update README in helm repository
* fix(helm): should ensure output schema conforms to prettier requirements
* feat(pre-commit): update helm documentation as part of pre-commit
* feat(circleci): update Helm README when publishing new Helm chart
* fix(pre-commit): need to npm install before using readme generator
This commit is contained in:
Iain Sproat
2023-05-12 13:26:28 +01:00
committed by GitHub
parent 294f2a101d
commit b1cbd05683
7 changed files with 206 additions and 30 deletions
+20
View File
@@ -204,6 +204,11 @@ workflows:
- docker-publish-monitor-container
- docker-publish-test-container
- update-helm-documentation:
filters: *filters-publish
requires:
- publish-helm-chart
- publish-npm:
filters:
tags:
@@ -663,3 +668,18 @@ jobs:
- run:
name: Publish Helm Chart
command: ./.circleci/publish_helm_chart.sh
update-helm-documentation:
docker: *docker-image
working_directory: *work-dir
steps:
- checkout
- attach_workspace:
at: /tmp/ci/workspace
- run: cat workspace/env-vars >> $BASH_ENV
- add_ssh_keys:
fingerprints:
- '4d:68:70:66:49:97:ba:8b:8c:55:96:df:3d:be:6e:05'
- run:
name: Update Helm Documentation
command: ./.circleci/update_helm_documentation.sh
@@ -17,13 +17,10 @@ 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 git@github.com:bitnami-labs/readme-generator-for-helm.git "${README_GENERATOR_DIR}"
fi
@@ -31,11 +28,12 @@ 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 git@github.com:specklesystems/helm.git "${HELM_DIR}"
fi
@@ -43,10 +41,9 @@ 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}"
@@ -54,18 +51,13 @@ pushd "${GIT_ROOT}"
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..."
echo "🌳 Preparing commit to branch '${HELM_GIT_TARGET_BRANCH}' 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}"
git commit -m "Updating README with revised parameters from values.yaml of Helm Chart."
git push --set-upstream origin "${HELM_GIT_TARGET_BRANCH}"
echo "✅ All done 🎉"
popd
+9
View File
@@ -41,5 +41,14 @@ repos:
args:
- --ignore=E501 # ignoring error about lines that are too long
- repo: local
hooks:
- id: helm-documentation
name: Helm documentation
language: system
files: utils/helm/speckle-server/values.yaml
entry: utils/helm/update-schema-json.sh
description: If this fails it is because the values.yaml file was updated. Or has missing or incorrect documentation.
ci:
autoupdate_schedule: quarterly
+1
View File
@@ -15,6 +15,7 @@
"helm:readme:generate": "./utils/helm/update-documentation.sh",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write .",
"prettier:fix:file": "prettier --write",
"circleci:check": "circleci config validate ./.circleci/config.yml",
"dev:docker": "docker-compose -f ./docker-compose-deps.yml",
"dev:docker:up": "docker-compose -f ./docker-compose-deps.yml up -d",
+117 -10
View File
@@ -27,6 +27,26 @@
"description": "The name of the ClusterIssuer kubernetes resource that provides the SSL Certificate",
"default": "letsencrypt-staging"
},
"analytics": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "Enable or disable analytics",
"default": true
},
"mixpanel_token_id": {
"type": "string",
"description": "The Mixpanel token ID used to identify this Speckle deployment in MixPanel",
"default": "acd87c5a50b56df91a795e999812a3a4"
},
"mixpanel_api_host": {
"type": "string",
"description": "The Mixpanel API host to which analytics data will be sent",
"default": "https://analytics.speckle.systems"
}
}
},
"networkPlugin": {
"type": "object",
"properties": {
@@ -55,7 +75,7 @@
"docker_image_tag": {
"type": "string",
"description": "Speckle is published as a Docker Image. The version of the image which will be deployed is specified by this tag.",
"default": "v2.3.3"
"default": "2.13.3"
},
"imagePullPolicy": {
"type": "string",
@@ -441,11 +461,6 @@
"description": "The minimum level of logs which will be output. Suitable values are trace, debug, info, warn, error, fatal, or silent",
"default": "info"
},
"speckleAutomateUrl": {
"type": "string",
"description": "The url where the associated Speckle Automate instance is running",
"default": "https://automate.speckle.systems"
},
"adminOverrideEnabled": {
"type": "boolean",
"description": "Enables the server side admin authz override",
@@ -453,9 +468,14 @@
},
"onboardingStreamId": {
"type": "string",
"description": "This stream/project on the server is used for the onboarding flow",
"description": "The id of the stream to be used for onboarding new users",
"default": ""
},
"speckleAutomateUrl": {
"type": "string",
"description": "The url of the Speckle Automate instance",
"default": "https://automate.speckle.systems"
},
"sessionSecret": {
"type": "object",
"properties": {
@@ -869,12 +889,12 @@
"post_graphql": {
"type": "number",
"description": "The maximum number of requests that can be made to the GraphQL API in a moving one second window.",
"default": 10
"default": 50
},
"burst_post_grapqhl": {
"burst_post_graphql": {
"type": "number",
"description": "If the regular limit is exceeded, the limit is increased to the burst limit. This is the maximum number of requests that can be made to the GraphQL API in a moving one minute window.",
"default": 20
"default": 200
},
"get_auth": {
"type": "number",
@@ -1084,6 +1104,93 @@
}
}
},
"frontend_2": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "Feature flag to enable running the new experimental frontend.",
"default": false
},
"replicas": {
"type": "number",
"description": "The number of instances of the Frontend 2 server prod to be deployed withing the cluster.",
"default": 1
},
"requests": {
"type": "object",
"properties": {
"cpu": {
"type": "string",
"description": "The CPU that should be available on a node when scheduling this pod.",
"default": "250m"
},
"memory": {
"type": "string",
"description": "The Memory that should be available on a node when scheduling this pod.",
"default": "256Mi"
}
}
},
"limits": {
"type": "object",
"properties": {
"cpu": {
"type": "string",
"description": "The maximum CPU that will be made available to the frontend Pod in a given period.",
"default": "1000m"
},
"memory": {
"type": "string",
"description": "The maximum Memory that will be made available to the frontend Pod.",
"default": "512Mi"
}
}
},
"networkPolicy": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean",
"description": "If enabled, will provide additional security be limiting network traffic into and out of the pod to only the required endpoints and ports.",
"default": false
}
}
},
"affinity": {
"type": "object",
"description": "Affinity for Speckle frontend pod scheduling",
"default": {}
},
"nodeSelector": {
"type": "object",
"description": "Node labels for Speckle frontend pods scheduling",
"default": {}
},
"tolerations": {
"type": "array",
"description": "Tolerations for Speckle frontend pods scheduling",
"default": [],
"items": {}
},
"topologySpreadConstraints": {
"type": "array",
"description": "Spread Constraints for Speckle frontend pod scheduling",
"default": [],
"items": {}
},
"serviceAccount": {
"type": "object",
"properties": {
"create": {
"type": "boolean",
"description": "If enabled, a Kubernetes Service Account will be created for this pod.",
"default": true
}
}
}
}
},
"preview_service": {
"type": "object",
"properties": {
+6 -1
View File
@@ -27,8 +27,11 @@ ssl_canonical_url: true
cert_manager_issuer: letsencrypt-staging
analytics:
## @param analytics.enabled Enable or disable analytics
enabled: true
## @param analytics.mixpanel_token_id The Mixpanel token ID used to identify this Speckle deployment in MixPanel
mixpanel_token_id: 'acd87c5a50b56df91a795e999812a3a4'
## @param analytics.mixpanel_api_host The Mixpanel API host to which analytics data will be sent
mixpanel_api_host: 'https://analytics.speckle.systems'
## @section Network Plugin configuration
@@ -372,7 +375,9 @@ server:
## @param server.adminOverrideEnabled Enables the server side admin authz override
adminOverrideEnabled: false
## @param server.onboardingStreamId The id of the stream to be used for onboarding new users
onboardingStreamId: ''
## @param server.speckleAutomateUrl The url of the Speckle Automate instance
speckleAutomateUrl: 'https://automate.speckle.systems'
sessionSecret:
## @param server.sessionSecret.secretName The name of the Kubernetes Secret containing the Session secret. This is a unique value (can be generated randomly). This is expected to be provided within the Kubernetes cluster as an opaque Kubernetes Secret. Ref: https://kubernetes.io/docs/concepts/configuration/secret/#opaque-secrets
@@ -595,7 +600,7 @@ server:
burst_get_objects_streamid_objectid_single: 200
## @param server.ratelimiting.post_graphql The maximum number of requests that can be made to the GraphQL API in a moving one second window.
post_graphql: 50
## @param server.ratelimiting.burst_post_grapqhl If the regular limit is exceeded, the limit is increased to the burst limit. This is the maximum number of requests that can be made to the GraphQL API in a moving one minute window.
## @param server.ratelimiting.burst_post_graphql If the regular limit is exceeded, the limit is increased to the burst limit. This is the maximum number of requests that can be made to the GraphQL API in a moving one minute window.
burst_post_graphql: 200
## @param server.ratelimiting.get_auth The maximum number of requests that can be made to the Speckle server to authenticate in a moving one second window.
get_auth: 2
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
if ! command -v node &> /dev/null
then
echo "🛑 node could not be found. Please install node (and ensure it is in your PATH) before trying again."
exit 1
fi
if ! command -v git &> /dev/null
then
echo "🛑 git could not be found. Please install git (and ensure it is in your PATH) before trying again."
exit 1
fi
GIT_ROOT="$(git rev-parse --show-toplevel)"
README_GENERATOR_DIR="${GIT_ROOT}/../readme-generator-for-helm"
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"
git clone git@github.com:bitnami-labs/readme-generator-for-helm.git "${README_GENERATOR_DIR}"
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
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" \
--schema "${JSON_SCHEMA_PATH}"
yarn prettier:fix:file "${JSON_SCHEMA_PATH}"
popd