Skip to content

Commit

Permalink
Merge pull request #88 from paritytech/ab-ci-lint
Browse files Browse the repository at this point in the history
Add Helm chart testing Workflow
  • Loading branch information
PierreBesson authored Jun 15, 2022
2 parents 48c74bd + 847afcc commit 9d27903
Show file tree
Hide file tree
Showing 12 changed files with 184 additions and 22 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Linting & Integration tests

on:
pull_request:
types:
- opened
- synchronize
- reopened

defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1

- uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: |
ct lint \
--target-branch ${{ github.event.repository.default_branch }} \
--lint-conf chart-testing/lintconf.yaml \
--excluded-charts charts/common
if: steps.list-changed.outputs.changed == 'true'

- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: kindest/node:v1.21.10
if: steps.list-changed.outputs.changed == 'true'

- name: Replace secrets in Helm charts
env:
SMF_BOT_MATRIX_ACCESS_TOKEN: ${{ secrets.SMF_BOT_MATRIX_ACCESS_TOKEN }}
run: |
shopt -s globstar
for f in $(find **/ci/*-values.yaml); do
sed -i "s/__GITHUB_SECRET_SMF_BOT_MATRIX_ACCESS_TOKEN/$SMF_BOT_MATRIX_ACCESS_TOKEN/g" $f
done
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
run: |
ct install \
--target-branch ${{ github.event.repository.default_branch }} \
--excluded-charts charts/common
if: steps.list-changed.outputs.changed == 'true'
40 changes: 40 additions & 0 deletions chart-testing/lintconf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
rules:
braces:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
colons:
max-spaces-before: 0
max-spaces-after: 1
commas:
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments: disable
document-end: disable
document-start: disable # No --- to start a file
empty-lines:
max: 2
max-start: 0
max-end: 0
hyphens:
max-spaces-after: 1
indentation:
spaces: consistent
indent-sequences: whatever # - list indentation will handle both indentation and without
check-multi-line-strings: false
key-duplicates: enable
line-length: disable # Lines can be any length
new-line-at-end-of-file: enable
new-lines:
type: unix
trailing-spaces: enable
truthy:
level: warning
5 changes: 4 additions & 1 deletion charts/node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ apiVersion: v2
name: node
description: A Helm chart to deploy Substrate/Polkadot nodes
type: application
version: 2.4.0
version: 2.4.1
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
14 changes: 14 additions & 0 deletions charts/node/ci/kind-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node:
chain: dev
role: invalid
dataVolumeSize: 1G
flags:
- "--force-authoring"
- "--alice"
- "--rpc-external"
- "--ws-external"
- "--rpc-methods=safe"
- "--rpc-cors=all"
storageClass: standard
image:
tag: v0.9.19
30 changes: 15 additions & 15 deletions charts/node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ nameOverride: ""
fullnameOverride: ""

## Additional common labels on pods and services
##
##
# extraLabels:
# type: rpc

Expand Down Expand Up @@ -60,7 +60,7 @@ serviceAccount:

## The name of the service account to use.
## If not set and create is true, a name is generated using the fullname template
##
##
name: ""

## SecurityContext holds pod-level security attributes and common container settings.
Expand Down Expand Up @@ -101,9 +101,9 @@ node:

## Database backend engine to use
##
# database: rocksdb
## Node may require custom name for chainspec file.
database: rocksdb

## Node may require custom name for chainspec file.
## ref: moonbeam https://github.com/PureStake/moonbeam/issues/1104#issuecomment-996787548
## Note: path should start with /data/ since this folder mount in init container download-chainspec.
##
Expand All @@ -112,7 +112,7 @@ node:
forceDownloadChainspec: false

## Configuration to download chain snapshot from remote URL
##
##
# chainDataSnapshotUrl: "https://dot-rocksdb.polkashots.io/snapshot"
# chainDataSnapshotFormat: lz4
# chainDataKubernetesVolumeSnapshot: ""
Expand All @@ -130,12 +130,12 @@ node:
##
relayChain: polkadot
## File containing chainspec of relaychain for
##
##
relayChainCustomChainspecPath: "/data/relay_chain_chainspec.json"
# relayChainCustomChainspecUrl: ""

## Configuration to download relaychain snapshot from remote URL
##
##
# relayChainDataSnapshotUrl: "https://dot-rocksdb.polkashots.io/snapshot"
# relayChainDataSnapshotFormat: lz4
# relayChainDataKubernetesVolumeSnapshot: ""
Expand All @@ -157,13 +157,13 @@ node:
# relayChainFlags: []

## Additional args to use
##
##
flags:
- "--rpc-external"
- "--ws-external"
- "--rpc-methods=safe"
- "--rpc-cors=all"

## Keys to use by the node
## ref: https://wiki.polkadot.network/docs/learn-keys
##
Expand Down Expand Up @@ -231,7 +231,7 @@ node:

## Enable Service Monitor of Prometheus-Operator
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md#include-servicemonitors
##
##
serviceMonitor:
enabled: false
#namespace: monitoring
Expand Down Expand Up @@ -260,7 +260,7 @@ node:
hostname: example.com
ttl: 300
## If enabled, create service to expose relay chain P2P
##
##
relayP2pService:
enabled: false
type: NodePort # or ClusterIP or LoadBalancer
Expand All @@ -271,7 +271,7 @@ node:
hostname: example.com
ttl: 300
## If enabled, create service to expose parachain P2P
##
##
paraP2pService:
enabled: false
type: NodePort # or ClusterIP, LoadBalancer
Expand Down Expand Up @@ -310,11 +310,11 @@ node:
## Resource limits & requests
##
resources: {}


## Configuration of Substrate API
## ref: https://github.com/paritytech/substrate-api-sidecar
##
##
substrateApiSidecar:
image:
repository: parity/substrate-api-sidecar
Expand Down
5 changes: 4 additions & 1 deletion charts/polkadot-introspector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ apiVersion: v2
name: polkadot-introspector
description: A Helm chart to deploy polkadot-introspector
type: application
version: 0.1.0
version: 0.1.1
appVersion: "0.1.0"
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
5 changes: 4 additions & 1 deletion charts/substrate-faucet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ apiVersion: v2
name: substrate-faucet
description: A Helm chart to deploy substrate-faucet
type: application
version: 1.0.0
version: 1.0.1
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
15 changes: 15 additions & 0 deletions charts/substrate-faucet/ci/kind-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
serviceMonitor:
enabled: false

server:
config:
SMF_BACKEND_RPC_ENDPOINT: "https://westend-rpc.polkadot.io/"

bot:
secret:
# your bot access token here is how to find it https://t2bot.io/docs/access_tokens/
SMF_BOT_MATRIX_ACCESS_TOKEN: "__GITHUB_SECRET_SMF_BOT_MATRIX_ACCESS_TOKEN"

config:
SMF_BOT_MATRIX_SERVER: "https://matrix.org"
SMF_BOT_MATRIX_BOT_USER_ID: "@parity_ci_bot:matrix.org"
2 changes: 2 additions & 0 deletions charts/substrate-faucet/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand All @@ -21,3 +22,4 @@ spec:
endpoints:
- port: metrics
interval: 15s
{{- end }}
3 changes: 3 additions & 0 deletions charts/substrate-faucet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ nodeSelector: {}
tolerations: []

affinity: {}

serviceMonitor:
enabled: true
5 changes: 4 additions & 1 deletion charts/substrate-telemetry/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: "2.1.1"
version: "2.1.2"

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
6 changes: 3 additions & 3 deletions charts/substrate-telemetry/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ service:
targetPort: 8000
annotations: {}
# nodePort: 31000
# externalTrafficPolicy: Cluster
# externalTrafficPolicy: Cluster
# sessionAffinity: None
core:
type: ClusterIP
port: 80
targetPort: 8000
annotations: {}
# nodePort: 31000
# externalTrafficPolicy: Cluster
# externalTrafficPolicy: Cluster
# sessionAffinity: None
frontend:
type: ClusterIP
port: 80
targetPort: 8000
annotations: {}
# nodePort: 31000
# externalTrafficPolicy: Cluster
# externalTrafficPolicy: Cluster
# sessionAffinity: None

ingress:
Expand Down

0 comments on commit 9d27903

Please sign in to comment.