Skip to content

Commit

Permalink
chore: improve workflows
Browse files Browse the repository at this point in the history
* move cr.yaml and ct.yaml
* update docs
* updatecli for dependencies

closes #67
  • Loading branch information
ialejandro committed Aug 19, 2024
1 parent 178c295 commit fbb35b7
Show file tree
Hide file tree
Showing 10 changed files with 198 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/cr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generate-release-notes: true
11 changes: 11 additions & 0 deletions .github/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://github.com/helm/chart-testing#configuration
chart-dirs: charts
check-version-increment: true
debug: true
remote: origin
target-branch: main
upgrade: true
validate-chart-schema: true
validate-maintainers: false
validate-yaml: true
excluded-charts: ["bigquery-exporter"]
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
sources:
bigquery-exporter-helm:
kind: helmchart
spec:
url: https://devops-ia.github.io/helm-charts
name: bigquery-exporter
bigquery-exporter:
kind: dockerimage
spec:
image: measurementlab/prometheus-bigquery-exporter
architecture: linux/amd64
versionFilter:
kind: semver
bitbucket-bot-helm:
kind: helmchart
spec:
url: https://devops-ia.github.io/helm-charts
name: bitbucket-bot
bitbucket-bot:
kind: dockerimage
spec:
image: devopsiaci/bitbucket-bot
architecture: linux/amd64
ecr-token-helm:
kind: helmchart
spec:
url: https://devops-ia.github.io/helm-charts
name: ecr-token
ecr-token:
kind: dockerimage
spec:
image: devopsiaci/ecr-token
architecture: linux/amd64
ssl-exporter-helm:
kind: helmchart
spec:
url: https://devops-ia.github.io/helm-charts
name: ssl-exporter
ssl-exporter:
kind: dockerimage
spec:
Expand All @@ -18,53 +45,82 @@ sources:
kind: semver
conditions: {}
targets:
bigquery-exporter:
name: bump chart dependencies
kind: yaml
spec:
file: charts/bigquery-exporter/Chart.yaml
key: $.appVersion
sourceid: bigquery-exporter

bitbucket-bot:
name: bump chart dependencies
kind: yaml
spec:
file: charts/bitbucket-bot/Chart.yaml
key: $.appVersion
sourceid: bitbucket-bot

ecr-token:
name: bump chart dependencies
kind: yaml
spec:
file: charts/ecr-token/Chart.yaml
key: $.appVersion
sourceid: ecr-token

ssl-exporter:
name: bump chart dependencies
kind: yaml
spec:
file: charts/ssl-exporter/Chart.yaml
key: $.appVersion
sourceid: ssl-exporter

bitbucket-bot-helm:
name: Update bitbucket-bot helm chart
kind: helmchart
disablesourceinput: true
dependsonchange: true
dependson: [bitbucket-bot]
spec:
name: charts/bitbucket-bot
file: Chart.yaml
key: $.version
versionincrement: patch
sourceid: bitbucket-bot

ecr-token:
name: bump chart dependencies
kind: yaml
bigquery-exporter-helm:
name: Update bigquery-exporter helm chart
kind: helmchart
disablesourceinput: true
dependsonchange: true
dependson: [bigquery-exporter]
spec:
file: charts/ecr-token/Chart.yaml
key: $.appVersion
sourceid: ecr-token
name: charts/bigquery-exporter
file: Chart.yaml
key: $.version
versionincrement: patch

ecr-token-helm:
name: Update ecr-token helm chart
kind: helmchart
disablesourceinput: true
dependsonchange: true
dependson: [ecr-token]
spec:
name: charts/ecr-token
file: Chart.yaml
key: $.version
versionincrement: patch
sourceid: ecr-token

