Skip to content

feat(otelcol.processor.attribute): support include/exclude blocks #2522

feat(otelcol.processor.attribute): support include/exclude blocks

feat(otelcol.processor.attribute): support include/exclude blocks #2522

---
name: Integration Test
# yamllint disable-line rule:truthy
on:
push:
branches: ["main", "2.0-stable"]
paths:
- 'charts/**'
- '!charts/k8s-monitoring-v1/**'
pull_request:
paths:
- 'charts/**'
- '!charts/k8s-monitoring-v1/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions: {}
jobs:
list-tests:
name: List tests
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.list_tests.outputs.tests }}
steps:
- name: Checkout code
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
persist-credentials: 'false'
- name: List tests
id: list_tests
working-directory: charts/k8s-monitoring
env:
LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }}
run: |
# if "integration-test-skip" is set, return an empty list
# All labels on this PR
if echo "${LABELS}" | jq --exit-status '. | any(. == "integration-test-skip")' > /dev/null; then
echo "\"integration-test-skip\" label is set, skipping integration tests."
echo "tests=[]" >> "${GITHUB_OUTPUT}"
exit 0
fi
tests=$(find . -name test-plan.yaml -not \( -path "./tests/platform/*" \) -exec dirname {} \; | sed -e "s/^\.\///g")
echo "Tests: ${tests}"
echo "tests=$(echo "${tests}" | jq --raw-input --slurp --compact-output 'split("\n") | map(select(. != ""))')" >> "${GITHUB_OUTPUT}"
run-tests:
name: Integration Test
needs: list-tests
runs-on: ubuntu-latest
if: needs.list-tests.outputs.tests != '[]'
strategy:
matrix:
test: ${{ fromJson(needs.list-tests.outputs.tests) }}
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
path: source
persist-credentials: 'false'
- name: Checkout code
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
path: helm-chart-toolbox
repository: grafana/helm-chart-toolbox
persist-credentials: 'false'
- name: Set up Helm
id: setup-helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
continue-on-error: true
with:
version: 4.0.0
- name: Set up Homebrew
if: ${{ steps.setup-helm.outcome == 'failure' }}
uses: Homebrew/actions/setup-homebrew@3735452a47ff25baa52a581a6156cfe4efa420c8
- name: Install Helm
if: ${{ steps.setup-helm.outcome == 'failure' }}
run: brew install helm
- name: Install Flux CLI
uses: fluxcd/flux2/action@b6e76ca2534f76dcb8dd94fb057cdfa923c3b641 # v2.7.3
- name: Check for cluster config
id: test-config
working-directory: source/charts/k8s-monitoring
env:
TEST: ${{ matrix.test }}
run: |
yq eval '"cluster-type=" + .cluster.type // "kind"' "${TEST}/test-plan.yaml" > "${GITHUB_OUTPUT}"
yq eval '"subject-type=" + .subject.type // "helm"' "${TEST}/test-plan.yaml" >> "${GITHUB_OUTPUT}"
- name: Install Kind CLI
if: ${{ steps.test-config.outputs.cluster-type == 'kind' }}
uses: helm/kind-action@92086f6be054225fa813e0a4b13787fc9088faab # v1.13.0
with:
install_only: true
- name: Install Minikube CLI
if: ${{ steps.test-config.outputs.cluster-type == 'minikube' }}
uses: medyagh/setup-minikube@e3c7f79eb1e997eabccc536a6cf318a2b0fe19d9 # v0.0.20
with:
start: false
- name: Setup helmfile
if: ${{ steps.test-config.outputs.subject-type == 'helmfile' }}
uses: mamezou-tech/setup-helmfile@fd46979d2984c886929c416fbdf859b1c5efa0ea # v2.1.0
- name: Install terraform
if: ${{ steps.test-config.outputs.subject-type == 'terraform' }}
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
- name: Run test
run: |
if [ -f "${TEST_DIRECTORY}/Makefile" ]; then
make -C "${TEST_DIRECTORY}" clean all
fi
helm-chart-toolbox/tools/helm-test/helm-test "${TEST_DIRECTORY}"
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
KUBECONFIG: "${{ github.workspace }}/source/charts/k8s-monitoring/${{ matrix.test }}/kubeconfig.yaml"
TEST_DIRECTORY: "source/charts/k8s-monitoring/${{ matrix.test }}"
DELETE_CLUSTER: true