From 51f26e0cba007a7cdfc32f1ba62ce9694a90dda3 Mon Sep 17 00:00:00 2001 From: Jesus Vazquez Date: Wed, 13 Apr 2022 14:45:43 +0200 Subject: [PATCH] Necessary changes to make the merge work This commit disables some unused workflows on our CI. Also uses grafana/regexp instead of regexp which is blackisted. Also updates head_test TestHeadReadWriterRepair increasing ChunkWriteQueueSize to 1 so that the chunk disk mapper uses the async queue. This seems to be default behaviour in upstream prometheus and without this option our test fails. --- .github/workflows/buf-lint.yml | 20 ------- .github/workflows/buf.yml | 23 -------- .github/workflows/codeql-analysis.yml | 67 ------------------------ .github/workflows/fuzzing.yml | 25 --------- model/labels/regexp_test.go | 3 +- tsdb/compact_test.go | 1 + tsdb/head_test.go | 1 + tsdb/postings_for_matchers_cache_test.go | 2 +- 8 files changed, 4 insertions(+), 138 deletions(-) delete mode 100644 .github/workflows/buf-lint.yml delete mode 100644 .github/workflows/buf.yml delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/fuzzing.yml diff --git a/.github/workflows/buf-lint.yml b/.github/workflows/buf-lint.yml deleted file mode 100644 index e86ea9efc..000000000 --- a/.github/workflows/buf-lint.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: buf.build -on: - pull_request: - paths: - - ".github/workflows/buf-lint.yml" - - "**.proto" -jobs: - buf: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1.3.1 - - uses: bufbuild/buf-lint-action@v1 - with: - input: 'prompb' - - uses: bufbuild/buf-breaking-action@v1 - with: - input: 'prompb' - against: 'https://github.com/prometheus/prometheus.git#branch=main,ref=HEAD,subdir=prompb' diff --git a/.github/workflows/buf.yml b/.github/workflows/buf.yml deleted file mode 100644 index 00d33e070..000000000 --- a/.github/workflows/buf.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: buf.build -on: - push: - branches: - - main -jobs: - buf: - name: lint and publish - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: bufbuild/buf-setup-action@v1.3.1 - - uses: bufbuild/buf-lint-action@v1 - with: - input: 'prompb' - - uses: bufbuild/buf-breaking-action@v1 - with: - input: 'prompb' - against: 'https://github.com/prometheus/prometheus.git#branch=main,ref=HEAD~1,subdir=prompb' - - uses: bufbuild/buf-push-action@v1 - with: - input: 'prompb' - buf_token: ${{ secrets.BUF_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 903e221c7..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,67 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [main, release-*] - pull_request: - # The branches below must be a subset of the branches above - branches: [main] - schedule: - - cron: "26 14 * * 1" - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: ["go", "javascript"] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/fuzzing.yml b/.github/workflows/fuzzing.yml deleted file mode 100644 index b0fc0a4ee..000000000 --- a/.github/workflows/fuzzing.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: CIFuzz -on: - pull_request: -jobs: - Fuzzing: - runs-on: ubuntu-latest - steps: - - name: Build Fuzzers - id: build - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - oss-fuzz-project-name: "prometheus" - dry-run: false - - name: Run Fuzzers - uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master - with: - oss-fuzz-project-name: "prometheus" - fuzz-seconds: 600 - dry-run: false - - name: Upload Crash - uses: actions/upload-artifact@v3 - if: failure() && steps.build.outcome == 'success' - with: - name: artifacts - path: ./out/artifacts diff --git a/model/labels/regexp_test.go b/model/labels/regexp_test.go index 7fb63f56b..44b6125c0 100644 --- a/model/labels/regexp_test.go +++ b/model/labels/regexp_test.go @@ -15,11 +15,11 @@ package labels import ( "math/rand" - "regexp" "strings" "testing" "time" + "github.com/grafana/regexp" "github.com/grafana/regexp/syntax" "github.com/stretchr/testify/require" ) @@ -201,7 +201,6 @@ func TestFindSetMatches(t *testing.T) { require.NoError(t, err) matches := findSetMatches(parsed, "") require.Equal(t, c.exp, matches) - }) } } diff --git a/tsdb/compact_test.go b/tsdb/compact_test.go index d689b9db4..3a063c4bd 100644 --- a/tsdb/compact_test.go +++ b/tsdb/compact_test.go @@ -17,6 +17,7 @@ import ( "context" "crypto/rand" "fmt" + "io/ioutil" "math" "os" "path" diff --git a/tsdb/head_test.go b/tsdb/head_test.go index a6eb8d78d..997eec2a6 100644 --- a/tsdb/head_test.go +++ b/tsdb/head_test.go @@ -1618,6 +1618,7 @@ func TestHeadReadWriterRepair(t *testing.T) { opts := DefaultHeadOptions() opts.ChunkRange = chunkRange opts.ChunkDirRoot = dir + opts.ChunkWriteQueueSize = 1 // We need to set this option so that we use the async queue. Upstream prometheus uses the queue directly. h, err := NewHead(nil, nil, w, opts, nil) require.NoError(t, err) require.Equal(t, 0.0, prom_testutil.ToFloat64(h.metrics.mmapChunkCorruptionTotal)) diff --git a/tsdb/postings_for_matchers_cache_test.go b/tsdb/postings_for_matchers_cache_test.go index f7ee3bf72..4421fc372 100644 --- a/tsdb/postings_for_matchers_cache_test.go +++ b/tsdb/postings_for_matchers_cache_test.go @@ -247,7 +247,7 @@ func TestPostingsForMatchersCache(t *testing.T) { require.NoError(t, err) require.EqualError(t, p.Err(), "result from call 1") - // make first call agian, it's calculated again + // make first call again, it's calculated again p, err = c.PostingsForMatchers(indexForPostingsMock{}, true, calls[0]...) require.NoError(t, err) require.EqualError(t, p.Err(), "result from call 2")