Skip to content

Commit 0d19e53

Browse files
authored
chore: get agent version from datadog-agent changelog (#1144)
## Overview - In the nightly builds of serverless-init, set the agent version to be the most recently released version of datadog-agent - In the release build of serverless-init, if `AGENT_VERSION` is not set, use the most recently released version from the Datadog agent branch given ## Testing Ran the nightly workflow manually off this branch and made sure the logs print the correct agent version https://github.com/DataDog/datadog-lambda-extension/actions/runs/23804573812 https://github.com/DataDog/datadog-lambda-extension/actions/runs/23804573812/job/69374220028#:~:text=AGENT_VERSION%3A%207.77.1 ``` AGENT_VERSION: 7.77.1 ```
1 parent 8c7d8ed commit 0d19e53

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/nightly-serverless-init.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ jobs:
3636
run: |
3737
STAMP=$(date -u +%Y%m%d)
3838
SHORT_SHA=$(git -C datadog-agent rev-parse --short=8 HEAD)
39+
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; }
3940
echo "stamp=${STAMP}" >> "$GITHUB_OUTPUT"
4041
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
4142
echo "version=nightly-${STAMP}-${SHORT_SHA}" >> "$GITHUB_OUTPUT"
43+
echo "agent_version=${AGENT_VERSION}" >> "$GITHUB_OUTPUT"
4244
4345
# Pin QEMU to a known-good version. See release-serverless-init.yml
4446
# and test-qemu-versions.yml for context on QEMU breakage history.
@@ -56,6 +58,7 @@ jobs:
5658
env:
5759
AGENT_PATH: datadog-agent
5860
VERSION: ${{ steps.meta.outputs.version }}
61+
AGENT_VERSION: ${{ steps.meta.outputs.agent_version }}
5962
SERVERLESS_INIT: "true"
6063
ALPINE: ${{ matrix.arrays.isAlpine }}
6164

.github/workflows/release-serverless-init.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
- "no"
2323
agentVersion:
2424
type: string
25-
description: Datadog agent version
25+
description: Datadog agent version (default latest release tag from Datadog agent branch)
2626
agentBranch:
2727
type: string
2828
description: Datadog agent branch or tag name (default main)
@@ -53,6 +53,15 @@ jobs:
5353
ref: ${{ github.event.inputs.agentBranch }}
5454
path: datadog-agent
5555

56+
- name: Compute agent version
57+
id: meta
58+
run: |
59+
AGENT_VERSION="${{ github.event.inputs.agentVersion }}"
60+
if [ -z "$AGENT_VERSION" ]; then
61+
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; }
62+
fi
63+
echo "agent_version=${AGENT_VERSION}" >> "$GITHUB_OUTPUT"
64+
5665
# Pin QEMU to a known-good version. The default (binfmt:latest) has broken
5766
# arm64 emulation multiple times due to QEMU segfaults in libc-bin triggers:
5867
# - Feb 2025: qemu-v9.2.0 — PR #571 pinned, PR #581 reverted to :latest
@@ -76,7 +85,7 @@ jobs:
7685
VERSION: ${{ github.event.inputs.tag }}
7786
SERVERLESS_INIT: true
7887
ALPINE: ${{ matrix.arrays.isAlpine }}
79-
AGENT_VERSION: ${{ github.event.inputs.agentVersion }}
88+
AGENT_VERSION: ${{ steps.meta.outputs.agent_version }}
8089

8190
- name: Set up build directory and copy binaries
8291
run: |

0 commit comments

Comments
 (0)