From 173216dc0db6198748fa9adcbb9c16f4f3ae72e1 Mon Sep 17 00:00:00 2001 From: Patrick Stephens Date: Sat, 12 Jul 2025 14:36:03 +0100 Subject: [PATCH] ci: handle with/without v prefix for versions Signed-off-by: Patrick Stephens --- .github/workflows/add-mapping-version.yaml | 6 +++--- docs/version-mapping.md | 2 +- scripts/add-mapping-version.sh | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/add-mapping-version.yaml b/.github/workflows/add-mapping-version.yaml index 4858fe4..e786017 100644 --- a/.github/workflows/add-mapping-version.yaml +++ b/.github/workflows/add-mapping-version.yaml @@ -19,6 +19,6 @@ jobs: add-mapping-version: uses: ./.github/workflows/call-add-mapping-version.yaml with: - agent-version: ${{ github.event.inputs.agent-version }} - oss-version: ${{ github.event.inputs.oss-version }} - dry-run: ${{ github.event.inputs.dry-run }} + agent-version: ${{ inputs.agent-version }} + oss-version: ${{ inputs.oss-version }} + dry-run: ${{ inputs.dry-run }} diff --git a/docs/version-mapping.md b/docs/version-mapping.md index 9b16b5c..deafcae 100644 --- a/docs/version-mapping.md +++ b/docs/version-mapping.md @@ -6,4 +6,4 @@ The following shows the underlying [OSS version of Fluent Bit](https://github.co |FluentDo Agent Version|OSS Version Base| |----------------------|----------------| -| 25.7.1 | 4.0.3 | +| 25.7.1 | 4.0.3 | diff --git a/scripts/add-mapping-version.sh b/scripts/add-mapping-version.sh index 1c3d431..50b1a87 100755 --- a/scripts/add-mapping-version.sh +++ b/scripts/add-mapping-version.sh @@ -18,6 +18,24 @@ MAPPING_FILE=${MAPPING_FILE:-$DOCS_DIR/version-mapping.md} NEW_OSS_VERSION=${NEW_OSS_VERSION:?} NEW_AGENT_VERSION=${NEW_AGENT_VERSION:?} +# Handle version string with or without a v prefix - we just want semver +if [[ "$NEW_OSS_VERSION" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+)$ ]] ; then + NEW_OSS_VERSION=${BASH_REMATCH[1]} + echo "Valid OSS version string: $NEW_OSS_VERSION" +else + echo "ERROR: Invalid OSS semver string: $NEW_OSS_VERSION" + exit 1 +fi + +# Handle version string with or without a v prefix - we just want semver +if [[ "$NEW_AGENT_VERSION" =~ ^v?([0-9]+\.[0-9]+\.[0-9]+)$ ]] ; then + NEW_AGENT_VERSION=${BASH_REMATCH[1]} + echo "Valid FluentDo agent version string: $NEW_AGENT_VERSION" +else + echo "ERROR: Invalid FluentDo agent semver string: $NEW_AGENT_VERSION" + exit 1 +fi + # Check if the mapping file exists if [[ ! -f "$MAPPING_FILE" ]]; then echo "ERROR: Mapping file $MAPPING_FILE does not exist."