From a1107747cb0253f7d4d5fac0238d14d1f05cd3b3 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 22 Oct 2020 11:23:02 +0100 Subject: [PATCH 1/6] [CI] fix No such property: APM_URL_BASE --- .ci/Jenkinsfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index f240036..94f5f87 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -64,8 +64,14 @@ pipeline { dir("${BASE_DIR}"){ sh(label: 'make batch', script: """#!/bin/bash - echo "beats_url_base: ${BEATS_URL_BASE}" > run-settings-jenkins.yml - echo "apm_url_base: ${APM_URL_BASE}" >> run-settings-jenkins.yml + ## Skip BEATS if no params. + if [ -n "${env.BEATS_URL_BASE?.trim()}" ] ; then + echo "beats_url_base: ${env.BEATS_URL_BASE}" > run-settings-jenkins.yml + fi + ## Skip APM if no params. + if [ -n "${env.APM_URL_BASE?.trim()}" ] ; then + echo "apm_url_base: ${env.APM_URL_BASE}" >> run-settings-jenkins.yml + fi echo "version: ${VERSION}" >> run-settings-jenkins.yml RUN_SETTINGS=jenkins make batch""") } From f2bfbef6e2d1acf979e3fab04eebcfa1d1f46c86 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 22 Oct 2020 13:05:03 +0100 Subject: [PATCH 2/6] Add debug --- .ci/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 94f5f87..44eb567 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -63,7 +63,7 @@ pipeline { unstash 'source' dir("${BASE_DIR}"){ sh(label: 'make batch', - script: """#!/bin/bash + script: """#!/bin/bash -x ## Skip BEATS if no params. if [ -n "${env.BEATS_URL_BASE?.trim()}" ] ; then echo "beats_url_base: ${env.BEATS_URL_BASE}" > run-settings-jenkins.yml @@ -80,7 +80,7 @@ pipeline { always { dir("${BASE_DIR}"){ junit(allowEmptyResults: true, keepLongStdio: true, testResults: "logs/*.xml") - archiveArtifacts(allowEmptyArchive: true, artifacts: 'logs/**') + archiveArtifacts(allowEmptyArchive: true, artifacts: 'logs/**,run-settings-jenkins.yml') sh(label: 'make clean', script: 'make clean') } } From 66361d8bebea54f3e91212c69775a0e2745d4b77 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 22 Oct 2020 13:13:44 +0100 Subject: [PATCH 3/6] fix null string --- .ci/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 44eb567..0d19d1e 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -65,11 +65,11 @@ pipeline { sh(label: 'make batch', script: """#!/bin/bash -x ## Skip BEATS if no params. - if [ -n "${env.BEATS_URL_BASE?.trim()}" ] ; then + if [[ -n "${env.BEATS_URL_BASE?.trim()}" || "${env.BEATS_URL_BASE?.trim()}" != "null" ]] ; then echo "beats_url_base: ${env.BEATS_URL_BASE}" > run-settings-jenkins.yml fi ## Skip APM if no params. - if [ -n "${env.APM_URL_BASE?.trim()}" ] ; then + if [[ -n "${env.APM_URL_BASE?.trim()}" || "${env.APM_URL_BASE?.trim()}" != "null" ]] ; then echo "apm_url_base: ${env.APM_URL_BASE}" >> run-settings-jenkins.yml fi echo "version: ${VERSION}" >> run-settings-jenkins.yml From 28238d85a9d8fbe892fdc65ec44abf5aff73474d Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 22 Oct 2020 13:20:44 +0100 Subject: [PATCH 4/6] Let's use the and --- .ci/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 0d19d1e..8827b38 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -65,11 +65,11 @@ pipeline { sh(label: 'make batch', script: """#!/bin/bash -x ## Skip BEATS if no params. - if [[ -n "${env.BEATS_URL_BASE?.trim()}" || "${env.BEATS_URL_BASE?.trim()}" != "null" ]] ; then + if [[ "${env.BEATS_URL_BASE}" != "null" && -n "${env.BEATS_URL_BASE?.trim()}" ]] ; then echo "beats_url_base: ${env.BEATS_URL_BASE}" > run-settings-jenkins.yml fi ## Skip APM if no params. - if [[ -n "${env.APM_URL_BASE?.trim()}" || "${env.APM_URL_BASE?.trim()}" != "null" ]] ; then + if [[ "${env.APM_URL_BASE}" != "null" && -n "${env.APM_URL_BASE?.trim()}" ]] ; then echo "apm_url_base: ${env.APM_URL_BASE}" >> run-settings-jenkins.yml fi echo "version: ${VERSION}" >> run-settings-jenkins.yml From 4fa1509c06c40900b3acef0a33cb4c944c287f55 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 22 Oct 2020 14:12:32 +0100 Subject: [PATCH 5/6] Skip tags if no params are passed --- .ci/Jenkinsfile | 6 +++++- packages.yml | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 8827b38..c5384cc 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -67,13 +67,17 @@ pipeline { ## Skip BEATS if no params. if [[ "${env.BEATS_URL_BASE}" != "null" && -n "${env.BEATS_URL_BASE?.trim()}" ]] ; then echo "beats_url_base: ${env.BEATS_URL_BASE}" > run-settings-jenkins.yml + else + ANSIBLE_EXTRA_FLAGS="--skip-tags beats" fi ## Skip APM if no params. if [[ "${env.APM_URL_BASE}" != "null" && -n "${env.APM_URL_BASE?.trim()}" ]] ; then echo "apm_url_base: ${env.APM_URL_BASE}" >> run-settings-jenkins.yml + else + ANSIBLE_EXTRA_FLAGS="--skip-tags apm-server" fi echo "version: ${VERSION}" >> run-settings-jenkins.yml - RUN_SETTINGS=jenkins make batch""") + ANSIBLE_EXTRA_FLAGS=\${ANSIBLE_EXTRA_FLAGS} RUN_SETTINGS=jenkins make batch""") } } post { diff --git a/packages.yml b/packages.yml index 246ae00..290cc27 100644 --- a/packages.yml +++ b/packages.yml @@ -26,6 +26,7 @@ - darwin become: yes tags: + - beats - packetbeat vars: - beat_name: packetbeat @@ -45,6 +46,7 @@ - darwin become: yes tags: + - beats - filebeat vars: - beat_name: filebeat @@ -64,6 +66,7 @@ - darwin become: yes tags: + - beats - metricbeat vars: - beat_name: metricbeat @@ -83,6 +86,7 @@ - darwin become: yes tags: + - beats - heartbeat vars: - beat_name: heartbeat @@ -103,6 +107,7 @@ - darwin become: yes tags: + - beats - auditbeat vars: - beat_name: auditbeat @@ -142,6 +147,7 @@ hosts: - windows tags: + - beats - packetbeat - windows vars: @@ -174,6 +180,7 @@ hosts: - windows tags: + - beats - packetbeat - windows vars: @@ -190,6 +197,7 @@ hosts: - windows tags: + - beats - metricbeat - windows vars: @@ -206,6 +214,7 @@ hosts: - windows tags: + - beats - metricbeat - windows vars: @@ -222,6 +231,7 @@ hosts: - windows tags: + - beats - filebeat - windows vars: @@ -238,6 +248,7 @@ hosts: - windows tags: + - beats - filebeat - windows vars: @@ -254,6 +265,7 @@ hosts: - windows tags: + - beats - heartbeat - windows vars: @@ -270,6 +282,7 @@ hosts: - windows tags: + - beats - heartbeat - windows vars: @@ -286,6 +299,7 @@ hosts: - windows tags: + - beats - winlogbeat - windows vars: @@ -302,6 +316,7 @@ hosts: - windows tags: + - beats - winlogbeat - windows vars: @@ -319,6 +334,7 @@ - windows tags: - auditbeat + - beats - windows vars: - beat_name: auditbeat @@ -339,6 +355,7 @@ - windows tags: - auditbeat + - beats - windows vars: - beat_name: auditbeat From d4c32680191581c74b69e173320a543fc0c31036 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 22 Oct 2020 15:10:01 +0100 Subject: [PATCH 6/6] Update .ci/Jenkinsfile Co-authored-by: Ivan Fernandez Calvo --- .ci/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index c5384cc..687e450 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -63,7 +63,7 @@ pipeline { unstash 'source' dir("${BASE_DIR}"){ sh(label: 'make batch', - script: """#!/bin/bash -x + script: """#!/bin/bash ## Skip BEATS if no params. if [[ "${env.BEATS_URL_BASE}" != "null" && -n "${env.BEATS_URL_BASE?.trim()}" ]] ; then echo "beats_url_base: ${env.BEATS_URL_BASE}" > run-settings-jenkins.yml