Skip to content

Network interface configuration #207

Network interface configuration

Network interface configuration #207

Workflow file for this run

name: chef-test
# Only run tests for main branch or if the PR has relevant changes
on:
push:
branches:
- main
paths:
- '.github/workflows/chef-test.yml'
- 'deployments/chef/**'
pull_request:
paths:
- '.github/workflows/chef-test.yml'
- 'deployments/chef/**'
- '!**.md'
concurrency:
group: chef-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: 'deployments/chef'
jobs:
chef-lint-spec-test:
name: chef-lint-spec-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@v3
- name: lint
run: make lint
- name: Rake spec
run: |
make rake-spec
chef-kitchen-matrix:
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Get linux distros and suites
id: get-linux-matrix
run: |
distros=$(yq '[.platforms[] | "\"" + (.name | sub("_", "-") | sub("\.", "")) + "\""] | join(", ")' kitchen.yml)
if [ -z "$distros" ]; then
echo "Failed to get platforms from kitchen.yml!" >&2
exit 1
fi
suites=$(yq '[.suites[] | "\"" + (.name | sub("_", "-") | sub("\.", "")) + "\""] | join(", ")' kitchen.yml)
if [ -z "$suites" ]; then
echo "Failed to get suites from kitchen.yml!" >&2
exit 1
fi
echo "matrix={'DISTRO': [${distros}], 'SUITE': [${suites}]}" >> $GITHUB_OUTPUT
- name: Get windows distros and suites
id: get-win-matrix
run: |
distros=$(yq '[.platforms[] | "\"" + (.name | sub("_", "-") | sub("\.", "")) + "\""] | join(", ")' kitchen.windows.yml)
if [ -z "$distros" ]; then
echo "Failed to get platforms from kitchen.windows.yml!" >&2
exit 1
fi
suites=$(yq '[.suites[] | "\"" + (.name | sub("_", "-") | sub("\.", "")) + "\""] | join(", ")' kitchen.windows.yml)
if [ -z "$suites" ]; then
echo "Failed to get suites from kitchen.windows.yml!" >&2
exit 1
fi
echo "matrix={'DISTRO': [${distros}], 'SUITE': [${suites}]}" >> $GITHUB_OUTPUT
outputs:
linux-matrix: ${{ steps.get-linux-matrix.outputs.matrix }}
win-matrix: ${{ steps.get-win-matrix.outputs.matrix }}
chef-kitchen-linux:
# Use 20.04.5 until https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/16450 is resolved
runs-on: ubuntu-20.04
needs: chef-kitchen-matrix
strategy:
matrix: ${{ fromJSON(needs.chef-kitchen-matrix.outputs.linux-matrix) }}
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install chef
uses: actionshub/chef-install@2.0.4
with:
version: 21.12.720
- run: kitchen test ${{ matrix.SUITE }}-${{ matrix.DISTRO }}
- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.SUITE }}-${{ matrix.DISTRO }}
path: deployments/chef/.kitchen/logs/*
chef-kitchen-windows:
runs-on: ${{ matrix.DISTRO }}
needs: chef-kitchen-matrix
strategy:
matrix: ${{ fromJSON(needs.chef-kitchen-matrix.outputs.win-matrix) }}
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Install chef
uses: actionshub/chef-install@2.0.4
with:
version: 21.12.720
- name: gem install kitchen-docker
run: |
$env:PATH = 'C:\opscode\chef-workstation\embedded\bin;' + $env:PATH
gem install kitchen-docker -v 2.12.0
- name: kitchen test ${{ matrix.SUITE }}-${{ matrix.DISTRO }}
run: |
kitchen test ${{ matrix.SUITE }}-${{ matrix.DISTRO }}
# For some reason, kitchen returns 0 here even if there are test failures, so check the log instead.
grep -q '0 failures' .kitchen/logs/kitchen.log || exit 1
shell: bash
env:
KITCHEN_YAML: kitchen.windows.yml
- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.SUITE }}-${{ matrix.DISTRO }}
path: deployments/chef/.kitchen/logs/*