Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/k8s
Browse files Browse the repository at this point in the history
* upstream/master:
  Remove folder jobdsl reference (#725)
  docs: update CHANGELOG.md
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release v1.1.138
  Allow withGoEnv to accept an OS override arg (#724)
  fix: support using gherkin-lint args (#723)
  [test-infra] fix pytests with multimodule (#722)
  • Loading branch information
v1v committed Sep 15, 2020
2 parents b443a81 + f0b506f commit 3d0ac46
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 15 deletions.
34 changes: 30 additions & 4 deletions .ci/scripts/gherkin-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,37 @@ set -eo pipefail
IMAGE="gherkin/lint"
docker pull "${IMAGE}" > /dev/null || true

## Iterate for each file without failing fast.
arguments=""
declare -a files

set +e
for file in "$@"; do
if ! docker run --rm -t -v "$(pwd)":/src -w /src "${IMAGE}" ${file} ; then
echo "ERROR: gherkin-lint failed for the file '${file}'"

while [ "$1" != "" ]; do
case $1 in
--disable )
arguments="$arguments $1 $2"
shift
;;
--enable )
arguments="$arguments $1 $2"
shift
;;
-v | --verbose )
arguments="$arguments $1"
;;
* )
files+=("$1")
esac
shift
done

echo "Running gherkin-lint with arguments: '${arguments}'"

## Iterate for each file without failing fast.
for file in "${files[@]}"; do
# shellcheck disable=SC2086
if ! docker run --rm -t -v "$(pwd)":/src -w /src "${IMAGE}" ${arguments} ${file}; then
echo "ERROR: gherkin-lint failed for the file '${file}'. Arguments: ${arguments}"
exit_status=1
fi
done
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v1.1.138 (15/09/2020)

#### 🐛 Bug Fixes