ssl-exporter:
name: bump chart dependencies
kind: yaml
spec:
file: charts/ssl-exporter/Chart.yaml
key: $.appVersion
sourceid: ssl-exporter
ssl-exporter-helm:
name: Update ssl-exporter helm chart
kind: helmchart
disablesourceinput: true
dependsonchange: true
dependson: [ssl-exporter]
spec:
name: charts/ssl-exporter
file: Chart.yaml
key: $.version
versionincrement: patch
sourceid: ssl-exporter
2 changes: 1 addition & 1 deletion .github/workflows/check-new-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- name: Update dependencies
run: |
updatecli apply --config .github/updatecli/helm-appversion.yaml --commit=false
updatecli apply --config .github/updatecli/helm-update.yaml --commit=false
- name: Check if release changed
id: check_changes
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ jobs:
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml)
changed=$(ct list-changed --config .github/ct.yaml)
if [[ -n "${changed}" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --config ct.yaml
run: ct lint --config .github/ct.yaml

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/[email protected]

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --config ct.yaml
run: ct install --config .github/ct.yaml
34 changes: 33 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,39 @@ jobs:
uses: helm/[email protected]
with:
charts_dir: charts
config: cr.yaml
config: .github/cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: true

- name: Login in to the Container registry
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install Cosign
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
uses: sigstore/cosign-installer@v3

- name: Install Oras
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
uses: oras-project/setup-oras@v1

# ref: https://github.com/backstage/charts/blob/88240ce7a0726e3773ee0e4866fbe6325c15267b/.github/workflows/release.yml#L50
- name: Publish and Sign OCI Charts
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
run: |
for chart in `find .cr-release-packages -name '*.tgz' -print`; do
helm push ${chart} oci://ghcr.io/${GITHUB_REPOSITORY} |& tee helm-push-output.log
file_name=${chart##*/}
chart_name=${file_name%-*}
digest=$(awk -F "[, ]+" '/Digest/{print $NF}' < helm-push-output.log)
cosign sign -y "ghcr.io/${GITHUB_REPOSITORY}/${chart_name}@${digest}"
oras push "ghcr.io/${GITHUB_REPOSITORY}/${chart_name}:${{ steps.chart_version.outputs.CHART_VERSION }}"
done
env:
COSIGN_EXPERIMENTAL: 1
78 changes: 77 additions & 1 deletion charts/bigquery-exporter/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
# bigquery-exporter

## `extra.flower`
A Helm chart to deploy Bigquery Exporter

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| ialejandro | <[email protected]> | <https://ialejandro.rocks> |

## Prerequisites

* Helm 3+

## Add repository

```console
helm repo add devops-ia https://devops-ia.github.io/helm-charts
helm repo update
```

## Install Helm chart

```console
helm install [RELEASE_NAME] devops-ia/bigquery-exporter
```

This install all the Kubernetes components associated with the chart and creates the release.

_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._

## Uninstall Helm chart

```console
# Helm
helm uninstall [RELEASE_NAME]
```

This removes all the Kubernetes components associated with the chart and deletes the release.

_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._

## Configuration

See [Customizing the chart before installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with comments:

```console
helm show values devops-ia/bigquery-exporter
```

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity for pod assignment |
| autoscaling | object | `{"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}` | Autoscaling with CPU or memory utilization percentage |
| containerArgs | list | `[]` | Container arguments |
| fullnameOverride | string | `""` | String to fully override bigquery-exporter.fullname template |
| image | object | `{"pullPolicy":"IfNotPresent","repository":"measurementlab/prometheus-bigquery-exporter","tag":""}` | Image registry |
| imagePullSecrets | list | `[]` | Global Docker registry secret names as an array |
| ingress | object | `{"annotations":{},"className":"","enabled":false,"hosts":[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}],"tls":[]}` | Ingress configuration to expose app |
| nameOverride | string | `""` | String to partially override bigquery-exporter.fullname template (will maintain the release name) |
| nodeSelector | object | `{}` | Node labels for pod assignment |
| podAnnotations | object | `{}` | Pod annotations |
| podSecurityContext | object | `{}` | To specify security settings for a Pod |
| replicaCount | int | `1` | Number of replicas |
| resources | object | `{}` | The resources limits and requested |
| securityContext | object | `{}` | Defines privilege and access control settings for a Pod or Container |
| service | object | `{"extraPorts":[{"name":"metrics","port":9080,"targetPort":9080}],"port":80,"targetPort":80,"type":"ClusterIP"}` | Kubernetes servide to expose Pod |
| service.extraPorts | list | `[{"name":"metrics","port":9080,"targetPort":9080}]` | Pod extra ports |
| service.port | int | `80` | Kubernetes Service port |
| service.targetPort | int | `80` | Pod expose port |
| service.type | string | `"ClusterIP"` | Kubernetes Service type. Allowed values: NodePort, LoadBalancer or ClusterIP |
| serviceAccount | object | `{"annotations":{},"create":true,"name":""}` | Enable creation of ServiceAccount |
| serviceMonitor | object | `{"enabled":false,"interval":"30s","metricRelabelings":[],"relabelings":[],"scrapeTimeout":"10s"}` | Enable ServiceMonitor to get metrics ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#servicemonitor |
| serviceMonitor.enabled | bool | `false` | Enable or disable |
| sqlFile | object | `{"query":"SELECT * FROM dataset.my_table"}` | Execute query |
| testConnection | bool | `false` | Enable livenessProbe and readinessProbe |
| tolerations | list | `[]` | Tolerations for pod assignment |
3 changes: 0 additions & 3 deletions charts/bigquery-exporter/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# {{ template "chart.name" . }}

## `extra.flower`
{{ template "extra.flower" . }}

{{ template "chart.description" . }}

{{ template "chart.maintainersSection" . }}
Expand Down
1 change: 0 additions & 1 deletion cr.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions ct.yaml

This file was deleted.

0 comments on commit fbb35b7

Please sign in to comment.