Skip to content

Commit

Permalink
packaging: add version check in release package tests (fluent#6390)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Stephens <[email protected]>

Signed-off-by: Patrick Stephens <[email protected]>
Signed-off-by: root <[email protected]>
  • Loading branch information
patrick-stephens authored and root committed Feb 8, 2023
1 parent fabc946 commit 42892c1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/staging-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ jobs:
run: |
./packaging/test-release-packages.sh
shell: bash
env:
VERSION_TO_CHECK_FOR: ${{ github.event.inputs.version }}

staging-release-smoke-test-containers:
name: Run container smoke tests
Expand Down
22 changes: 20 additions & 2 deletions packaging/test-release-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ fi
CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-docker}
INSTALL_SCRIPT=${INSTALL_SCRIPT:-https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh}

# Optional check for specific version
VERSION_TO_CHECK_FOR=${VERSION_TO_CHECK_FOR:-}
function check_version() {
if [[ -n "$VERSION_TO_CHECK_FOR" ]]; then
local LOG_FILE=$1
if ! grep -q "$VERSION_TO_CHECK_FOR" "$LOG_FILE"; then
echo "WARNING: Not using expected version: $VERSION_TO_CHECK_FOR"
exit 1
fi
fi
}

APT_TARGETS=("ubuntu:18.04"
"ubuntu:20.04"
"ubuntu:22.04"
Expand All @@ -26,19 +38,25 @@ YUM_TARGETS=("centos:7"
for IMAGE in "${APT_TARGETS[@]}"
do
echo "Testing $IMAGE"
LOG_FILE=$(mktemp)
$CONTAINER_RUNTIME run --rm -t \
-e FLUENT_BIT_PACKAGES_URL="${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}" \
-e FLUENT_BIT_PACKAGES_KEY="${FLUENT_BIT_PACKAGES_KEY:-https://packages.fluentbit.io/fluentbit.key}" \
"$IMAGE" \
sh -c "apt-get update && apt-get install -y sudo gpg curl;curl $INSTALL_SCRIPT | sh"
sh -c "apt-get update && apt-get install -y sudo gpg curl;curl $INSTALL_SCRIPT | sh && /opt/fluent-bit/bin/fluent-bit --version" | tee "$LOG_FILE"
check_version "$LOG_FILE"
rm -f "$LOG_FILE"
done

for IMAGE in "${YUM_TARGETS[@]}"
do
echo "Testing $IMAGE"
LOG_FILE=$(mktemp)
$CONTAINER_RUNTIME run --rm -t \
-e FLUENT_BIT_PACKAGES_URL="${FLUENT_BIT_PACKAGES_URL:-https://packages.fluentbit.io}" \
-e FLUENT_BIT_PACKAGES_KEY="${FLUENT_BIT_PACKAGES_KEY:-https://packages.fluentbit.io/fluentbit.key}" \
"$IMAGE" \
sh -c "yum install -y sudo;curl $INSTALL_SCRIPT | sh"
sh -c "yum install -y sudo;curl $INSTALL_SCRIPT | sh && /opt/fluent-bit/bin/fluent-bit --version" | tee "$LOG_FILE"
check_version "$LOG_FILE"
rm -f "$LOG_FILE"
done

0 comments on commit 42892c1

Please sign in to comment.