Skip to content

Commit

Permalink
Disable SONAR scan in PRs created from forks (#591)
Browse files Browse the repository at this point in the history
* Disable the SONAR scan in PRs created from forks. It won't be able to
run because the GHA can't get the secrets for PRs created from a fork.
* The failure creates noise in various dashboards because we see the red
"x" by the PR.
* Mark some locally flaky tests to be skipped

---------

Co-authored-by: Adam Babik <[email protected]>
Co-authored-by: Sebastian Tiedtke <[email protected]>
  • Loading branch information
3 people authored Jun 3, 2024
1 parent 64df80f commit cd962ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ jobs:

- name: SonarCloud Scan
uses: SonarSource/[email protected]
# Skip this test if the PR is created from a fork.
# If its created from a fork the PR won't be able to fetch the secrets so
# the step will fail.
if: github.event.pull_request.head.repo.full_name == github.repository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 4 additions & 0 deletions internal/runner/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"os/exec"
"runtime"
"strconv"
"strings"
"syscall"
"testing"
Expand Down Expand Up @@ -347,6 +348,9 @@ func Test_runnerService(t *testing.T) {
})

t.Run("Input", func(t *testing.T) {
if skip, err := strconv.ParseBool(os.Getenv("SKIP_FLAKY")); err == nil && skip {
t.Skip("skipping flaky test")
}
t.Parallel()

stream, err := client.Execute(context.Background())
Expand Down

0 comments on commit cd962ab

Please sign in to comment.