name: Vector Compatibility Advisory
on:
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
check-vector:
name: Vector compatibility (advisory)
runs-on: ubuntu-24.04
steps:
- name: Checkout VRL
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
path: vrl
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends \
build-essential \
cmake \
libclang-dev \
libsasl2-dev \
libssl-dev \
llvm \
pkg-config \
protobuf-compiler
protoc --version
- name: Clone Vector repo and point it at this PR
env:
VRL_GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }}
VRL_GITHUB_BRANCH: ${{ github.head_ref }}
run: |
git clone https://github.com/vectordotdev/vector.git
cd vector
git switch master
# Set new git repo and branch
NEW_REPO="https://github.com/${VRL_GITHUB_REPO}.git"
NEW_BRANCH="${VRL_GITHUB_BRANCH}"
# Extract existing features (if any)
FEATURES=$(sed -nE 's/.*vrl = \{[^}]*features = (\[[^]]*\]).*/\1/p' Cargo.toml)
# Compose the new dependency line
if [[ -n "$FEATURES" ]]; then
NEW_VRL_DEP_LINE="vrl = { git = \"$NEW_REPO\", branch = \"$NEW_BRANCH\", features = $FEATURES }"
else
NEW_VRL_DEP_LINE="vrl = { git = \"$NEW_REPO\", branch = \"$NEW_BRANCH\" }"
fi
# Replace the old vrl line
sed -i.bak -E "s|vrl = \{[^}]*\}|$NEW_VRL_DEP_LINE|" Cargo.toml
- name: Prepare Vector dependencies
run: |
cd vector
cargo update -p vrl
cargo fetch --locked
- name: Cargo Check Vector
id: vector-check
continue-on-error: true
run: |
cd vector
cargo check --workspace --locked --offline
- name: Summarize compatibility result
if: steps.vector-check.outcome == 'success' || steps.vector-check.outcome == 'failure'
env:
VECTOR_CHECK_OUTCOME: ${{ steps.vector-check.outcome }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
mkdir -p /tmp/vector-compatibility-advisory
echo "$PR_NUMBER" > /tmp/vector-compatibility-advisory/pr-number
echo "$VECTOR_CHECK_OUTCOME" > /tmp/vector-compatibility-advisory/outcome
if [[ "$VECTOR_CHECK_OUTCOME" == "failure" ]]; then
echo "::warning title=Vector compatibility impact::Vector does not compile with this VRL change. This advisory does not block merging."
{
echo "## :warning: Vector compatibility impact"
echo
echo "Vector does not compile with this VRL change. This is advisory and does not block merging. No change to this PR is necessarily required; review the failure to determine whether Vector needs a follow-up change."
} >> "$GITHUB_STEP_SUMMARY"
else
{
echo "## :white_check_mark: Vector compatibility"
echo
echo "Vector compiles with this VRL change."
} >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload compatibility result
if: steps.vector-check.outcome == 'success' || steps.vector-check.outcome == 'failure'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with:
name: vector-compatibility-advisory
path: /tmp/vector-compatibility-advisory
retention-days: 1