diff --git a/.ci/check-changelogs.groovy b/.ci/check-changelogs.groovy index a1523c83fbb..6185160784a 100644 --- a/.ci/check-changelogs.groovy +++ b/.ci/check-changelogs.groovy @@ -49,7 +49,7 @@ pipeline { deleteDir() unstash 'source' dir("${BASE_DIR}"){ - sh(label: 'Run check changelogs', script: './script/jenkins/check-changelogs.sh') + sh(label: 'Run check changelogs', script: './.ci/scripts/check-changelogs.sh') } } } diff --git a/script/jenkins/bench.sh b/.ci/scripts/bench.sh similarity index 100% rename from script/jenkins/bench.sh rename to .ci/scripts/bench.sh diff --git a/.ci/scripts/build-darwin.sh b/.ci/scripts/build-darwin.sh index b7625f8a684..4a2f561b5bd 100755 --- a/.ci/scripts/build-darwin.sh +++ b/.ci/scripts/build-darwin.sh @@ -6,4 +6,4 @@ source ./script/common.bash jenkins_setup -./script/jenkins/build.sh +./.ci/scripts/build.sh diff --git a/script/jenkins/build.sh b/.ci/scripts/build.sh similarity index 100% rename from script/jenkins/build.sh rename to .ci/scripts/build.sh diff --git a/script/jenkins/check-changelogs.sh b/.ci/scripts/check-changelogs.sh similarity index 100% rename from script/jenkins/check-changelogs.sh rename to .ci/scripts/check-changelogs.sh diff --git a/script/jenkins/intake.sh b/.ci/scripts/intake.sh similarity index 100% rename from script/jenkins/intake.sh rename to .ci/scripts/intake.sh diff --git a/script/jenkins/linux-test.sh b/.ci/scripts/linux-test.sh similarity index 100% rename from script/jenkins/linux-test.sh rename to .ci/scripts/linux-test.sh diff --git a/script/jenkins/package-docker-snapshot.sh b/.ci/scripts/package-docker-snapshot.sh similarity index 100% rename from script/jenkins/package-docker-snapshot.sh rename to .ci/scripts/package-docker-snapshot.sh diff --git a/script/jenkins/package.sh b/.ci/scripts/package.sh similarity index 100% rename from script/jenkins/package.sh rename to .ci/scripts/package.sh diff --git a/script/jenkins/sync.sh b/.ci/scripts/sync.sh similarity index 100% rename from script/jenkins/sync.sh rename to .ci/scripts/sync.sh diff --git a/.ci/scripts/test-darwin.sh b/.ci/scripts/test-darwin.sh index aa671118644..6df42b0ba72 100755 --- a/.ci/scripts/test-darwin.sh +++ b/.ci/scripts/test-darwin.sh @@ -17,4 +17,4 @@ source ./script/common.bash jenkins_setup -script/jenkins/unit-test.sh +./.ci/scripts/unit-test.sh diff --git a/script/jenkins/test-install-packages.sh b/.ci/scripts/test-install-packages.sh similarity index 100% rename from script/jenkins/test-install-packages.sh rename to .ci/scripts/test-install-packages.sh diff --git a/script/jenkins/unit-test.sh b/.ci/scripts/unit-test.sh similarity index 100% rename from script/jenkins/unit-test.sh rename to .ci/scripts/unit-test.sh diff --git a/script/jenkins/windows-build.ps1 b/.ci/scripts/windows-build.ps1 similarity index 100% rename from script/jenkins/windows-build.ps1 rename to .ci/scripts/windows-build.ps1 diff --git a/script/jenkins/windows-test.ps1 b/.ci/scripts/windows-test.ps1 similarity index 100% rename from script/jenkins/windows-test.ps1 rename to .ci/scripts/windows-test.ps1 diff --git a/Jenkinsfile b/Jenkinsfile index 1294ef05466..3ec9ef99513 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -112,7 +112,7 @@ pipeline { deleteDir() unstash 'source' dir("${BASE_DIR}"){ - sh(label: 'Run intake', script: './script/jenkins/intake.sh') + sh(label: 'Run intake', script: './.ci/scripts/intake.sh') } } } @@ -140,7 +140,7 @@ pipeline { dir(BASE_DIR){ retry(2) { // Retry in case there are any errors to avoid temporary glitches sleep randomNumber(min: 5, max: 10) - sh(label: 'Linux build', script: './script/jenkins/build.sh') + sh(label: 'Linux build', script: './.ci/scripts/build.sh') } } } @@ -170,8 +170,8 @@ pipeline { dir(BASE_DIR){ retry(2) { // Retry in case there are any errors to avoid temporary glitches sleep randomNumber(min: 5, max: 10) - powershell(label: 'Windows build', script: '.\\script\\jenkins\\windows-build.ps1') - powershell(label: 'Run Window tests', script: '.\\script\\jenkins\\windows-test.ps1') + powershell(label: 'Windows build', script: '.\\.ci\\scripts\\windows-build.ps1') + powershell(label: 'Run Window tests', script: '.\\.ci\\scripts\\windows-test.ps1') } } } @@ -245,7 +245,7 @@ pipeline { deleteDir() unstash 'source' dir("${BASE_DIR}"){ - sh(label: 'Run Unit tests', script: './script/jenkins/unit-test.sh') + sh(label: 'Run Unit tests', script: './.ci/scripts/unit-test.sh') } } } @@ -287,7 +287,7 @@ pipeline { deleteDir() unstash 'source' dir("${BASE_DIR}"){ - sh(label: 'Run Linux tests', script: './script/jenkins/linux-test.sh') + sh(label: 'Run Linux tests', script: './.ci/scripts/linux-test.sh') } } } @@ -335,7 +335,7 @@ pipeline { unstash 'source' golang(){ dir("${BASE_DIR}"){ - sh(label: 'Run benchmarks', script: './script/jenkins/bench.sh') + sh(label: 'Run benchmarks', script: './.ci/scripts/bench.sh') sendBenchmarks(file: 'bench.out', index: "benchmark-server") } } @@ -366,7 +366,7 @@ pipeline { unstash 'source' dir("${BASE_DIR}"){ catchError(buildResult: 'SUCCESS', message: 'Sync Kibana is not updated', stageResult: 'UNSTABLE') { - sh(label: 'Test Sync', script: './script/jenkins/sync.sh') + sh(label: 'Test Sync', script: './.ci/scripts/sync.sh') } } } @@ -386,7 +386,7 @@ pipeline { golang(){ dockerLogin(secret: env.DOCKER_SECRET, registry: env.DOCKER_REGISTRY) dir("${BASE_DIR}"){ - sh(label: 'Package & Push', script: "./script/jenkins/package-docker-snapshot.sh ${env.GIT_BASE_COMMIT} ${env.DOCKER_IMAGE}") + sh(label: 'Package & Push', script: "./.ci/scripts/package-docker-snapshot.sh ${env.GIT_BASE_COMMIT} ${env.DOCKER_IMAGE}") } } build(job: 'apm-server/apm-hey-test-benchmark', propagate: true, wait: true, @@ -428,10 +428,10 @@ pipeline { unstash 'source' golang(){ dir("${BASE_DIR}"){ - sh(label: 'Build packages', script: './script/jenkins/package.sh') - sh(label: 'Test packages install', script: './script/jenkins/test-install-packages.sh') + sh(label: 'Build packages', script: './.ci/scripts/package.sh') + sh(label: 'Test packages install', script: './.ci/scripts/test-install-packages.sh') dockerLogin(secret: env.DOCKER_SECRET, registry: env.DOCKER_REGISTRY) - sh(label: 'Package & Push', script: "./script/jenkins/package-docker-snapshot.sh ${env.GIT_BASE_COMMIT} ${env.DOCKER_IMAGE}") + sh(label: 'Package & Push', script: "./.ci/scripts/package-docker-snapshot.sh ${env.GIT_BASE_COMMIT} ${env.DOCKER_IMAGE}") } } } diff --git a/script/jenkins/ci.ps1 b/script/jenkins/ci.ps1 deleted file mode 100755 index 770d7699d6d..00000000000 --- a/script/jenkins/ci.ps1 +++ /dev/null @@ -1,67 +0,0 @@ -function Exec { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [scriptblock]$cmd, - [string]$errorMessage = ($msgs.error_bad_command -f $cmd) - ) - - try { - $global:lastexitcode = 0 - & $cmd - if ($lastexitcode -ne 0) { - throw $errorMessage - } - } - catch [Exception] { - throw $_ - } -} - -# Setup Go. -$env:GOPATH = $env:WORKSPACE -$env:PATH = "$env:GOPATH\bin;C:\tools\mingw64\bin;$env:PATH" -& gvm --format=powershell $(Get-Content .go-version) | Invoke-Expression - -# Write cached magefile binaries to workspace to ensure -# each run starts from a clean slate. -$env:MAGEFILE_CACHE = "$env:WORKSPACE\.magefile" - -# Configure testing parameters. -$env:TEST_COVERAGE = "true" -$env:RACE_DETECTOR = "true" - -# Install mage from vendor. -exec { go install github.com/elastic/apm-server/vendor/github.com/magefile/mage } - -echo "Fetching testing dependencies" -# TODO (elastic/beats#5050): Use a vendored copy of this. -exec { go get github.com/docker/libcompose } - -if (Test-Path "build") { Remove-Item -Recurse -Force build } -New-Item -ItemType directory -Path build\coverage | Out-Null -New-Item -ItemType directory -Path build\system-tests | Out-Null -New-Item -ItemType directory -Path build\system-tests\run | Out-Null - -echo "Building fields.yml" -exec { mage fields } - -echo "Building $env:beat" -exec { mage build } "Build FAILURE" - -echo "Unit testing $env:beat" -exec { mage goTestUnit } - -echo "System testing $env:beat" -# Get a CSV list of package names. -$packages = $(go list ./... | select-string -Pattern "/vendor/" -NotMatch | select-string -Pattern "/scripts/cmd/" -NotMatch) -$packages = ($packages|group|Select -ExpandProperty Name) -join "," -exec { go test -race -c -cover -covermode=atomic -coverpkg $packages } "go test FAILURE" - -echo "Running python tests" -choco install python -y -r --no-progress --version 3.8.1.20200110 -refreshenv -$env:PATH = "C:\Python38;C:\Python38\Scripts;$env:PATH" -$env:PYTHON_ENV = "$env:TEMP\python-env" -python --version -exec { mage pythonUnitTest } "System test FAILURE"