Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/nightly-serverless-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ jobs:
run: |
STAMP=$(date -u +%Y%m%d)
SHORT_SHA=$(git -C datadog-agent rev-parse --short=8 HEAD)
AGENT_VERSION=$(grep -m 1 -E '^[0-9]+\.[0-9]+\.[0-9]+$' datadog-agent/CHANGELOG.rst) || { echo "ERROR: could not detect agent version from datadog-agent's CHANGELOG.rst"; exit 1; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

echo "stamp=${STAMP}" >> "$GITHUB_OUTPUT"
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
echo "version=nightly-${STAMP}-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
echo "agent_version=${AGENT_VERSION}" >> "$GITHUB_OUTPUT"

# Pin QEMU to a known-good version. See release-serverless-init.yml
# and test-qemu-versions.yml for context on QEMU breakage history.
Expand All @@ -56,6 +58,7 @@ jobs:
env:
AGENT_PATH: datadog-agent
VERSION: ${{ steps.meta.outputs.version }}
AGENT_VERSION: ${{ steps.meta.outputs.agent_version }}
SERVERLESS_INIT: "true"
ALPINE: ${{ matrix.arrays.isAlpine }}

Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/release-serverless-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
- "no"
agentVersion:
type: string
description: Datadog agent version
description: Datadog agent version (default latest release tag from Datadog agent branch)
agentBranch:
type: string
description: Datadog agent branch or tag name (default main)
Expand Down Expand Up @@ -53,6 +53,15 @@ jobs:
ref: ${{ github.event.inputs.agentBranch }}
path: datadog-agent

- name: Compute agent version
id: meta
run: |
AGENT_VERSION="${{ github.event.inputs.agentVersion }}"
if [ -z "$AGENT_VERSION" ]; then
AGENT_VERSION=$(grep -m 1 -E '^[0-9]+\.[0-9]+\.[0-9]+$' datadog-agent/CHANGELOG.rst) || { echo "ERROR: could not detect agent version from datadog-agent's CHANGELOG.rst; set the Datadog agent version manually"; exit 1; }
fi
echo "agent_version=${AGENT_VERSION}" >> "$GITHUB_OUTPUT"
Comment on lines +56 to +63
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git command to retrieve the agent version could fail silently. If no tags matching the semantic version pattern are found, AGENT_VERSION will be empty, and the build will proceed with an empty version string. This could cause silent failures or unexpected behavior downstream. Consider adding error handling to verify that AGENT_VERSION is not empty before proceeding, or provide a clear error message if the version cannot be determined.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a default agent version set in datadog-agent, so an empty AGENT_VERSION would lead to it being set to 6.0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that 6.0.0 value something that we own? does it make sense to bump it to, say, 7.0.0? or better yet, "unknown"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't own it - seems like this number was set a long time ago, and some tests use this number


# Pin QEMU to a known-good version. The default (binfmt:latest) has broken
# arm64 emulation multiple times due to QEMU segfaults in libc-bin triggers:
# - Feb 2025: qemu-v9.2.0 — PR #571 pinned, PR #581 reverted to :latest
Expand All @@ -76,7 +85,7 @@ jobs:
VERSION: ${{ github.event.inputs.tag }}
SERVERLESS_INIT: true
ALPINE: ${{ matrix.arrays.isAlpine }}
AGENT_VERSION: ${{ github.event.inputs.agentVersion }}
AGENT_VERSION: ${{ steps.meta.outputs.agent_version }}

- name: Set up build directory and copy binaries
run: |
Expand Down
Loading