-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Pull requests migration to buildkite (#3573)
* buildkite test on Ubuntu * Fixed step ids * fix image family * Use aws from arm64 * try windows post-checkout hook * Windows pre-command hook and unit tests ps * Windows pre-command hook and unit tests ps * Windows pre-command hook and unit tests ps * Windows pre-command hook and unit tests ps * Windows pre-command hook and unit tests ps * Windows pre-command hook and unit tests ps * Windows pre-command hook and unit tests ps * Windows pre-command hook and unit tests ps * set GOPATH * set GOPATH * set GOPATH * set GOPATH * set GOPATH * Installed GCC * Installed GCC * Installed GCC * Windows 2016 * Propagate exit code on windows * Added GOTMPDIR * Added GOTMPDIR * Merge coverage reports step * Merge coverage reports step * Merge coverage reports step * changed installation path * changed installation path * changed installation path * changed installation path * changed installation path * changed installation path * test * test * merge.sh * Added coverage.out to simplify artifacts download * Fixed artifacts copy * buildite orka integration * fix os name * Add err message to upgrade test * Fix autocrlf for windows * Craig's patch * Complete test pipeline * Complete test pipeline * Remove macos GHA workflow * Fix Processing test results step * fix k8s jenkins step * Removed m1 stage * Enabled race detector for unit tests * Enables race detector for windows (cherry picked from commit bf78cc1) # Conflicts: # .buildkite/pipeline.yml # .buildkite/scripts/steps/unit-tests.sh # .ci/Jenkinsfile
- Loading branch information
1 parent
3b4a759
commit bc9cb60
Showing
10 changed files
with
301 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Set error handling | ||
$ErrorActionPreference = "Stop" | ||
|
||
# Define a function to checkout and merge | ||
function Checkout-Merge { | ||
param ( | ||
[string]$targetBranch, | ||
[string]$prCommit, | ||
[string]$mergeBranch | ||
) | ||
|
||
if (-not $targetBranch) { | ||
Write-Host "No pull request target branch" | ||
exit 1 | ||
} | ||
|
||
git fetch -v origin $targetBranch | ||
git checkout FETCH_HEAD | ||
Write-Host "Current branch: $(git rev-parse --abbrev-ref HEAD)" | ||
|
||
# Create a temporary branch to merge the PR with the target branch | ||
git checkout -b $mergeBranch | ||
Write-Host "New branch created: $(git rev-parse --abbrev-ref HEAD)" | ||
|
||
# Set author identity so it can be used for git merge | ||
git config user.name "github-merged-pr-post-checkout" | ||
git config user.email "auto-merge@buildkite" | ||
|
||
git merge --no-edit $prCommit | ||
|
||
if ($LASTEXITCODE -ne 0) { | ||
$mergeResult = $LASTEXITCODE | ||
Write-Host "Merge failed: $mergeResult" | ||
git merge --abort | ||
exit $mergeResult | ||
} | ||
} | ||
|
||
$pullRequest = $env:BUILDKITE_PULL_REQUEST | ||
|
||
if ($pullRequest -eq "false") { | ||
Write-Host "Not a pull request, skipping" | ||
exit 0 | ||
} | ||
|
||
$targetBranch = $env:BUILDKITE_PULL_REQUEST_BASE_BRANCH | ||
$prCommit = $env:BUILDKITE_COMMIT | ||
$prId = $env:BUILDKITE_PULL_REQUEST | ||
$mergeBranch = "pr_merge_$prId" | ||
|
||
Checkout-Merge $targetBranch $prCommit $mergeBranch | ||
|
||
Write-Host "Commit information" | ||
git --no-pager log --format=%B -n 1 | ||
|
||
Write-Host "Fixing CRLF in git checkout --" | ||
git config core.autocrlf true | ||
|
||
# Ensure Buildkite groups are rendered | ||
Write-Host "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Install gcc TODO: Move to the VM image | ||
choco install mingw | ||
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 | ||
refreshenv | ||
|
||
# Install gvm and go | ||
# TODO: Move GVM download to the base VM image | ||
$env:GvmVersion = "0.5.2" | ||
[Net.ServicePointManager]::SecurityProtocol = "tls12" | ||
$env:GoVersion = Get-Content -Path .go-version | ||
Invoke-WebRequest -URI https://github.com/andrewkroh/gvm/releases/download/v$env:GvmVersion/gvm-windows-amd64.exe -Outfile C:\Windows\System32\gvm.exe | ||
gvm --format=powershell $env:GoVersion | Invoke-Expression | ||
go version | ||
|
||
$GOPATH = $(go env GOPATH) | ||
$env:Path = "$GOPATH\bin;" + $env:Path | ||
[Environment]::SetEnvironmentVariable("GOPATH", "$GOPATH", [EnvironmentVariableTarget]::Machine) | ||
[Environment]::SetEnvironmentVariable("Path", "$GOPATH\bin;$env:Path", [EnvironmentVariableTarget]::Machine) | ||
|
||
# Install tools | ||
go install github.com/magefile/mage | ||
go install github.com/elastic/go-licenser | ||
go install golang.org/x/tools/cmd/goimports | ||
go install github.com/jstemmer/go-junit-report | ||
go install gotest.tools/gotestsum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Downloads and merges coverage files from multiple steps into a single file (build/TEST-go-unit.cov). | ||
# Usage: merge.sh <step1> <step2> ... Where <step> is the id of the step that contains the coverage artifact.# | ||
|
||
set -exuo pipefail | ||
|
||
COV_ARTIFACT="coverage.out" | ||
MERGED_COV_FILE="build/TEST-go-unit.cov" | ||
# Space separated list of paths to coverage files | ||
COV_PATHS="" | ||
|
||
go install github.com/wadey/gocovmerge@latest | ||
mkdir -p build | ||
|
||
for STEP_ID in "$@"; do | ||
mkdir -p $STEP_ID | ||
buildkite-agent artifact download --step $STEP_ID $COV_ARTIFACT $STEP_ID | ||
COV_PATHS="${COV_PATHS} $STEP_ID/$COV_ARTIFACT" | ||
done | ||
|
||
gocovmerge $COV_PATHS > $MERGED_COV_FILE | ||
echo "Merged coverage file: $MERGED_COV_FILE. See artifacts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
$ErrorActionPreference = "Stop" | ||
|
||
Write-Host "-- Fixing CRLF in git checkout --" | ||
git config core.autocrlf input | ||
git rm --quiet --cached -r . | ||
git reset --quiet --hard | ||
|
||
$env:GOTMPDIR = "$env:BUILDKITE_BUILD_CHECKOUT_PATH" | ||
|
||
Write-Host "--- Build" | ||
mage build | ||
|
||
if ($LASTEXITCODE -ne 0) { | ||
exit 1 | ||
} | ||
|
||
Write-Host "--- Unit tests" | ||
$env:TEST_COVERAGE = $true | ||
$env:RACE_DETECTOR = $true | ||
mage unitTest | ||
# Copy coverage file to build directory so it can be downloaded as an artifact | ||
cp .\build\TEST-go-unit.cov coverage.out | ||
|
||
if ($LASTEXITCODE -ne 0) { | ||
exit 1 | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
source .buildkite/scripts/common.sh | ||
|
||
echo "--- Unit tests" | ||
RACE_DETECTOR=true TEST_COVERAGE=true mage unitTest | ||
# Copy coverage file to build directory so it can be downloaded as an artifact | ||
cp build/TEST-go-unit.cov coverage.out |
Oops, something went wrong.