Skip to content

Commit

Permalink
[ci] Make tests pass in Jenkinsfile pipeline (#17071)
Browse files Browse the repository at this point in the history
* Address failing tests and warnings

* Ensure mage unitTest works consistently

Windows will invoke `mage unitTest` that will run the Go and Python tests without requiring the integration tests environment.

Use an alias for goTestUnit in metricbeat

* Only include test output when `mage -v` is used

The full test output is written to a file and we archive that. Additionally if a test fails that output is still logged out stderr.

This helps speed things up because Jenkins doesn't need to deal with streaming megabytes of log output to the console.
It also makes it easier to spot errors in the log.

* Jenkinsfile updates

Changes:

- Disable macOS by default. These workers don't have python3 so they cannot a portion of the tests.
- Add python38 to the PATH on Windows.
- Various fixes to the environment variables on Windows.
- Always add the GVM GOROOT/bin to the PATH on POSIX. Same as was being done on Windows.
- Use bat instead of sh on Windows to run `mage dumpVariables`.

* Add MAGEFILE_VERBOSE to travis-ci env
  • Loading branch information
andrewkroh authored Mar 24, 2020
1 parent 8a2ed76 commit df1ebf7
Show file tree
Hide file tree
Showing 23 changed files with 237 additions and 195 deletions.
2 changes: 1 addition & 1 deletion .ci/scripts/install-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GVM_CMD="${HOME}/bin/gvm"

mkdir -p "${HOME}/bin"

curl -sSLo "${GVM_CMD}" "https://github.com/andrewkroh/gvm/releases/download/v0.2.1/gvm-${ARCH}-amd64"
curl -sSLo "${GVM_CMD}" "https://github.com/andrewkroh/gvm/releases/download/v0.2.2/gvm-${ARCH}-amd64"
chmod +x "${GVM_CMD}"

gvm ${GO_VERSION}|cut -d ' ' -f 2|tr -d '\"' > ${PROPERTIES_FILE}
Expand Down
13 changes: 12 additions & 1 deletion .ci/scripts/install-tools.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@ IF ERRORLEVEL 1 (
mkdir %WORKSPACE%\bin
where /q gvm
IF ERRORLEVEL 1 (
curl -sL -o %WORKSPACE%\bin\gvm.exe https://github.com/andrewkroh/gvm/releases/download/v0.2.1/gvm-windows-amd64.exe
curl -sL -o %WORKSPACE%\bin\gvm.exe https://github.com/andrewkroh/gvm/releases/download/v0.2.2/gvm-windows-amd64.exe
)
FOR /f "tokens=*" %%i IN ('"gvm.exe" use %GO_VERSION% --format=batch') DO %%i

go env
go install -mod=vendor github.com/magefile/mage
mage -version
where mage

if not exist C:\Python38\python.exe (
REM Install python 3.8.
choco install python -y -r --no-progress --version 3.8.2
)
python --version
where python

4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ indent_style = tab
[*.mk]
indent_style = tab

[Jenkinsfile]
indent_size = 2
indent_style = space

[Vagrantfile]
indent_size = 2
indent_style = space
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ env:
# Newer versions of minikube fail on travis, see: https://github.com/kubernetes/minikube/issues/2704
- TRAVIS_MINIKUBE_VERSION=v0.25.2
- MACOSX_DEPLOYMENT_TARGET=10.15
# Enable verbose output since Travis users cannot access test output that is written to files.
# The constant output from tests also prevents time-outs.
- MAGEFILE_VERBOSE=true

# Only run CI jobs on specific branches.
# To keep the number of Travis CI jobs in check, we decided to configure Travis to only kick off CI jobs for the master branch.
Expand Down
Loading

0 comments on commit df1ebf7

Please sign in to comment.