Skip to content

Commit

Permalink
Merge branch 'main' into log-4550-aws
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoBraveCoding committed Nov 21, 2023
2 parents e56384b + 658f4f1 commit 3e578cb
Show file tree
Hide file tree
Showing 146 changed files with 6,725 additions and 4,687 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/nix-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,30 @@ on:
- "flake.nix"
- "nix/**"
jobs:
tests:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix run .#lint
- run: nix build --print-build-logs
- run: nix run --print-build-logs .#lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix run --print-build-logs .#test
packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix build --print-build-logs .#logcli
- run: nix build --print-build-logs .#loki
- run: nix build --print-build-logs .#loki-canary
- run: nix build --print-build-logs .#promtail
47 changes: 47 additions & 0 deletions .github/workflows/snyk-pr-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: PR Vulnerability Scan
on: pull_request

permissions:
pull-requests: write
issues: write

jobs:
snyk:
name: Snyk Scan
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }}
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/golang@master
continue-on-error: true # To make sure that PR comment is made
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: test
args: --severity-threshold=high --json-file-output=snyk.json

- name: Prepare Snyk message
run: |
echo "Snyk scan found the following vulnerabilities:" > snyk.txt
- name: Format Snyk Message
uses: sergeysova/jq-action@v2
continue-on-error: true
with:
cmd: jq -r '.vulnerabilities[] | "* **\(.severity)** - [\(.identifiers.CVE[0])] \(.title) in `\(.moduleName)` v\(.version). Fixed in \(.fixedIn)"' snyk.json >> snyk.txt

- name: Determine whether to comment
continue-on-error: true
id: should-comment
run: |
if [[ $(wc -l < snyk.txt) -gt 1 ]]; then exit 0; fi
exit 1
- name: Comment on PR with Snyk scan results
uses: mshick/add-pr-comment@v2
if: ${{ steps.should-comment.outcome == 'success' }}
with:
message-id: snyk-${{ github.event.number }}
message-path: snyk.txt
Original file line number Diff line number Diff line change
@@ -1,58 +1,14 @@
name: PR Vulnerability Scan
on: pull_request
on: pull_request_target

permissions:
pull-requests: write
contents: write
issues: write

jobs:
snyk:
name: Snyk Scan
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/golang@master
continue-on-error: true # To make sure that PR comment is made
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: test
args: --severity-threshold=high --json-file-output=snyk.json

- name: Prepare Snyk message
run: |
echo "Snyk scan found the following vulnerabilities:" > snyk.txt
- name: Format Snyk Message
uses: sergeysova/jq-action@v2
continue-on-error: true
with:
cmd: jq -r '.vulnerabilities[] | "* **\(.severity)** - [\(.identifiers.CVE[0])] \(.title) in `\(.moduleName)` v\(.version). Fixed in \(.fixedIn)"' snyk.json >> snyk.txt

- name: Determine whether to comment
continue-on-error: true
id: should-comment
run: |
if [[ $(wc -l < snyk.txt) -gt 1 ]]; then exit 0; fi
exit 1
- name: Comment on PR with Snyk scan results
uses: mshick/add-pr-comment@v2
if: ${{ steps.should-comment.outcome == 'success' }}
with:
message-id: snyk-${{ github.event.number }}
message-path: snyk.txt
trivy:
name: Trivy Scan
runs-on: ubuntu-20.04
permissions:
issues: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ linters-settings:
- desc: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log"
pkg: github.com/go-kit/kit/log

misspell:
ignore-words:
- strat

linters:
enable:
- errcheck
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

##### Enhancements

