From b1a9570e5e0443daac58ab877e8881947ba2c983 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 16 Aug 2022 17:40:43 +0100 Subject: [PATCH 1/6] actions: run check for x-pack/packetbeat and packebeat --- .github/workflows/check-packetbeat.yml | 26 ++++++++++++++++++++ .github/workflows/check-xpack-packetbeat.yml | 25 +++++++++++++++++++ .github/workflows/opentelemetry.yml | 2 ++ packetbeat/Jenkinsfile.yml | 9 ------- x-pack/packetbeat/Jenkinsfile.yml | 9 ------- 5 files changed, 53 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/check-packetbeat.yml create mode 100644 .github/workflows/check-xpack-packetbeat.yml diff --git a/.github/workflows/check-packetbeat.yml b/.github/workflows/check-packetbeat.yml new file mode 100644 index 000000000000..6df1af0caeee --- /dev/null +++ b/.github/workflows/check-packetbeat.yml @@ -0,0 +1,26 @@ +name: check-packetbeat + +on: + pull_request: + paths: + - '.github/workflows/check-packetbeat.yml' + - 'packetbeat/**' + - 'x-pack/packetbeat/**' + +env: + BEAT_MODULE: 'packetbeat' + +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: Install dependencies + run: go get -u github.com/magefile/mage + - name: Run check/update + run: make -C ${{ env.BEAT_MODULE }} check update; make check-no-changes diff --git a/.github/workflows/check-xpack-packetbeat.yml b/.github/workflows/check-xpack-packetbeat.yml new file mode 100644 index 000000000000..4a420cee0c60 --- /dev/null +++ b/.github/workflows/check-xpack-packetbeat.yml @@ -0,0 +1,25 @@ +name: check-x-pack-packetbeat + +on: + pull_request: + paths: + - '.github/workflows/check-xpack-packetbeat.yml' + - 'x-pack/packetbeat/**' + +env: + BEAT_MODULE: 'x-pack/packetbeat' + +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: Install dependencies + run: go get -u github.com/magefile/mage + - name: Run check/update + run: cd ${{ env.BEAT_MODULE }}; mage check; mage update diff --git a/.github/workflows/opentelemetry.yml b/.github/workflows/opentelemetry.yml index d7e54e0a632b..1c1e6596fc85 100644 --- a/.github/workflows/opentelemetry.yml +++ b/.github/workflows/opentelemetry.yml @@ -3,6 +3,8 @@ name: OpenTelemetry Export Trace on: workflow_run: workflows: + - check-x-pack-packetbeat + - check-packetbeat - golangci-lint - auditbeat - filebeat diff --git a/packetbeat/Jenkinsfile.yml b/packetbeat/Jenkinsfile.yml index b6786c52375c..f277db08f3c7 100644 --- a/packetbeat/Jenkinsfile.yml +++ b/packetbeat/Jenkinsfile.yml @@ -13,15 +13,6 @@ when: tags: true ## for all the tags platform: "immutable && ubuntu-18" ## default label for all the stages stages: - checks: - make: | - make -C packetbeat check; - make -C packetbeat update; - make check-no-changes; - cd x-pack/packetbeat; - mage check; - mage update; - stage: checks arm: mage: "mage build unitTest" platforms: ## override default label in this specific stage. diff --git a/x-pack/packetbeat/Jenkinsfile.yml b/x-pack/packetbeat/Jenkinsfile.yml index 61ff7059c61f..466ab053e654 100644 --- a/x-pack/packetbeat/Jenkinsfile.yml +++ b/x-pack/packetbeat/Jenkinsfile.yml @@ -13,15 +13,6 @@ when: tags: true ## for all the tags platform: "immutable && ubuntu-18" ## default label for all the stages stages: - checks: - mage: | - mage check; - mage update; - make: | - make -C packetbeat check; - make -C packetbeat update; - make check-no-changes; - stage: checks arm: mage: "mage build unitTest" platforms: ## override default label in this specific stage. From d3ac5bef9f4f8afed14db0b68789064100c9aeee Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 16 Aug 2022 17:42:50 +0100 Subject: [PATCH 2/6] add path filter --- .github/workflows/check-xpack-packetbeat.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-xpack-packetbeat.yml b/.github/workflows/check-xpack-packetbeat.yml index 4a420cee0c60..0fcf051cd58f 100644 --- a/.github/workflows/check-xpack-packetbeat.yml +++ b/.github/workflows/check-xpack-packetbeat.yml @@ -5,6 +5,7 @@ on: paths: - '.github/workflows/check-xpack-packetbeat.yml' - 'x-pack/packetbeat/**' + - 'packetbeat/**' env: BEAT_MODULE: 'x-pack/packetbeat' From f0671bc796d9633ce2ce05f9c616f268b70bb12e Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 16 Aug 2022 17:46:50 +0100 Subject: [PATCH 3/6] use mage action --- .github/workflows/check-packetbeat.yml | 6 +++--- .github/workflows/check-xpack-packetbeat.yml | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-packetbeat.yml b/.github/workflows/check-packetbeat.yml index 6df1af0caeee..9c64d628caa4 100644 --- a/.github/workflows/check-packetbeat.yml +++ b/.github/workflows/check-packetbeat.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} - - name: Install dependencies - run: go get -u github.com/magefile/mage - name: Run check/update - run: make -C ${{ env.BEAT_MODULE }} check update; make check-no-changes + run: | + make -C ${{ env.BEAT_MODULE }} check update + make check-no-changes diff --git a/.github/workflows/check-xpack-packetbeat.yml b/.github/workflows/check-xpack-packetbeat.yml index 0fcf051cd58f..d4a539c34bd5 100644 --- a/.github/workflows/check-xpack-packetbeat.yml +++ b/.github/workflows/check-xpack-packetbeat.yml @@ -20,7 +20,8 @@ jobs: - uses: actions/setup-go@v2 with: go-version: ${{ env.GO_VERSION }} - - name: Install dependencies - run: go get -u github.com/magefile/mage - name: Run check/update - run: cd ${{ env.BEAT_MODULE }}; mage check; mage update + uses: magefile/mage-action@v2 + with: + args: check update + workdir: "${{ env.BEAT_MODULE }}" From bd925b1634015af6a55093c5dc9cb267a55683ba Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 16 Aug 2022 17:50:53 +0100 Subject: [PATCH 4/6] action: install dependency --- .github/workflows/check-packetbeat.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-packetbeat.yml b/.github/workflows/check-packetbeat.yml index 9c64d628caa4..500ea7692e62 100644 --- a/.github/workflows/check-packetbeat.yml +++ b/.github/workflows/check-packetbeat.yml @@ -22,5 +22,6 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: Run check/update run: | + go get -u github.com/magefile/mage make -C ${{ env.BEAT_MODULE }} check update make check-no-changes From 51305cc910e789123bed5567ddb7733a0f3651d2 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Aug 2022 10:05:26 +0100 Subject: [PATCH 5/6] action: fix location mage --- .github/workflows/check-packetbeat.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-packetbeat.yml b/.github/workflows/check-packetbeat.yml index 500ea7692e62..14383ce4a9ce 100644 --- a/.github/workflows/check-packetbeat.yml +++ b/.github/workflows/check-packetbeat.yml @@ -22,6 +22,7 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: Run check/update run: | - go get -u github.com/magefile/mage + 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 From a3159072cf3ae39ca48b8ed51c01a101b885a987 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 17 Aug 2022 10:15:24 +0100 Subject: [PATCH 6/6] action: install libpcap-dev dep --- .github/workflows/check-packetbeat.yml | 2 ++ .github/workflows/check-xpack-packetbeat.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/check-packetbeat.yml b/.github/workflows/check-packetbeat.yml index 14383ce4a9ce..937e5f7cf26a 100644 --- a/.github/workflows/check-packetbeat.yml +++ b/.github/workflows/check-packetbeat.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 run: | export PATH=$PATH:$(go env GOPATH)/bin diff --git a/.github/workflows/check-xpack-packetbeat.yml b/.github/workflows/check-xpack-packetbeat.yml index d4a539c34bd5..87ab877fc0db 100644 --- a/.github/workflows/check-xpack-packetbeat.yml +++ b/.github/workflows/check-xpack-packetbeat.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: