diff --git a/.github/workflows/helm-diff-ci.yml b/.github/workflows/helm-diff-ci.yml
index 051efe24e3387..90373b2266171 100644
--- a/.github/workflows/helm-diff-ci.yml
+++ b/.github/workflows/helm-diff-ci.yml
@@ -11,10 +11,31 @@ permissions:
pull-requests: write
jobs:
- single-binary-diff:
- name: Single Binary Scenario
+ helm-diff:
+ name: ${{ matrix.scenario.name }}
runs-on: ubuntu-latest
timeout-minutes: 10
+ strategy:
+ matrix:
+ scenario:
+ - name: Single Binary Scenario
+ values_file: default-single-binary-values.yaml
+ use_k3d: true
+ - name: Default Values Scenario
+ values_file: default-values.yaml
+ use_k3d: true
+ - name: Ingress Values Scenario
+ values_file: ingress-values.yaml
+ use_k3d: true
+ - name: Legacy Monitoring Values Scenario
+ values_file: legacy-monitoring-values.yaml
+ use_k3d: true
+ - name: Simple Scalable AWS Kube IRSA Values Scenario
+ values_file: simple-scalable-aws-kube-irsa-values.yaml
+ use_k3d: false
+ - name: Simple Thanos Values Scenario
+ values_file: simple-thanos-values.yaml
+ use_k3d: false
steps:
- name: Checkout code
@@ -31,9 +52,11 @@ jobs:
helm repo update
- name: Setup K3D
+ if: ${{ matrix.scenario.use_k3d }}
uses: ./.github/actions/setup-k3d
- name: Setup Helm plugins
+ if: ${{ matrix.scenario.use_k3d }}
run: |
helm plugin install https://github.com/databus23/helm-diff
@@ -41,221 +64,20 @@ jobs:
run: |
helm dependency build production/helm/loki
- - name: Install latest helm release
- run: |
- helm install --create-namespace loki-release grafana/loki -f production/helm/loki/scenarios/default-single-binary-values.yaml
-
- - name: Run helm diff
- id: helm-diff
- env:
- HELM_DIFF_USE_UPGRADE_DRY_RUN: true
- run: |
- helm diff upgrade loki-release -f production/helm/loki/scenarios/default-single-binary-values.yaml production/helm/loki | tee helm_diff_output.txt
-
- - name: Convert Helm Diff Output to Markdown
- id: convert_diff
- run: |
- cat helm_diff_output.txt >> formatted_diff_output.md
-
- - name: Upload diff output as artifact
- id: upload_diff
- uses: actions/upload-artifact@v4
- with:
- name: single-binary-diff-output
- path: formatted_diff_output.md
- retention-days: 2
-
- default-values-diff:
- name: Default Values Scenario
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Setup Helm
- uses: azure/setup-helm@v4
-
- - name: Add required Helm repositories
- run: |
- helm repo add minio https://charts.min.io/
- helm repo add grafana https://grafana.github.io/helm-charts
- helm repo add grafana-operator https://grafana.github.io/helm-charts
- helm repo update
-
- - name: Setup K3D
- uses: ./.github/actions/setup-k3d
-
- - name: Setup Helm plugins
- run: |
- helm plugin install https://github.com/databus23/helm-diff
-
- - name: Build helm dependencies
- run: |
- helm dependency build production/helm/loki
-
- - name: Install latest helm release
- run: |
- helm install --create-namespace loki-release grafana/loki -f production/helm/loki/scenarios/default-values.yaml
-
- - name: Run helm diff
- id: helm-diff
- env:
- HELM_DIFF_USE_UPGRADE_DRY_RUN: true
- run: |
- helm diff upgrade loki-release -f production/helm/loki/scenarios/default-values.yaml production/helm/loki | tee helm_diff_output.txt
-
- - name: Convert Helm Diff Output to Markdown
- id: convert_diff
- run: |
- cat helm_diff_output.txt >> formatted_diff_output.md
-
- - name: Upload diff output as artifact
- uses: actions/upload-artifact@v4
- id: upload_diff
- with:
- name: default-values-diff-output
- path: formatted_diff_output.md
- retention-days: 2
-
- ingress-values-diff:
- name: Ingress Values Scenario
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Setup Helm
- uses: azure/setup-helm@v4
-
- - name: Add required Helm repositories
- run: |
- helm repo add minio https://charts.min.io/
- helm repo add grafana https://grafana.github.io/helm-charts
- helm repo add grafana-operator https://grafana.github.io/helm-charts
- helm repo update
-
- - name: Setup K3D
- uses: ./.github/actions/setup-k3d
-
- - name: Setup Helm plugins
- run: |
- helm plugin install https://github.com/databus23/helm-diff
-
- - name: Build helm dependencies
- run: |
- helm dependency build production/helm/loki
-
- - name: Install latest helm release
- run: |
- helm install --create-namespace loki-release grafana/loki -f production/helm/loki/scenarios/ingress-values.yaml
-
- - name: Run helm diff
- id: helm-diff
- env:
- HELM_DIFF_USE_UPGRADE_DRY_RUN: true
- run: |
- helm diff upgrade loki-release -f production/helm/loki/scenarios/ingress-values.yaml production/helm/loki | tee helm_diff_output.txt
-
- - name: Convert Helm Diff Output to Markdown
- id: convert_diff
- run: |
- cat helm_diff_output.txt >> formatted_diff_output.md
-
- - name: Upload diff output as artifact
- uses: actions/upload-artifact@v4
- id: upload_diff
- with:
- name: ingress-diff-output
- path: formatted_diff_output.md
- retention-days: 2
-
- legacy-monitoring-values-diff:
- name: Legacy Monitoring Values Scenario
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Setup Helm
- uses: azure/setup-helm@v4
-
- - name: Add required Helm repositories
- run: |
- helm repo add minio https://charts.min.io/
- helm repo add grafana https://grafana.github.io/helm-charts
- helm repo add grafana-operator https://grafana.github.io/helm-charts
- helm repo update
-
- - name: Setup K3D
- uses: ./.github/actions/setup-k3d
-
- - name: Setup Helm plugins
- run: |
- helm plugin install https://github.com/databus23/helm-diff
-
- - name: Build helm dependencies
- run: |
- helm dependency build production/helm/loki
-
- - name: Install latest helm release
- run: |
- helm install --create-namespace loki-release grafana/loki -f production/helm/loki/scenarios/legacy-monitoring-values.yaml
-
- - name: Run helm diff
- id: helm-diff
+ # Conditional steps based on whether K3D is used
+ - name: Run diff with K3D
+ if: ${{ matrix.scenario.use_k3d }}
env:
HELM_DIFF_USE_UPGRADE_DRY_RUN: true
run: |
- helm diff upgrade loki-release -f production/helm/loki/scenarios/legacy-monitoring-values.yaml production/helm/loki | tee helm_diff_output.txt
+ helm install --create-namespace loki-release grafana/loki -f production/helm/loki/scenarios/${{ matrix.scenario.values_file }}
+ helm diff upgrade loki-release -f production/helm/loki/scenarios/${{ matrix.scenario.values_file }} production/helm/loki | tee helm_diff_output.txt
- - name: Convert Helm Diff Output to Markdown
- id: convert_diff
- run: |
- cat helm_diff_output.txt >> formatted_diff_output.md
-
- - name: Upload diff output as artifact
- uses: actions/upload-artifact@v4
- id: upload_diff
- with:
- name: legacy-monitoring-diff-output
- path: formatted_diff_output.md
- retention-days: 2
-
- simple-scalable-aws-kube-irsa-values-diff:
- name: Simple Scalable AWS Kube IRSA Values Scenario
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Setup Helm
- uses: azure/setup-helm@v4
-
- - name: Add required Helm repositories
- run: |
- helm repo add minio https://charts.min.io/
- helm repo add grafana https://grafana.github.io/helm-charts
- helm repo add grafana-operator https://grafana.github.io/helm-charts
- helm repo update
-
- - name: Build helm dependencies
- run: |
- helm dependency build production/helm/loki
-
- - name: Generate latest manifests
- run: |
- helm template loki-release grafana/loki -f production/helm/loki/scenarios/simple-scalable-aws-kube-irsa-values.yaml > release-manifest.yaml
-
- - name: Generate current manifest
- run: |
- helm template loki-release production/helm/loki -f production/helm/loki/scenarios/simple-scalable-aws-kube-irsa-values.yaml > current-manifest.yaml
-
- - name: Compare manifests
+ - name: Run diff without K3D
+ if: ${{ !matrix.scenario.use_k3d }}
run: |
+ helm template loki-release grafana/loki -f production/helm/loki/scenarios/${{ matrix.scenario.values_file }} > release-manifest.yaml
+ helm template loki-release production/helm/loki -f production/helm/loki/scenarios/${{ matrix.scenario.values_file }} > current-manifest.yaml
diff current-manifest.yaml release-manifest.yaml > helm_diff_output.txt || true
- name: Convert Helm Diff Output to Markdown
@@ -267,54 +89,7 @@ jobs:
uses: actions/upload-artifact@v4
id: upload_diff
with:
- name: simple-scalable-aws-kube-irsa-diff-output
- path: formatted_diff_output.md
- retention-days: 2
-
- simple-thanos-values-diff:
- name: Simple Thanos Values Scenario
- runs-on: ubuntu-latest
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Setup Helm
- uses: azure/setup-helm@v4
-
- - name: Add required Helm repositories
- run: |
- helm repo add minio https://charts.min.io/
- helm repo add grafana https://grafana.github.io/helm-charts
- helm repo add grafana-operator https://grafana.github.io/helm-charts
- helm repo update
-
- - name: Build helm dependencies
- run: |
- helm dependency build production/helm/loki
-
- - name: Generate latest manifests
- run: |
- helm template loki-release grafana/loki -f production/helm/loki/scenarios/simple-thanos-values.yaml > release-manifest.yaml
-
- - name: Generate current manifest
- run: |
- helm template loki-release production/helm/loki -f production/helm/loki/scenarios/simple-thanos-values.yaml > current-manifest.yaml
-
- - name: Compare manifests
- run: |
- diff current-manifest.yaml release-manifest.yaml > helm_diff_output.txt || true
-
- - name: Convert Helm Diff Output to Markdown
- id: convert_diff
- run: |
- cat helm_diff_output.txt >> formatted_diff_output.md
-
- - name: Upload diff output as artifact
- uses: actions/upload-artifact@v4
- id: upload_diff
- with:
- name: simple-thanos-diff-output
+ name: ${{ matrix.scenario.name }}-diff-output
path: formatted_diff_output.md
retention-days: 2
@@ -322,14 +97,7 @@ jobs:
name: Summary Diffs
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.fork == false
- needs:
- - single-binary-diff
- - default-values-diff
- - ingress-values-diff
- - legacy-monitoring-values-diff
- - simple-scalable-aws-kube-irsa-values-diff
- - simple-thanos-values-diff
-
+ needs: [helm-diff]
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -337,99 +105,24 @@ jobs:
persist-credentials: false
- uses: actions/download-artifact@v4
- with:
- name: single-binary-diff-output
- path: single-binary-diff
-
- - uses: actions/download-artifact@v4
- with:
- name: default-values-diff-output
- path: default-values-diff
-
- - uses: actions/download-artifact@v4
- with:
- name: ingress-diff-output
- path: ingress-values-diff
- - uses: actions/download-artifact@v4
- with:
- name: legacy-monitoring-diff-output
- path: legacy-monitoring-values-diff
-
- - uses: actions/download-artifact@v4
- with:
- name: simple-scalable-aws-kube-irsa-diff-output
- path: simple-scalable-aws-kube-irsa-values-diff
-
- - uses: actions/download-artifact@v4
- with:
- name: simple-thanos-diff-output
- path: simple-thanos-values-diff
-
- # TODO: Make step more generic and dynamic add the scenarios as needed
- name: Combine diff outputs
run: |
echo "## Helm Diff Output - Summary" > formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo "Single Binary Scenario
" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo '```diff' >> formatted_diff_output.md
- cat single-binary-diff/formatted_diff_output.md >> formatted_diff_output.md
- echo '```' >> formatted_diff_output.md
- echo " " >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
-
- echo "" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo "Default Values Scenario
" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo '```diff' >> formatted_diff_output.md
- cat default-values-diff/formatted_diff_output.md >> formatted_diff_output.md
- echo '```' >> formatted_diff_output.md
- echo " " >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
-
- echo "" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo "Ingress Values Scenario
" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo '```diff' >> formatted_diff_output.md
- cat ingress-values-diff/formatted_diff_output.md >> formatted_diff_output.md
- echo '```' >> formatted_diff_output.md
- echo " " >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
-
- echo "" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo "Legacy Monitoring Scenario
" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo '```diff' >> formatted_diff_output.md
- cat legacy-monitoring-values-diff/formatted_diff_output.md >> formatted_diff_output.md
- echo '```' >> formatted_diff_output.md
- echo " " >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
-
- echo "" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo "Simple Scalable AWS Kube IRSA Scenario
" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo '```diff' >> formatted_diff_output.md
- cat simple-scalable-aws-kube-irsa-values-diff/formatted_diff_output.md >> formatted_diff_output.md
- echo '```' >> formatted_diff_output.md
- echo " " >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
-
- echo "" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo "Simple Thanos Scenario
" >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
- echo '```diff' >> formatted_diff_output.md
- cat simple-thanos-values-diff/formatted_diff_output.md >> formatted_diff_output.md
- echo '```' >> formatted_diff_output.md
- echo " " >> formatted_diff_output.md
- echo "" >> formatted_diff_output.md
+ for scenario in */formatted_diff_output.md; do
+ scenario_name=$(dirname "$scenario")
+
+ echo "" >> formatted_diff_output.md
+ echo "" >> formatted_diff_output.md
+ echo "${scenario_name}
" >> formatted_diff_output.md
+ echo "" >> formatted_diff_output.md
+ echo '```diff' >> formatted_diff_output.md
+ cat "$scenario" >> formatted_diff_output.md
+ echo '```' >> formatted_diff_output.md
+ echo " " >> formatted_diff_output.md
+ echo "" >> formatted_diff_output.md
+ done
- name: Post diff as PR comment
uses: marocchino/sticky-pull-request-comment@v2
diff --git a/production/helm/loki/scenarios/README.md b/production/helm/loki/scenarios/README.md
index 496286bb2009d..a69d8b299295d 100644
--- a/production/helm/loki/scenarios/README.md
+++ b/production/helm/loki/scenarios/README.md
@@ -8,6 +8,19 @@ We deploy the scenario with the latest release and then we execute a helm diff w
>*NOTE*: the helm diff output file will be available for each scenario inside github action to download for 2 days, after this you may need to re-run the job if you would like to download the output files.
+## Add new scenario to the CI
+
+To add a new scenario in the CI, you would just add a new entry to the matrix configuration:
+
+```
+strategy:
+ matrix:
+ scenario:
+ - name: New Scenario
+ values_file: new-scenario-values.yaml
+ use_k3d: true # or false depending on requirements
+```
+
## Run scenarios locally
All this process that we run in the CI can be done locally, the following steps would explain how.