From 7211283e703400dd0d687564bd64ea6b9e015908 Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Fri, 21 Jul 2023 11:17:15 +0200 Subject: [PATCH] feat: Go cache feat: move windows WF feat: move packaging --- .github/workflows/check-audtibeat.yml | 1 + .github/workflows/check-default.yml | 1 + .github/workflows/check-dev-tools.yml | 1 + .github/workflows/check-docs.yml | 1 + .github/workflows/check-filebeat.yml | 1 + .github/workflows/check-heartbeat.yml | 1 + .github/workflows/check-libbeat.yml | 1 + .github/workflows/check-metricbeat.yml | 71 +++++++++++++++++++ .github/workflows/check-packetbeat.yml | 1 + .github/workflows/check-winlogbeat.yml | 1 + .github/workflows/check-xpack-auditbeat.yml | 1 + .../workflows/check-xpack-dockerlogbeat.yml | 1 + .github/workflows/check-xpack-filebeat.yml | 1 + .../workflows/check-xpack-functionbeat.yml | 1 + .github/workflows/check-xpack-heartbeat.yml | 1 + .github/workflows/check-xpack-libbeat.yml | 1 + .github/workflows/check-xpack-metricbeat.yml | 1 + .github/workflows/check-xpack-osquerybeat.yml | 1 + .github/workflows/check-xpack-packetbeat.yml | 1 + .github/workflows/check-xpack-winlogbeat.yml | 1 + .github/workflows/golangci-lint.yml | 1 + .github/workflows/macos-auditbeat.yml | 1 + .github/workflows/macos-filebeat.yml | 1 + .github/workflows/macos-heartbeat.yml | 1 + .github/workflows/macos-metricbeat.yml | 3 +- .github/workflows/macos-packetbeat.yml | 1 + .github/workflows/macos-xpack-auditbeat.yml | 1 + .github/workflows/macos-xpack-filebeat.yml | 1 + .../workflows/macos-xpack-functionbeat.yml | 1 + .github/workflows/macos-xpack-heartbeat.yml | 1 + .github/workflows/macos-xpack-metricbeat.yml | 1 + .github/workflows/macos-xpack-osquerybeat.yml | 1 + .github/workflows/macos-xpack-packetbeat.yml | 1 + metricbeat/Jenkinsfile.yml | 21 ------ 34 files changed, 104 insertions(+), 22 deletions(-) diff --git a/.github/workflows/check-audtibeat.yml b/.github/workflows/check-audtibeat.yml index 91bd31120bd..1d46c5c34a4 100644 --- a/.github/workflows/check-audtibeat.yml +++ b/.github/workflows/check-audtibeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-default.yml b/.github/workflows/check-default.yml index 35bab720e65..378b5e4b5df 100644 --- a/.github/workflows/check-default.yml +++ b/.github/workflows/check-default.yml @@ -25,6 +25,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check-default run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-dev-tools.yml b/.github/workflows/check-dev-tools.yml index beb9529aebe..9dddb2b7934 100644 --- a/.github/workflows/check-dev-tools.yml +++ b/.github/workflows/check-dev-tools.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml index f9f9ac021d3..aea6606bae7 100644 --- a/.github/workflows/check-docs.yml +++ b/.github/workflows/check-docs.yml @@ -25,6 +25,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Update package lists run: sudo apt-get update - name: Install libpcap-dev diff --git a/.github/workflows/check-filebeat.yml b/.github/workflows/check-filebeat.yml index 77490f5d3b6..7efed65545a 100644 --- a/.github/workflows/check-filebeat.yml +++ b/.github/workflows/check-filebeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Update package lists run: sudo apt-get update - name: Install libsystemd-dev diff --git a/.github/workflows/check-heartbeat.yml b/.github/workflows/check-heartbeat.yml index ae0c67b0d4e..cd11b87135c 100644 --- a/.github/workflows/check-heartbeat.yml +++ b/.github/workflows/check-heartbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-libbeat.yml b/.github/workflows/check-libbeat.yml index 777d6c8719c..e1c916df813 100644 --- a/.github/workflows/check-libbeat.yml +++ b/.github/workflows/check-libbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Update package lists run: sudo apt-get update - name: Install libpcap-dev diff --git a/.github/workflows/check-metricbeat.yml b/.github/workflows/check-metricbeat.yml index ba1c8176af3..44a7035667f 100644 --- a/.github/workflows/check-metricbeat.yml +++ b/.github/workflows/check-metricbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage @@ -41,6 +42,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: unitTest working-directory: ${{ env.BEAT_MODULE }} run: | @@ -49,6 +51,7 @@ jobs: goIntegTest: runs-on: ubuntu-latest + needs: unitTest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -59,6 +62,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: goIntegTest working-directory: ${{ env.BEAT_MODULE }} run: | @@ -67,6 +71,7 @@ jobs: pythonIntegTest: runs-on: ubuntu-latest + needs: unitTest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -77,6 +82,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: pythonIntegTest working-directory: ${{ env.BEAT_MODULE }} run: | @@ -85,6 +91,7 @@ jobs: crosscompile: runs-on: ubuntu-latest + needs: unitTest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 @@ -95,8 +102,72 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: crosscompile working-directory: ${{ env.BEAT_MODULE }} run: | go install github.com/magefile/mage make crosscompile + + windows-2022: + runs-on: windows-2022 + needs: unitTest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version-file: '.python-version' + cache: 'pip' + cache-dependency-path: ./libbeat/tests/system/requirements.txt + - uses: actions/setup-go@v3 + with: + go-version-file: .go-version + cache-dependency-path: ./go.sum + - name: windows-2022 + working-directory: ${{ env.BEAT_MODULE }} + run: | + go install github.com/magefile/mage + mage build unitTest + + windows-2019: + runs-on: windows-2019 + needs: unitTest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version-file: '.python-version' + cache: 'pip' + cache-dependency-path: ./libbeat/tests/system/requirements.txt + - uses: actions/setup-go@v3 + with: + go-version-file: .go-version + cache-dependency-path: ./go.sum + - name: windows-2019 + working-directory: ${{ env.BEAT_MODULE }} + run: | + go install github.com/magefile/mage + mage build unitTest + + packaging-linux: + # TODO upload packages to GCS Bucket + runs-on: ubuntu-latest + needs: unitTest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version-file: '.python-version' + cache: 'pip' + cache-dependency-path: ./libbeat/tests/system/requirements.txt + - uses: actions/setup-go@v3 + with: + go-version-file: .go-version + cache-dependency-path: ./go.sum + - name: packaging-linux + working-directory: ${{ env.BEAT_MODULE }} + run: | + go install github.com/magefile/mage + make package + env: + PLATFORMS: "+all linux/arm64 linux/amd64 windows/amd64 darwin/amd64 darwin/arm64" diff --git a/.github/workflows/check-packetbeat.yml b/.github/workflows/check-packetbeat.yml index 995f435071c..3e56fcc7a76 100644 --- a/.github/workflows/check-packetbeat.yml +++ b/.github/workflows/check-packetbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Update package lists run: sudo apt-get update - name: Install libpcap-dev diff --git a/.github/workflows/check-winlogbeat.yml b/.github/workflows/check-winlogbeat.yml index ee3bfe5ede4..a52bd2ff7c1 100644 --- a/.github/workflows/check-winlogbeat.yml +++ b/.github/workflows/check-winlogbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-xpack-auditbeat.yml b/.github/workflows/check-xpack-auditbeat.yml index ed048e28fdb..747a0f223a7 100644 --- a/.github/workflows/check-xpack-auditbeat.yml +++ b/.github/workflows/check-xpack-auditbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Update package lists run: sudo apt-get update - name: Install librpm-dev diff --git a/.github/workflows/check-xpack-dockerlogbeat.yml b/.github/workflows/check-xpack-dockerlogbeat.yml index fe75bc1f6f1..a2d161a8fe4 100644 --- a/.github/workflows/check-xpack-dockerlogbeat.yml +++ b/.github/workflows/check-xpack-dockerlogbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-xpack-filebeat.yml b/.github/workflows/check-xpack-filebeat.yml index 775a2c31949..0718fd7d605 100644 --- a/.github/workflows/check-xpack-filebeat.yml +++ b/.github/workflows/check-xpack-filebeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Update package lists run: sudo apt-get update - name: Install libpcap-dev diff --git a/.github/workflows/check-xpack-functionbeat.yml b/.github/workflows/check-xpack-functionbeat.yml index 5fb32d637a9..54773c57d64 100644 --- a/.github/workflows/check-xpack-functionbeat.yml +++ b/.github/workflows/check-xpack-functionbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-xpack-heartbeat.yml b/.github/workflows/check-xpack-heartbeat.yml index a3e56f3056f..259311c4c92 100644 --- a/.github/workflows/check-xpack-heartbeat.yml +++ b/.github/workflows/check-xpack-heartbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-xpack-libbeat.yml b/.github/workflows/check-xpack-libbeat.yml index cb7a8ac68c5..31cad6eff8f 100644 --- a/.github/workflows/check-xpack-libbeat.yml +++ b/.github/workflows/check-xpack-libbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-xpack-metricbeat.yml b/.github/workflows/check-xpack-metricbeat.yml index 22e64faa33a..632518dab26 100644 --- a/.github/workflows/check-xpack-metricbeat.yml +++ b/.github/workflows/check-xpack-metricbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-xpack-osquerybeat.yml b/.github/workflows/check-xpack-osquerybeat.yml index b4145ace516..6013f7fe149 100644 --- a/.github/workflows/check-xpack-osquerybeat.yml +++ b/.github/workflows/check-xpack-osquerybeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update run: | go install github.com/magefile/mage diff --git a/.github/workflows/check-xpack-packetbeat.yml b/.github/workflows/check-xpack-packetbeat.yml index 1bf6afcdd1b..a3208becb47 100644 --- a/.github/workflows/check-xpack-packetbeat.yml +++ b/.github/workflows/check-xpack-packetbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Update package lists run: sudo apt-get update - name: Install libpcap-dev diff --git a/.github/workflows/check-xpack-winlogbeat.yml b/.github/workflows/check-xpack-winlogbeat.yml index 34a83a4c474..a52016504b0 100644 --- a/.github/workflows/check-xpack-winlogbeat.yml +++ b/.github/workflows/check-xpack-winlogbeat.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: Run check/update uses: magefile/mage-action@v2 with: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index c8e871ce772..166325b8797 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -31,6 +31,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - name: golangci-lint env: diff --git a/.github/workflows/macos-auditbeat.yml b/.github/workflows/macos-auditbeat.yml index 4bc0bc92018..25f5f3d2165 100644 --- a/.github/workflows/macos-auditbeat.yml +++ b/.github/workflows/macos-auditbeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-filebeat.yml b/.github/workflows/macos-filebeat.yml index 2ad44c0aa22..e787c9c4c26 100644 --- a/.github/workflows/macos-filebeat.yml +++ b/.github/workflows/macos-filebeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-heartbeat.yml b/.github/workflows/macos-heartbeat.yml index 9bcd8aaebd6..9504f3a28b9 100644 --- a/.github/workflows/macos-heartbeat.yml +++ b/.github/workflows/macos-heartbeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-metricbeat.yml b/.github/workflows/macos-metricbeat.yml index a163f79e326..b98d041f991 100644 --- a/.github/workflows/macos-metricbeat.yml +++ b/.github/workflows/macos-metricbeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' @@ -31,7 +32,7 @@ jobs: - name: Run build run: cd ${{ env.BEAT_MODULE }} && mage build - name: Run test - run: cd ${{ env.BEAT_MODULE }} && echo "See https://github.com/elastic/beats/issues/29038" + run: cd ${{ env.BEAT_MODULE }} && mage unitTest - uses: v1v/otel-upload-test-artifact-action@v2 if: always() continue-on-error: true diff --git a/.github/workflows/macos-packetbeat.yml b/.github/workflows/macos-packetbeat.yml index 0d3d1e242fb..8c162a1d09d 100644 --- a/.github/workflows/macos-packetbeat.yml +++ b/.github/workflows/macos-packetbeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-xpack-auditbeat.yml b/.github/workflows/macos-xpack-auditbeat.yml index 8f9620c31bb..baeab5f8af7 100644 --- a/.github/workflows/macos-xpack-auditbeat.yml +++ b/.github/workflows/macos-xpack-auditbeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-xpack-filebeat.yml b/.github/workflows/macos-xpack-filebeat.yml index 5f34e55ceef..402c9b37e5a 100644 --- a/.github/workflows/macos-xpack-filebeat.yml +++ b/.github/workflows/macos-xpack-filebeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-xpack-functionbeat.yml b/.github/workflows/macos-xpack-functionbeat.yml index 51a34b55ca9..eeeb83b605f 100644 --- a/.github/workflows/macos-xpack-functionbeat.yml +++ b/.github/workflows/macos-xpack-functionbeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-xpack-heartbeat.yml b/.github/workflows/macos-xpack-heartbeat.yml index a5531d59452..0dfa3272944 100644 --- a/.github/workflows/macos-xpack-heartbeat.yml +++ b/.github/workflows/macos-xpack-heartbeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-xpack-metricbeat.yml b/.github/workflows/macos-xpack-metricbeat.yml index 97f8a4f392f..5c7b3cd5f87 100644 --- a/.github/workflows/macos-xpack-metricbeat.yml +++ b/.github/workflows/macos-xpack-metricbeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-xpack-osquerybeat.yml b/.github/workflows/macos-xpack-osquerybeat.yml index 4bd328381fa..73f4524d020 100644 --- a/.github/workflows/macos-xpack-osquerybeat.yml +++ b/.github/workflows/macos-xpack-osquerybeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/.github/workflows/macos-xpack-packetbeat.yml b/.github/workflows/macos-xpack-packetbeat.yml index f2e2c76f58c..00235059059 100644 --- a/.github/workflows/macos-xpack-packetbeat.yml +++ b/.github/workflows/macos-xpack-packetbeat.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@v3 with: go-version-file: .go-version + cache-dependency-path: ./go.sum - uses: actions/setup-python@v4 with: python-version-file: '.python-version' diff --git a/metricbeat/Jenkinsfile.yml b/metricbeat/Jenkinsfile.yml index 0abfc561b36..a338f182cfe 100644 --- a/metricbeat/Jenkinsfile.yml +++ b/metricbeat/Jenkinsfile.yml @@ -40,16 +40,6 @@ stages: # - "macosM1Test" # tags: false ## for all the tags # stage: extended - windows-2022: - mage: "mage build unitTest" - platforms: ## override default labels in this specific stage. - - "windows-2022" - stage: mandatory - windows-2019: - mage: "mage build unitTest" - platforms: ## override default labels in this specific stage. - - "windows-2019" - stage: extended_win windows-2016: mage: "mage build unitTest" platforms: ## override default labels in this specific stage. @@ -75,17 +65,6 @@ stages: platforms: ## override default labels in this specific stage. - "windows-8" stage: extended_win - packaging-linux: - packaging-linux: "mage package" - e2e: - enabled: false ## e2e is enabled only for x-pack beats - stage: packaging - when: - branches: false ## Only on a PR basis for the time being - tags: false ## packaging on branches/tags is already in place with the downstream build. - changeset: ## when PR contains any of those entries in the changeset - - "^metricbeat/.*" - - "@oss" ## special token regarding the changeset for the oss packaging-arm: packaging-arm: "mage package" e2e: