diff --git a/.github/workflows/staging-release.yaml b/.github/workflows/staging-release.yaml index 3bc77957ba6..b0769abc5c2 100644 --- a/.github/workflows/staging-release.yaml +++ b/.github/workflows/staging-release.yaml @@ -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 diff --git a/packaging/test-release-packages.sh b/packaging/test-release-packages.sh index 37a00cfbbcb..87139368b50 100755 --- a/packaging/test-release-packages.sh +++ b/packaging/test-release-packages.sh @@ -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" @@ -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