[ACTP] add par-control resolved configuration #59802
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: test devcontainer | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changes: "${{ steps.images.outputs.changed == 'true' || steps.files.outputs.changed == 'true' }}" | |
| steps: | |
| - name: Fetch changed files (PR) | |
| if: github.event_name == 'pull_request' | |
| env: | |
| GH_TOKEN: "${{ github.token }}" | |
| run: | | |
| gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files --paginate \ | |
| | jq -s 'add' > pr-files.json | |
| - name: Fetch changed files (push) | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| if: github.event_name == 'push' | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 2 | |
| - name: Build changed files list | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| jq -r '.[].filename' pr-files.json | sort -u > changed-files.txt | |
| jq -r '.[] | select(.filename==".gitlab-ci.yml") | .patch // empty' pr-files.json > gitlab-ci.patch | |
| else | |
| git diff --name-only HEAD~1 HEAD | sort -u > changed-files.txt | |
| git diff HEAD~1 HEAD -- .gitlab-ci.yml > gitlab-ci.patch || true | |
| fi | |
| - name: Detect CI image changes | |
| id: images | |
| run: | | |
| if grep -E '^[-+] +CI_IMAGE_[^:]+: v' gitlab-ci.patch >/dev/null; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Detect files of interest changes | |
| id: files | |
| run: | | |
| cat > files-of-interest.txt <<'EOF' | |
| .github/workflows/test-devcontainer.yml | |
| tasks/devcontainer.py | |
| EOF | |
| if grep -Fx -f files-of-interest.txt changed-files.txt >/dev/null; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| test: | |
| needs: detect-changes | |
| if: ${{ needs.detect-changes.outputs.changes == 'true' }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm] | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 1000 | |
| fetch-tags: true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 | |
| - name: Install dda | |
| uses: ./.github/actions/install-dda | |
| with: | |
| features: legacy-tasks | |
| - name: Free disk space | |
| run: | | |
| df -h | |
| echo "::group::Android" | |
| sudo rm -rf /usr/local/lib/android | |
| echo "::endgroup::" | |
| echo "::group::.NET" | |
| sudo rm -rf /usr/share/dotnet | |
| echo "::endgroup::" | |
| echo "::group::Haskell" | |
| sudo rm -rf /opt/ghc | |
| echo "::endgroup::" | |
| echo "::group::CodeQL" | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| echo "::endgroup::" | |
| df -h | |
| - name: Create Dev Container config | |
| run: dda inv -- devcontainer.setup | |
| - name: Ensure mount paths exist | |
| run: | | |
| mkdir -p ~/.ssh | |
| - name: Install Dev Container CLI | |
| run: npm install -g @devcontainers/cli@0.86.0 | |
| - name: Start Dev Container | |
| run: devcontainer up --workspace-folder . | |
| - name: Grant the dd user access to host Docker socket | |
| run: | | |
| docker exec -u root datadog-agent-devcontainer sh -lc ' | |
| set -e | |
| sock=/var/run/docker.sock | |
| gid=$(stat -c %g "$sock") | |
| getent group "$gid" >/dev/null || groupadd -g "$gid" dockersock | |
| gname=$(getent group "$gid" | cut -d: -f1) | |
| id -nG dd | tr " " "\n" | grep -qx "$gname" || usermod -aG "$gname" dd | |
| ' | |
| - name: Test Agent build | |
| run: devcontainer exec --workspace-folder . dda inv agent.hacky-dev-image-build --target-image=agent |