- [test-infra] fix pytests with multimodule [#722](https://github.com/elastic/apm-pipeline-library/pull/722)

#### ⚙️ CI

- [**on-hold**] refactor: use env variables from the plugin [#426](https://github.com/elastic/apm-pipeline-library/pull/426)

## v1.1.137 (14/09/2020)

#### 🚀 Enhancements
Expand Down
1 change: 0 additions & 1 deletion local/configs/jenkins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ jobs:
- file: "/var/pipeline-library/src/test/resources/folders/beats.dsl"
- file: "/var/pipeline-library/src/test/resources/folders/getBuildInfoJsonFiles.dsl"
- file: "/var/pipeline-library/src/test/resources/folders/it.dsl"
- file: "/var/pipeline-library/src/test/resources/folders/timeout.dsl"
- file: "/var/pipeline-library/src/test/resources/jobs/beats/beatsStages.dsl"
- file: "/var/pipeline-library/src/test/resources/jobs/beats/beatsWhen.dsl"
- file: "/var/pipeline-library/src/test/resources/jobs/cancelPreviousRunningBuilds.dsl"
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>co.elastic</groupId>
<artifactId>jenkins-library</artifactId>
<version>1.1.138-SNAPSHOT</version>
<version>1.1.139-SNAPSHOT</version>
<name>APM Pipeline Shared Library</name>
<description>Pipeline Shared Library containing utility steps.</description>
<url>https://github.com/elastic/apm-pipeline-library</url>
Expand Down
2 changes: 1 addition & 1 deletion resources/JenkinsfileTemplate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pipeline {
// the contributor is member from the elastic organisation, it tracks the status
// with a GitHub check when using a Multibranch Pipeline!
// Git reference repos are a good practise to speed up the whole execution time.
gitCheckout(basedir: "${BASE_DIR}", branch: 'master',
gitCheckout(basedir: "${BASE_DIR}",
repo: "git@github.com:elastic/${env.REPO}.git",
credentialsId: "${JOB_GIT_CREDENTIALS}",
githubNotifyFirstTimeContributor: false,
Expand Down
5 changes: 2 additions & 3 deletions resources/scripts/jenkins/apm-ci/test-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ if command -v docker-machine ; then
docker-machine start default || true
eval "$(docker-machine env default)"
docker_py_test=test-infra/apm-ci/test_installed_tools_docker.py
else
docker_py_test=""
fi

## Run test-infra and trap error to notify when required
set -x
# shellcheck disable=SC2086
{ py.test -v \
test-infra/apm-ci/test_installed_tools.py "${docker_py_test}" \
test-infra/apm-ci/test_installed_tools.py ${docker_py_test} \
--junit-xml=target/junit-test-infra.xml; \
err="$?"; } || true

Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/jenkins/beats-ci/test-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set -x

## Run test-infra and trap error to notify when required
{ py.test -v \
test-infra/beats-ci/test_installed_tools.py \
test-infra/beats-ci/test_beats_installed_tools.py \
--junit-xml=target/junit-test-infra.xml; \
err="$?"; } || true

Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/jenkins/beats-ci/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ exec { venv\Scripts\activate.bat }
exec { pip install testinfra }

# Run the test-infra
exec { py.test -v test-infra\beats-ci\test_windows.py --junit-xml=target\junit-test-infra.xml }
exec { py.test -v test-infra\beats-ci\test_beats_windows.py --junit-xml=target\junit-test-infra.xml }
4 changes: 2 additions & 2 deletions resources/scripts/jenkins/beats-ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ PACKER=${1:-false}

## Run test-infra and trap error to notify when required
{ py.test -v \
test-infra/beats-ci/test_installed_tools.py \
test-infra/beats-ci/test_beats_installed_tools.py \
--junit-xml=target/junit-test-infra.xml; \
er="$?"; } || true
err="${er}"

if [ "${PACKER}" = "true" ] ; then
{ py.test -v \
test-infra/beats-ci/test_packer.py \
test-infra/beats-ci/test_beats_packer.py \
--junit-xml=target/junit-test-packer.xml; \
er="$?"; } || true
if [ $er -gt 0 ] ; then
Expand Down
18 changes: 18 additions & 0 deletions src/test/groovy/WithGoEnvStepTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,24 @@ class WithGoEnvStepTests extends ApmBasePipelineTest {
assertJobStatusSuccess()
}

@Test
void testOSArg() throws Exception {
def script = loadScript(scriptName)
env.GO_VERSION = "1.12.2"
def isOK = false

script.call(os: 'custom-os'){
if(binding.getVariable("PATH") == "WS/bin:WS/.gvm/versions/go1.12.2.custom-os.amd64/bin:/foo/bin"
&& binding.getVariable("GOROOT") == "WS/.gvm/versions/go1.12.2.custom-os.amd64"
&& binding.getVariable("GOPATH") == "WS" ){
isOK = true
}
}
printCallStack()
assertTrue(isOK)
assertTrue(assertMethodCallContainsPattern('sh', 'Installing go 1.12.2'))
assertJobStatusSuccess()
}

@Test
void testPkgs() throws Exception {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion vars/withGoEnv.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def call(Map args = [:], Closure body) {
def goDefaultVersion = "" != "${env.GO_VERSION}" && env.GO_VERSION != null ? "${env.GO_VERSION}" : '1.14.2'
def version = args.containsKey('version') ? args.version : goDefaultVersion
def pkgs = args.containsKey('pkgs') ? args.pkgs : []
def os = nodeOS()
def os = args.containsKey('os') ? args.os : nodeOS()
def lastCoordinate = version[-2..-1]
// gvm remove the last coordinate if it is 0
def goDir = ".gvm/versions/go${lastCoordinate != ".0" ? version : version[0..-3]}.${os}.amd64"
Expand Down
1 change: 1 addition & 0 deletions vars/withGoEnv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

* version: Go version to install, if it is not set, it'll use GO_VERSION env var or '1.14.2'
* pkgs: Go packages to install with Go get before to execute any command.
* os: OS to use. (Example: `linux`). This is an option argument and if not set, the worker label will be used.

0 comments on commit 3d0ac46

Please sign in to comment.