From e952270419793091cc1205946a657288067cb1f0 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 22 Aug 2022 16:18:01 +0100 Subject: [PATCH 1/6] action: checks for filebeat and x-pack/filebeat --- .github/workflows/check-filebeat.yml | 28 ++++++++++++++++++++++ .github/workflows/check-xpack-filebeat.yml | 27 +++++++++++++++++++++ .github/workflows/opentelemetry.yml | 4 +++- filebeat/Jenkinsfile.yml | 8 ------- x-pack/filebeat/Jenkinsfile.yml | 8 ------- 5 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/check-filebeat.yml create mode 100644 .github/workflows/check-xpack-filebeat.yml diff --git a/.github/workflows/check-filebeat.yml b/.github/workflows/check-filebeat.yml new file mode 100644 index 00000000000..16f0e5cff85 --- /dev/null +++ b/.github/workflows/check-filebeat.yml @@ -0,0 +1,28 @@ +name: check-filebeat + +on: + pull_request: + paths: + - '.github/workflows/check-filebeat.yml' + - 'filebeat/**' + - 'x-pack/filebeat/**' + +env: + BEAT_MODULE: 'filebeat' + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Fetch Go version from .go-version + run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - name: Run check/update + run: | + export PATH=$PATH:$(go env GOPATH)/bin + go install github.com/magefile/mage@latest + make -C ${{ env.BEAT_MODULE }} check update + make check-no-changes diff --git a/.github/workflows/check-xpack-filebeat.yml b/.github/workflows/check-xpack-filebeat.yml new file mode 100644 index 00000000000..03e543913cd --- /dev/null +++ b/.github/workflows/check-xpack-filebeat.yml @@ -0,0 +1,27 @@ +name: check-x-pack-filebeat + +on: + pull_request: + paths: + - '.github/workflows/check-xpack-filebeat.yml' + - 'x-pack/filebeat/**' + - 'filebeat/**' + +env: + BEAT_MODULE: 'x-pack/filebeat' + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Fetch Go version from .go-version + run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV + - uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + - name: Run check/update + uses: magefile/mage-action@v2 + with: + args: check update + workdir: "${{ env.BEAT_MODULE }}" diff --git a/.github/workflows/opentelemetry.yml b/.github/workflows/opentelemetry.yml index 5e48b49ff8b..3db5c2e25f2 100644 --- a/.github/workflows/opentelemetry.yml +++ b/.github/workflows/opentelemetry.yml @@ -3,8 +3,10 @@ name: OpenTelemetry Export Trace on: workflow_run: workflows: - - check-x-pack-packetbeat + - check-filebeat - check-packetbeat + - check-x-pack-filebeat + - check-x-pack-packetbeat - golangci-lint - auditbeat - filebeat diff --git a/filebeat/Jenkinsfile.yml b/filebeat/Jenkinsfile.yml index 05a91f1b435..4ba771195fe 100644 --- a/filebeat/Jenkinsfile.yml +++ b/filebeat/Jenkinsfile.yml @@ -13,14 +13,6 @@ when: tags: true ## for all the tags platform: "immutable && ubuntu-18" ## default label for all the stages stages: - checks: - make: | - make -C filebeat check; - make -C filebeat update; - make -C x-pack/filebeat check; - make -C x-pack/filebeat update; - make check-no-changes; - stage: checks arm: mage: "mage build unitTest" platforms: ## override default label in this specific stage. diff --git a/x-pack/filebeat/Jenkinsfile.yml b/x-pack/filebeat/Jenkinsfile.yml index d639c257cbb..7383bedac7d 100644 --- a/x-pack/filebeat/Jenkinsfile.yml +++ b/x-pack/filebeat/Jenkinsfile.yml @@ -13,14 +13,6 @@ when: tags: true ## for all the tags platform: "immutable && ubuntu-18" ## default label for all the stages stages: - checks: - make: | - make -C x-pack/filebeat check; - make -C x-pack/filebeat update; - make -C filebeat check; - make -C filebeat update; - make check-no-changes; - stage: checks arm: mage: "mage build unitTest" platforms: ## override default label in this specific stage. From 86bd6b58a5acfaa45878039c33558ae10a6461c3 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 22 Aug 2022 16:24:47 +0100 Subject: [PATCH 2/6] fix dependency with libsystemd-dev --- .github/workflows/check-filebeat.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check-filebeat.yml b/.github/workflows/check-filebeat.yml index 16f0e5cff85..95f251e4b58 100644 --- a/.github/workflows/check-filebeat.yml +++ b/.github/workflows/check-filebeat.yml @@ -20,6 +20,8 @@ jobs: - uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} + - name: Install libsystemd-dev + run: sudo apt-get install -y libsystemd-dev - name: Run check/update run: | export PATH=$PATH:$(go env GOPATH)/bin From 690bc973d851cb356cb0de455b927ad48d746df3 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 22 Aug 2022 16:25:16 +0100 Subject: [PATCH 3/6] fix dependency with libpcap-dev --- .github/workflows/check-xpack-filebeat.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check-xpack-filebeat.yml b/.github/workflows/check-xpack-filebeat.yml index 03e543913cd..709736aa72b 100644 --- a/.github/workflows/check-xpack-filebeat.yml +++ b/.github/workflows/check-xpack-filebeat.yml @@ -20,6 +20,8 @@ jobs: - uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} + - name: Install libpcap-dev + run: sudo apt-get install -y libpcap-dev - name: Run check/update uses: magefile/mage-action@v2 with: From 6be7b49f0eefd7a0f6f7e601d7106cddf89473f1 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 23 Aug 2022 10:16:07 +0100 Subject: [PATCH 4/6] As stated in the code review use v3 and avoid latest in favour of go.sum --- .github/workflows/check-filebeat.yml | 6 +++--- .github/workflows/check-xpack-filebeat.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-filebeat.yml b/.github/workflows/check-filebeat.yml index 95f251e4b58..fb10c5b2535 100644 --- a/.github/workflows/check-filebeat.yml +++ b/.github/workflows/check-filebeat.yml @@ -14,10 +14,10 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Fetch Go version from .go-version run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} - name: Install libsystemd-dev @@ -25,6 +25,6 @@ jobs: - name: Run check/update run: | export PATH=$PATH:$(go env GOPATH)/bin - go install github.com/magefile/mage@latest + go install github.com/magefile/mage make -C ${{ env.BEAT_MODULE }} check update make check-no-changes diff --git a/.github/workflows/check-xpack-filebeat.yml b/.github/workflows/check-xpack-filebeat.yml index 709736aa72b..f41206007a7 100644 --- a/.github/workflows/check-xpack-filebeat.yml +++ b/.github/workflows/check-xpack-filebeat.yml @@ -14,10 +14,10 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Fetch Go version from .go-version run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} - name: Install libpcap-dev From edec8619c4fedd7991c831728c39e1e047ff0b35 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 23 Aug 2022 14:46:20 +0100 Subject: [PATCH 5/6] Apply suggestions from code review --- .github/workflows/check-filebeat.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-filebeat.yml b/.github/workflows/check-filebeat.yml index fb10c5b2535..6eca3a3d97c 100644 --- a/.github/workflows/check-filebeat.yml +++ b/.github/workflows/check-filebeat.yml @@ -24,7 +24,6 @@ jobs: run: sudo apt-get install -y libsystemd-dev - name: Run check/update run: | - export PATH=$PATH:$(go env GOPATH)/bin go install github.com/magefile/mage make -C ${{ env.BEAT_MODULE }} check update make check-no-changes From c261552a89479c2656126e246ba2c1366d15d1b9 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 23 Aug 2022 14:49:51 +0100 Subject: [PATCH 6/6] Update .github/workflows/check-xpack-filebeat.yml --- .github/workflows/check-xpack-filebeat.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-xpack-filebeat.yml b/.github/workflows/check-xpack-filebeat.yml index f41206007a7..cd63315b0cd 100644 --- a/.github/workflows/check-xpack-filebeat.yml +++ b/.github/workflows/check-xpack-filebeat.yml @@ -23,7 +23,7 @@ jobs: - name: Install libpcap-dev run: sudo apt-get install -y libpcap-dev - name: Run check/update - uses: magefile/mage-action@v2 - with: - args: check update - workdir: "${{ env.BEAT_MODULE }}" + run: | + go install github.com/magefile/mage + make -C ${{ env.BEAT_MODULE }} check update + make check-no-changes