* [11243](https://github.com/grafana/loki/pull/11243) **kavirajk**: Inflight-logging: Add extra metadata to inflight requests logging.
* [11110](https://github.com/grafana/loki/pull/11003) **MichelHollands**: Change the default of the `metrics-namespace` flag to 'loki'.
* [11086](https://github.com/grafana/loki/pull/11086) **kandrew5**: Helm: Allow topologySpreadConstraints
* [11003](https://github.com/grafana/loki/pull/11003) **MichelHollands**: Add the `metrics-namespace` flag to change the namespace of metrics currently using cortex as namespace.
Expand Down Expand Up @@ -39,6 +40,7 @@

##### Fixes
* [11074](https://github.com/grafana/loki/pull/11074) **hainenber** Fix panic in lambda-promtail due to mishandling of empty DROP_LABELS env var.
* [11195](https://github.com/grafana/loki/pull/11195) **canuteson** Generate tsdb_shipper storage_config even if using_boltdb_shipper is false

##### Changes

Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ BUILD_IMAGE_VERSION ?= 0.31.2
# Docker image info
IMAGE_PREFIX ?= grafana

BUILD_IMAGE_PREFIX ?= grafana

IMAGE_TAG ?= $(shell ./tools/image-tag)

# Version info for binaries
Expand Down Expand Up @@ -102,7 +104,7 @@ RM := --rm
TTY := --tty

DOCKER_BUILDKIT ?= 1
BUILD_IMAGE = BUILD_IMAGE=$(IMAGE_PREFIX)/loki-build-image:$(BUILD_IMAGE_VERSION)
BUILD_IMAGE = BUILD_IMAGE=$(BUILD_IMAGE_PREFIX)/loki-build-image:$(BUILD_IMAGE_VERSION)
PUSH_OCI=docker push
TAG_OCI=docker tag
ifeq ($(CI), true)
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/alert/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ At the time of writing, these are the compatible backends that support this:
- [Grafana Mimir](/docs/mimir/latest/operators-guide/reference-http-api/#remote-write)
- [Thanos (`Receiver`)](https://thanos.io/tip/components/receive.md/)

Here is an example remote-write configuration for sending to a local Prometheus instance:
Here is an example of a remote-write configuration for sending data to a local Prometheus instance:

```yaml
ruler:
Expand Down
4 changes: 4 additions & 0 deletions docs/sources/configure/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,10 @@ shard_streams:
# CLI flag: -bloom-compactor.min-table-age
[bloom_compactor_min_table_age: <duration> | default = 1h]

# Whether to compact chunks into bloom filters.
# CLI flag: -bloom-compactor.enable-compaction
[bloom_compactor_enable_compaction: <boolean> | default = false]

# Allow user to send structured metadata in push payload.
# CLI flag: -validation.allow-structured-metadata
[allow_structured_metadata: <boolean> | default = false]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ This guide assumes Loki will be installed in one of the modes above and that a `
```
serviceAccount:
annotations:
"eks.amazonaws.com/role-arn": "arn:aws:iam::<account id>:role/<role name>:
"eks.amazonaws.com/role-arn": "arn:aws:iam::<account id>:role/<role name>"
```

3. Configure the storage:
Expand Down
1 change: 0 additions & 1 deletion docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2027,7 +2027,6 @@ null
<td>Limits config</td>
<td><pre lang="json">
{
"enforce_metric_name": false,
"max_cache_freshness_per_query": "10m",
"reject_old_samples": true,
"reject_old_samples_max_age": "168h",
Expand Down
4 changes: 0 additions & 4 deletions docs/sources/setup/upgrade/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ Some Loki metrics started with the prefix `cortex_`. In this release they will b
- `cortex_query_scheduler_queue_duration_seconds_sum`
- `cortex_query_scheduler_queue_length`
- `cortex_query_scheduler_running`
- `cortex_quota_cgroup_cpu_max`
- `cortex_quota_cgroup_cpu_period`
- `cortex_quota_cpu_count`
- `cortex_quota_gomaxprocs`
- `cortex_ring_member_heartbeats_total`
- `cortex_ring_member_tokens_owned`
- `cortex_ring_member_tokens_to_own`
Expand Down
30 changes: 24 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 28 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@
in
{
overlays = {
golangci-lint = import ./nix/overlays/golangci-lint.nix;
helm-docs = import ./nix/overlays/helm-docs.nix;
default = nix.overlay;
};
} //
flake-utils.lib.eachDefaultSystem (system:
let

pkgs = import nixpkgs {
inherit system;
overlays = [
(import ./nix/overlays/golangci-lint.nix)
(import ./nix/overlays/helm-docs.nix)
nix.overlay
];
config = { allowUnfree = true; };
Expand All @@ -40,9 +35,12 @@

packages = with pkgs; {
inherit
logcli
loki
loki-canary
loki-helm-test
loki-helm-test-docker;
loki-helm-test-docker
promtail;
};

apps = {
Expand All @@ -56,21 +54,30 @@
}/bin/lint.sh";
};

test = {
type = "app";
program = with pkgs; "${
(writeShellScriptBin "test.sh" ''
${loki.overrideAttrs(old: { doCheck = true; })}/bin/loki --version
'')
}/bin/test.sh";
};

loki = {
type = "app";
program = with pkgs; "${loki.overrideAttrs(old: rec { doCheck = false; })}/bin/loki";
program = with pkgs; "${loki}/bin/loki";
};
promtail = {
type = "app";
program = with pkgs; "${loki.overrideAttrs(old: rec { doCheck = false; })}/bin/promtail";
program = with pkgs; "${promtail}/bin/promtail";
};
logcli = {
type = "app";
program = with pkgs; "${loki.overrideAttrs(old: rec { doCheck = false; })}/bin/logcli";
program = with pkgs; "${logcli}/bin/logcli";
};
loki-canary = {
type = "app";
program = with pkgs; "${loki.overrideAttrs(old: rec { doCheck = false; })}/bin/loki-canary";
program = with pkgs; "${loki-canary}/bin/loki-canary";
};
loki-helm-test = {
type = "app";
Expand All @@ -80,20 +87,22 @@

devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(import ./packages/chart-releaser.nix {
inherit (prev) pkgs lib buildGoModule fetchFromGitHub;
})

chart-testing
faillint
gcc
go
systemd
yamllint
nixpkgs-fmt
statix
nettools

golangci-lint
gotools
helm-docs
faillint
chart-testing
chart-releaser
nettools
nixpkgs-fmt
statix
systemd
yamllint
];
};
});
Expand Down
Loading

0 comments on commit 3e578cb

Please sign in to comment.