From b92edb03092f61379162024da59223e6160d1a56 Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Fri, 4 Apr 2025 12:42:21 -0400 Subject: [PATCH 1/2] Install vector on macOS --- .github/ci-cd-scripts/start-vector-macos.sh | 23 ++++++++++++++++++++ .github/ci-cd-scripts/start-vector-ubuntu.sh | 23 ++++++++++++++++++++ .github/workflows/cargo-test.yml | 18 ++++----------- .github/workflows/e2e-tests.yml | 21 +++++------------- 4 files changed, 55 insertions(+), 30 deletions(-) create mode 100755 .github/ci-cd-scripts/start-vector-macos.sh create mode 100755 .github/ci-cd-scripts/start-vector-ubuntu.sh diff --git a/.github/ci-cd-scripts/start-vector-macos.sh b/.github/ci-cd-scripts/start-vector-macos.sh new file mode 100755 index 00000000000..7bfb94643b1 --- /dev/null +++ b/.github/ci-cd-scripts/start-vector-macos.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -euo pipefail + +# Install vector +brew tap vectordotdev/brew && brew install vector + +# Configure vector +mkdir -p /tmp/vector +cp .github/workflows/vector.toml /tmp/vector.toml +sed -i '' "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml +sed -i '' "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml +sed -i '' "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml +sed -i '' "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml +sed -i '' "s#GH_ACTIONS_AXIOM_TOKEN#${GH_ACTIONS_AXIOM_TOKEN}#g" /tmp/vector.toml + +# Display settings +echo +echo 'Vector config:' +cat /tmp/vector.toml +echo + +# Start in the background +$(brew --prefix)/opt/vector/bin/vector --config /tmp/vector.toml & diff --git a/.github/ci-cd-scripts/start-vector-ubuntu.sh b/.github/ci-cd-scripts/start-vector-ubuntu.sh new file mode 100755 index 00000000000..487e32c0aef --- /dev/null +++ b/.github/ci-cd-scripts/start-vector-ubuntu.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -euo pipefail + +# Install vector +curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev | bash -s -- -y + +# Configure vector +mkdir -p /tmp/vector +cp .github/workflows/vector.toml /tmp/vector.toml +sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml +sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml +sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml +sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml +sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${GH_ACTIONS_AXIOM_TOKEN}#g" /tmp/vector.toml + +# Display settings +echo +echo 'Vector config:' +cat /tmp/vector.toml +echo + +# Start in background +${HOME}/.vector/bin/vector --config /tmp/vector.toml & diff --git a/.github/workflows/cargo-test.yml b/.github/workflows/cargo-test.yml index ce73f7303ae..416e37f92ee 100644 --- a/.github/workflows/cargo-test.yml +++ b/.github/workflows/cargo-test.yml @@ -34,20 +34,10 @@ jobs: uses: actions-rust-lang/setup-rust-toolchain@v1 with: cache: false # Configured below. - - name: Install vector - run: | - curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh - chmod +x /tmp/vector.sh - /tmp/vector.sh -y -no-modify-path - mkdir -p /tmp/vector - cp .github/workflows/vector.toml /tmp/vector.toml - sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml - sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml - sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml - sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml - sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml - cat /tmp/vector.toml - ${HOME}/.vector/bin/vector --config /tmp/vector.toml & + - name: Start Vector + run: .github/ci-cd-scripts/start-vector-ubuntu.sh + env: + GH_ACTIONS_AXIOM_TOKEN: ${{ secrets.GH_ACTIONS_AXIOM_TOKEN }} - uses: taiki-e/install-action@cargo-llvm-cov - uses: taiki-e/install-action@nextest - name: Install just diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 7634b305823..a266e002c15 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -339,22 +339,11 @@ jobs: if: needs.conditions.outputs.should-run == 'true' run: yarn tronb:vite:dev - - name: Install vector - if: ${{ needs.conditions.outputs.should-run == 'true' && contains(matrix.os, 'ubuntu') }} - shell: bash - run: | - curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh - chmod +x /tmp/vector.sh - /tmp/vector.sh -y -no-modify-path - mkdir -p /tmp/vector - cp .github/workflows/vector.toml /tmp/vector.toml - sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml - sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml - sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml - sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml - sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml - cat /tmp/vector.toml - ${HOME}/.vector/bin/vector --config /tmp/vector.toml & + - name: Start Vector + if: ${{ needs.conditions.outputs.should-run == 'true' && !contains(matrix.os, 'windows') }} + run: .github/ci-cd-scripts/start-vector-${{ env.OS_NAME }}.sh + env: + GH_ACTIONS_AXIOM_TOKEN: ${{ secrets.GH_ACTIONS_AXIOM_TOKEN }} - uses: actions/download-artifact@v4 if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }} From e75feabd8b4105a01e80a8c54bfcc0e039ed5d8b Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Mon, 7 Apr 2025 11:40:42 -0400 Subject: [PATCH 2/2] Include platform information --- .github/ci-cd-scripts/start-vector-macos.sh | 1 + .github/ci-cd-scripts/start-vector-ubuntu.sh | 1 + .github/workflows/cargo-test.yml | 1 + .github/workflows/e2e-tests.yml | 1 + .github/workflows/vector.toml | 1 + 5 files changed, 5 insertions(+) diff --git a/.github/ci-cd-scripts/start-vector-macos.sh b/.github/ci-cd-scripts/start-vector-macos.sh index 7bfb94643b1..689de546f12 100755 --- a/.github/ci-cd-scripts/start-vector-macos.sh +++ b/.github/ci-cd-scripts/start-vector-macos.sh @@ -7,6 +7,7 @@ brew tap vectordotdev/brew && brew install vector # Configure vector mkdir -p /tmp/vector cp .github/workflows/vector.toml /tmp/vector.toml +sed -i '' "s#OS_NAME#${OS_NAME}#g" /tmp/vector.toml sed -i '' "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml sed -i '' "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml sed -i '' "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml diff --git a/.github/ci-cd-scripts/start-vector-ubuntu.sh b/.github/ci-cd-scripts/start-vector-ubuntu.sh index 487e32c0aef..1f80337dbd4 100755 --- a/.github/ci-cd-scripts/start-vector-ubuntu.sh +++ b/.github/ci-cd-scripts/start-vector-ubuntu.sh @@ -7,6 +7,7 @@ curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev | bash -s -- -y # Configure vector mkdir -p /tmp/vector cp .github/workflows/vector.toml /tmp/vector.toml +sed -i "s#OS_NAME#${OS_NAME}#g" /tmp/vector.toml sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml diff --git a/.github/workflows/cargo-test.yml b/.github/workflows/cargo-test.yml index 416e37f92ee..037916a03d0 100644 --- a/.github/workflows/cargo-test.yml +++ b/.github/workflows/cargo-test.yml @@ -38,6 +38,7 @@ jobs: run: .github/ci-cd-scripts/start-vector-ubuntu.sh env: GH_ACTIONS_AXIOM_TOKEN: ${{ secrets.GH_ACTIONS_AXIOM_TOKEN }} + OS_NAME: ${{ env.OS_NAME }} - uses: taiki-e/install-action@cargo-llvm-cov - uses: taiki-e/install-action@nextest - name: Install just diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index a266e002c15..0d79cac41f7 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -344,6 +344,7 @@ jobs: run: .github/ci-cd-scripts/start-vector-${{ env.OS_NAME }}.sh env: GH_ACTIONS_AXIOM_TOKEN: ${{ secrets.GH_ACTIONS_AXIOM_TOKEN }} + OS_NAME: ${{ env.OS_NAME }} - uses: actions/download-artifact@v4 if: ${{ needs.conditions.outputs.should-run == 'true' && !cancelled() && (success() || failure()) }} diff --git a/.github/workflows/vector.toml b/.github/workflows/vector.toml index bf4069b4acf..9204755d0e7 100644 --- a/.github/workflows/vector.toml +++ b/.github/workflows/vector.toml @@ -8,6 +8,7 @@ include = ["/tmp/github-actions.log"] type = "remap" inputs = [ "github-actions-file" ] source = ''' +.platform = "OS_NAME" .action = "GITHUB_WORKFLOW" .repo = "GITHUB_REPOSITORY" .sha = "GITHUB_SHA"