Skip to content

Commit 8349e93

Browse files
committed
Get agent version from datadog-agent tag list
1 parent 8c7d8ed commit 8349e93

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=$(git -C datadog-agent tag --sort=-version:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -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 agentBranch)
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=$(git -C datadog-agent tag --sort=-version:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | head -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)