support confmap providers in discovery config (#3874) #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: salt-test | |
# Only run tests if there are relevant changes | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/salt-test.yml' | |
- 'deployments/salt/**' | |
- 'internal/buildscripts/packaging/tests/deployments/salt/**' | |
- 'internal/buildscripts/packaging/tests/helpers/**' | |
- 'internal/buildscripts/packaging/tests/requirements.txt' | |
- '!**.md' | |
pull_request: | |
paths: | |
- '.github/workflows/salt-test.yml' | |
- 'deployments/salt/**' | |
- 'internal/buildscripts/packaging/tests/deployments/salt/**' | |
- 'internal/buildscripts/packaging/tests/helpers/**' | |
- 'internal/buildscripts/packaging/tests/requirements.txt' | |
- '!**.md' | |
concurrency: | |
group: salt-test-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
PYTHON_VERSION: '3.11' | |
REQUIREMENTS_PATH: "internal/buildscripts/packaging/tests/requirements.txt" | |
jobs: | |
salt-lint-test: | |
name: salt-lint-test | |
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Lint | |
run: | | |
make -C deployments/salt lint | |
salt-test-matrix: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Get matrix | |
id: get-matrix | |
run: | | |
# create test matrix for distro | |
dockerfiles=$(find internal/buildscripts/packaging/tests/deployments/salt/images/ -name "Dockerfile.*" | cut -d '.' -f2- | sort -u) | |
if [ -z "$dockerfiles" ]; then | |
echo "Failed to get dockerfiles from internal/buildscripts/packaging/tests/deployments/salt/images!" >&2 | |
exit 1 | |
fi | |
distro=$(for d in $dockerfiles; do echo -n "\"$d\","; done) | |
arch="\"amd64\", \"arm64\"" | |
matrix="{\"DISTRO\": [${distro%,}]}" | |
echo "$matrix" | jq | |
echo "matrix=${matrix}" >> $GITHUB_OUTPUT | |
outputs: | |
matrix: ${{ steps.get-matrix.outputs.matrix }} | |
salt-test: | |
name: salt-test | |
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved | |
runs-on: ${{ fromJSON('["ubuntu-20.04", "ubuntu-22.04"]')[matrix.DISTRO == 'amazonlinux-2023'] }} | |
timeout-minutes: 60 | |
needs: [salt-lint-test, salt-test-matrix] | |
strategy: | |
matrix: ${{ fromJSON(needs.salt-test-matrix.outputs.matrix) }} | |
fail-fast: false | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: pip | |
cache-dependency-path: ${{ env.REQUIREMENTS_PATH }} | |
- name: Install pytest | |
run: pip install -r "${{ env.REQUIREMENTS_PATH }}" | |
- name: Test salt deployment | |
id: pytest | |
continue-on-error: true | |
run: | | |
distro="${{ matrix.DISTRO }}" | |
if [[ "$distro" = "amazonlinux-2" ]]; then | |
# workaround for pytest substring matching | |
distro="amazonlinux-2 and not amazonlinux-2023" | |
fi | |
python3 -u -m pytest -s --verbose -k "$distro" \ | |
internal/buildscripts/packaging/tests/deployments/salt/salt_test.py | |
# qemu, networking, running systemd in containers, etc., can be flaky | |
- name: Re-run failed tests | |
if: ${{ steps.pytest.outcome == 'failure' }} | |
run: | | |
distro="${{ matrix.DISTRO }}" | |
if [[ "$distro" = "amazonlinux-2" ]]; then | |
# workaround for pytest substring matching | |
distro="amazonlinux-2 and not amazonlinux-2023" | |
fi | |
python3 -u -m pytest -s --verbose -k "$distro" \ | |
--last-failed \ | |
internal/buildscripts/packaging/tests/deployments/salt/salt_test.py |