Skip to content

Commit

Permalink
merge from master for 1.6.4 (#3337)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc authored Nov 20, 2024
1 parent 188f580 commit 523164f
Show file tree
Hide file tree
Showing 366 changed files with 11,596 additions and 6,794 deletions.
11 changes: 0 additions & 11 deletions .github/codecov-ignore-generated.sh

This file was deleted.

27 changes: 26 additions & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# we measure coverage but don't enforce it
# https://docs.codecov.com/docs/codecov-yaml
codecov:
require_ci_to_pass: false

coverage:
status:
patch:
Expand All @@ -10,7 +13,7 @@ coverage:
target: 0%

# if a directory is ignored, there is no way to un-ignore files like pkg/models/helpers.go
# so we make a full list, manually updated - but it could be generated right before running codecov
# so we make a full list
ignore:
- "./pkg/modelscapi/success_response.go"
- "./pkg/modelscapi/get_decisions_stream_response_deleted.go"
Expand Down Expand Up @@ -41,17 +44,26 @@ ignore:
- "./pkg/modelscapi/enroll_request.go"
- "./pkg/modelscapi/register_request.go"
- "./pkg/modelscapi/add_signals_request_item_source.go"
- "./pkg/models/success_response.go"
- "./pkg/models/hub_items.go"
- "./pkg/models/alert.go"
- "./pkg/models/metrics_bouncer_info.go"
- "./pkg/models/add_signals_request_item.go"
- "./pkg/models/metrics_meta.go"
- "./pkg/models/metrics_detail_item.go"
- "./pkg/models/add_signals_request_item_decisions_item.go"
- "./pkg/models/hub_item.go"
- "./pkg/models/get_alerts_response.go"
- "./pkg/models/metrics_labels.go"
- "./pkg/models/watcher_auth_request.go"
- "./pkg/models/add_alerts_request.go"
- "./pkg/models/event.go"
- "./pkg/models/decisions_delete_request_item.go"
- "./pkg/models/meta.go"
- "./pkg/models/detailed_metrics.go"
- "./pkg/models/delete_alerts_response.go"
- "./pkg/models/remediation_components_metrics.go"
- "./pkg/models/console_options.go"
- "./pkg/models/topx_response.go"
- "./pkg/models/add_signals_request.go"
- "./pkg/models/delete_decision_response.go"
Expand All @@ -60,24 +72,34 @@ ignore:
- "./pkg/models/source.go"
- "./pkg/models/decisions_stream_response.go"
- "./pkg/models/error_response.go"
- "./pkg/models/all_metrics.go"
- "./pkg/models/o_sversion.go"
- "./pkg/models/decision.go"
- "./pkg/models/decisions_delete_request.go"
- "./pkg/models/flush_decision_response.go"
- "./pkg/models/watcher_auth_response.go"
- "./pkg/models/lapi_metrics.go"
- "./pkg/models/watcher_registration_request.go"
- "./pkg/models/metrics_agent_info.go"
- "./pkg/models/log_processors_metrics.go"
- "./pkg/models/add_signals_request_item_source.go"
- "./pkg/models/base_metrics.go"
- "./pkg/models/add_alerts_response.go"
- "./pkg/models/metrics.go"
- "./pkg/protobufs/notifier.pb.go"
- "./pkg/protobufs/notifier_grpc.pb.go"
- "./pkg/database/ent/metric_update.go"
- "./pkg/database/ent/machine_delete.go"
- "./pkg/database/ent/decision_query.go"
- "./pkg/database/ent/meta_query.go"
- "./pkg/database/ent/metric/where.go"
- "./pkg/database/ent/metric/metric.go"
- "./pkg/database/ent/machine_create.go"
- "./pkg/database/ent/alert.go"
- "./pkg/database/ent/event_update.go"
- "./pkg/database/ent/alert_create.go"
- "./pkg/database/ent/alert_query.go"
- "./pkg/database/ent/metric_delete.go"
- "./pkg/database/ent/lock_create.go"
- "./pkg/database/ent/bouncer_update.go"
- "./pkg/database/ent/meta_update.go"
Expand All @@ -92,6 +114,7 @@ ignore:
- "./pkg/database/ent/migrate/migrate.go"
- "./pkg/database/ent/migrate/schema.go"
- "./pkg/database/ent/configitem.go"
- "./pkg/database/ent/metric_query.go"
- "./pkg/database/ent/event.go"
- "./pkg/database/ent/event_query.go"
- "./pkg/database/ent/lock_update.go"
Expand All @@ -111,6 +134,7 @@ ignore:
- "./pkg/database/ent/bouncer/bouncer.go"
- "./pkg/database/ent/bouncer/where.go"
- "./pkg/database/ent/hook/hook.go"
- "./pkg/database/ent/metric.go"
- "./pkg/database/ent/configitem_create.go"
- "./pkg/database/ent/configitem_delete.go"
- "./pkg/database/ent/tx.go"
Expand All @@ -120,6 +144,7 @@ ignore:
- "./pkg/database/ent/machine/where.go"
- "./pkg/database/ent/machine/machine.go"
- "./pkg/database/ent/event_create.go"
- "./pkg/database/ent/metric_create.go"
- "./pkg/database/ent/decision/where.go"
- "./pkg/database/ent/decision/decision.go"
- "./pkg/database/ent/enttest/enttest.go"
Expand Down
31 changes: 31 additions & 0 deletions .github/generate-codecov-yml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Run this from the repository root:
#
# .github/generate-codecov-yml.sh >> .github/codecov.yml

cat <<EOT
# we measure coverage but don't enforce it
# https://docs.codecov.com/docs/codecov-yaml
codecov:
require_ci_to_pass: false
coverage:
status:
patch:
default:
target: 0%
project:
default:
target: 0%
# if a directory is ignored, there is no way to un-ignore files like pkg/models/helpers.go
# so we make a full list
ignore:
EOT

find . -name "*.go" | while read -r file; do
if head -n 1 "$file" | grep -q "Code generated by"; then
echo " - \"$file\""
fi
done
2 changes: 1 addition & 1 deletion .github/workflows/bats-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v5
with:
go-version: "1.22.6"
go-version: "1.23"

- name: "Install bats dependencies"
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bats-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v5
with:
go-version: "1.22.6"
go-version: "1.23"

- name: "Install bats dependencies"
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bats-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v5
with:
go-version: "1.22.6"
go-version: "1.23"

- name: "Install bats dependencies"
env:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/bats-sqlite-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v5
with:
go-version: "1.22.6"
go-version: "1.23"

- name: "Install bats dependencies"
env:
Expand All @@ -43,6 +43,10 @@ jobs:
run: |
make clean bats-build bats-fixture BUILD_STATIC=1
- name: Generate codecov configuration
run: |
.github/generate-codecov-yml.sh >> .github/codecov.yml
- name: "Run tests"
run: ./test/run-tests ./test/bats --formatter $(pwd)/test/lib/color-formatter

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows-build-msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v5
with:
go-version: "1.22.6"
go-version: "1.23"

- name: Build
run: make windows_installer BUILD_RE2_WASM=1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v5
with:
go-version: "1.22.6"
go-version: "1.23"
cache-dependency-path: "**/go.sum"

# Initializes the CodeQL tools for scanning.
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/docker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,12 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: "Install pipenv"
run: |
cd docker/test
python -m pip install --upgrade pipenv wheel
- name: "Cache virtualenvs"
id: cache-pipenv
uses: actions/cache@v4
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
cache: 'pipenv'

- name: "Install dependencies"
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
cd docker/test
python -m pip install --upgrade pipenv wheel
pipenv install --deploy
- name: "Create Docker network"
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/go-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v5
with:
go-version: "1.22.6"
go-version: "1.23"

- name: Build
run: |
make build BUILD_RE2_WASM=1
- name: Generate codecov configuration
run: |
.github/generate-codecov-yml.sh >> .github/codecov.yml
- name: Run tests
run: |
go install github.com/kyoh86/richgo@v0.3.10
Expand All @@ -57,6 +61,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
version: v1.61
args: --issues-exit-code=1 --timeout 10m
only-new-issues: false
36 changes: 34 additions & 2 deletions .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,40 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v5
with:
go-version: "1.22.6"
go-version: "1.23"

- name: Run "go generate" and check for changes
run: |
set -e
# ensure the version of 'protoc' matches the one that generated the files
PROTOBUF_VERSION="21.12"
# don't pollute the repo
pushd $HOME
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip
unzip protoc-${PROTOBUF_VERSION}-linux-x86_64.zip -d $HOME/.protoc
popd
export PATH="$HOME/.protoc/bin:$PATH"
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
go generate ./...
protoc --version
if [[ $(git status --porcelain) ]]; then
echo "Error: Uncommitted changes found after running 'make generate'. Please commit all generated code."
git diff
exit 1
else
echo "No changes detected after running 'make generate'."
fi
- name: Create localstack streams
run: |
aws --endpoint-url=http://127.0.0.1:4566 --region us-east-1 kinesis create-stream --stream-name stream-1-shard --shard-count 1
aws --endpoint-url=http://127.0.0.1:4566 --region us-east-1 kinesis create-stream --stream-name stream-2-shards --shard-count 2
- name: Generate codecov configuration
run: |
.github/generate-codecov-yml.sh >> .github/codecov.yml
- name: Build and run tests, static
run: |
sudo apt -qq -y -o=Dpkg::Use-Pty=0 install build-essential libre2-dev
Expand All @@ -142,6 +169,11 @@ jobs:
make build BUILD_STATIC=1
make go-acc | sed 's/ *coverage:.*of statements in.*//' | richgo testfilter
# check if some component stubs are missing
- name: "Build profile: minimal"
run: |
make build BUILD_PROFILE=minimal
- name: Run tests again, dynamic
run: |
make clean build
Expand All @@ -158,6 +190,6 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
version: v1.61
args: --issues-exit-code=1 --timeout 10m
only-new-issues: false
2 changes: 1 addition & 1 deletion .github/workflows/publish-tarball-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: "Set up Go"
uses: actions/setup-go@v5
with:
go-version: "1.22.6"
go-version: "1.23"

- name: Build the binaries
run: |
Expand Down
Loading

0 comments on commit 523164f

Please sign in to comment.