feat: infrahub-collect troubleshooting-bundle tool (INFP-415) #388
Workflow file for this run
This file contains hidden or 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: CI | |
| # yamllint disable rule:truthy rule:line-length | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| files-changed: | |
| name: Detect which files have changed | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| documentation: ${{ steps.changes.outputs.documentation_all }} | |
| go: ${{ steps.changes.outputs.go_all }} | |
| nix: ${{ steps.changes.outputs.nix_all }} | |
| python: ${{ steps.changes.outputs.python_all }} | |
| yaml: ${{ steps.changes.outputs.yaml_all }} | |
| markdown: ${{ steps.changes.outputs.markdown_all }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Check for file changes | |
| uses: opsmill/paths-filter@v3.0.2 | |
| id: changes | |
| with: | |
| token: ${{ github.token }} | |
| filters: .github/file-filters.yml | |
| go-lint: | |
| if: needs.files-changed.outputs.go == 'true' | |
| needs: ["files-changed"] | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| - name: Build watchdog | |
| run: make build-watchdog | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.7.2 | |
| test: | |
| if: needs.files-changed.outputs.go == 'true' | |
| needs: ["files-changed", "go-lint"] | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| - name: Build watchdog | |
| run: make build-watchdog | |
| - name: Run tests | |
| run: make test | |
| e2e-tests-docker: | |
| if: needs.files-changed.outputs.go == 'true' | |
| needs: ["files-changed", "test"] | |
| runs-on: | |
| group: huge-runners | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| edition: [community, enterprise] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up Python and uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install tini | |
| run: apt-get update && apt-get install -y tini | |
| - name: Build binaries (infrahub-backup, infrahub-taskmanager, infrahub-collect) | |
| run: make build | |
| - name: Install Python dependencies | |
| run: uv sync --all-packages | |
| - name: "Set environment variables" | |
| run: | | |
| RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/') | |
| echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV | |
| - name: Run e2e tests (Docker Compose) | |
| env: | |
| INFRAHUB_TESTING_ENTERPRISE: ${{ matrix.edition == 'enterprise' && 'true' || '' }} | |
| run: exec tini -s -g -- uv run pytest -v -m docker tests/e2e | |
| e2e-tests-k8s: | |
| if: needs.files-changed.outputs.go == 'true' | |
| needs: ["files-changed", "test"] | |
| runs-on: | |
| group: huge-runners | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| edition: [community, enterprise] | |
| env: | |
| INFRAHUB_HELM_CHART: ${{ matrix.edition == 'enterprise' && 'oci://registry.opsmill.io/opsmill/chart/infrahub-enterprise' || 'oci://registry.opsmill.io/opsmill/chart/infrahub' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25" | |
| - name: Set up vCluster | |
| uses: loft-sh/setup-vcluster@68e17a8c3618e3c47d635842b803d4f560f694e8 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Set up kubectl | |
| uses: azure/setup-kubectl@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up Python and uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install tini | |
| run: apt-get update && apt-get install -y tini | |
| - name: Build binaries (infrahub-backup, infrahub-taskmanager, infrahub-collect) | |
| run: make build | |
| - name: Install Python dependencies | |
| run: uv sync --all-packages | |
| - name: "Set environment variables" | |
| run: | | |
| RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/') | |
| echo "VCLUSTER_DIR=/var/lib/github/${RUNNER_NAME}/_temp/.vcluster/config.json" >> $GITHUB_ENV | |
| - name: Run e2e tests (Kubernetes) | |
| run: exec tini -s -g -- uv run pytest -v -m k8s tests/e2e | |
| nix-build: | |
| if: needs.files-changed.outputs.nix == 'true' | |
| needs: ["files-changed"] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: DeterminateSystems/nix-installer-action@v22 | |
| - uses: DeterminateSystems/magic-nix-cache-action@v13 | |
| - name: Verify if nix build succeeds | |
| run: nix build --no-link | |
| python-lint: | |
| if: needs.files-changed.outputs.python == 'true' | |
| needs: ["files-changed"] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - run: uv sync --only-group dev | |
| - name: Check code formatting | |
| run: | | |
| uv run --no-sync ruff format --check --diff | |
| uv run --no-sync ruff check --select I . | |
| - name: Run linters | |
| run: uv run --no-sync ruff check | |
| - name: Run type checks | |
| run: uv run --no-sync mypy . | |
| yaml-lint: | |
| if: needs.files-changed.outputs.yaml == 'true' | |
| needs: ["files-changed"] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - run: uv sync --only-group dev | |
| - name: Run yamllint | |
| run: uv run --no-sync yamllint -s . | |
| markdown-lint: | |
| if: needs.files-changed.outputs.markdown == 'true' | |
| needs: ["files-changed"] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - run: uv sync --only-group dev | |
| - name: Run rumdl | |
| run: uv run --no-sync rumdl check . | |
| validate-documentation-style: | |
| if: | | |
| always() && !cancelled() && | |
| !contains(needs.*.result, 'failure') && | |
| !contains(needs.*.result, 'cancelled') && | |
| needs.files-changed.outputs.documentation == 'true' | |
| needs: ["files-changed", "yaml-lint", "markdown-lint"] | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 5 | |
| env: | |
| VALE_VERSION: "3.13.0" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download Vale | |
| run: | | |
| curl -sL "https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz" -o vale.tar.gz | |
| tar -xzf vale.tar.gz | |
| - name: Validate documentation style | |
| run: ./vale $(find ./docs/docs -type f \( -name "*.mdx" -o -name "*.md" \)) | |
| documentation: | |
| defaults: | |
| run: | |
| working-directory: ./docs | |
| if: | | |
| always() && !cancelled() && | |
| !contains(needs.*.result, 'failure') && | |
| !contains(needs.*.result, 'cancelled') && | |
| needs.files-changed.outputs.documentation == 'true' | |
| needs: ["files-changed", "yaml-lint", "markdown-lint"] | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.33.0 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| cache-dependency-path: docs/pnpm-lock.yaml | |
| - name: Install Node dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build docs website | |
| run: pnpm run build |