Skip to content

Commit 4212ed3

Browse files
Merge pull request #48 from Kuadrant/kuadrant-merge-target
Kuadrant Merge
2 parents 3657c6b + 28fc69b commit 4212ed3

File tree

119 files changed

+14691
-2609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+14691
-2609
lines changed

.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
vendor/** linguist-vendored
3+
**/zz_generated.*.go linguist-generated=true
4+
hack/boilerplate.go.txt linguist-generated=true

.github/CODEOWNERS

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Global owners
2+
* @eguzki
3+
* @didierofrivia
4+
* @guicassolato
5+
* @alexsnaps

.github/workflows/build-images.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ jobs:
4949
name: Build Bundle
5050
runs-on: ubuntu-latest
5151
steps:
52-
- name: Set up Go 1.16.x
52+
- name: Set up Go 1.18.x
5353
uses: actions/setup-go@v2
5454
with:
55-
go-version: 1.16.x
55+
go-version: 1.18.x
5656
id: go
5757
- name: Check out code
5858
uses: actions/checkout@v2
@@ -95,10 +95,10 @@ jobs:
9595
needs: [build, build-bundle]
9696
runs-on: ubuntu-latest
9797
steps:
98-
- name: Set up Go 1.16.x
98+
- name: Set up Go 1.18.x
9999
uses: actions/setup-go@v2
100100
with:
101-
go-version: 1.16.x
101+
go-version: 1.18.x
102102
id: go
103103
- name: Check out code
104104
uses: actions/checkout@v2

.github/workflows/code-style.yaml

+257
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
# Copyright 2020 The Knative Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This file is automagically synced here from github.com/knative-sandbox/.github
16+
# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten.
17+
18+
name: Code Style
19+
20+
on:
21+
pull_request:
22+
branches: [ 'main', 'master', 'release-*' ]
23+
24+
jobs:
25+
26+
autoformat:
27+
name: Auto-format and Check
28+
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false # Keep running if one leg fails.
31+
matrix:
32+
tool:
33+
- goimports
34+
- gofmt
35+
36+
include:
37+
- tool: gofmt
38+
options: -s
39+
- tool: goimports
40+
importpath: golang.org/x/tools/cmd/goimports@latest
41+
42+
steps:
43+
- name: Set up Go 1.18.x
44+
uses: actions/setup-go@v2
45+
with:
46+
go-version: 1.18.x
47+
id: go
48+
49+
- name: Check out code
50+
uses: actions/checkout@v2
51+
52+
- name: Install Dependencies
53+
if: ${{ matrix.importpath != '' }}
54+
run: |
55+
cd $(mktemp -d)
56+
GO111MODULE=on go install ${{ matrix.importpath }}
57+
58+
- name: ${{ matrix.tool }} ${{ matrix.options }}
59+
shell: bash
60+
run: >
61+
${{ matrix.tool }} ${{ matrix.options }} -w
62+
$(find .
63+
-path './vendor' -prune
64+
-o -path './third_party' -prune
65+
-o -name '*.pb.go' -prune
66+
-o -name 'wire_gen.go' -prune
67+
-o -name '*.deepcopy.go' -prune
68+
-o -type f -name '*.go' -print)
69+
70+
- name: Verify ${{ matrix.tool }}
71+
shell: bash
72+
run: |
73+
# From: https://backreference.org/2009/12/23/how-to-match-newlines-in-sed/
74+
# This is to leverage this workaround:
75+
# https://github.com/actions/toolkit/issues/193#issuecomment-605394935
76+
function urlencode() {
77+
sed ':begin;$!N;s/\n/%0A/;tbegin'
78+
}
79+
if [[ $(git diff-index --name-only HEAD --) ]]; then
80+
for x in $(git diff-index --name-only HEAD --); do
81+
echo "::error file=$x::Please run ${{ matrix.tool }} ${{ matrix.options }}.%0A$(git diff $x | urlencode)"
82+
done
83+
echo "${{ github.repository }} is out of style. Please run ${{ matrix.tool }} ${{ matrix.options }}."
84+
exit 1
85+
fi
86+
echo "${{ github.repository }} is formatted correctly."
87+
88+
lint:
89+
name: Lint
90+
runs-on: ubuntu-latest
91+
92+
steps:
93+
- name: Set up Go 1.18.x
94+
uses: actions/setup-go@v2
95+
with:
96+
go-version: 1.18.x
97+
id: go
98+
99+
- name: Check out code
100+
uses: actions/checkout@v2
101+
102+
- name: Install Tools
103+
env:
104+
WOKE_VERSION: v0.5.0
105+
run: |
106+
TEMP_PATH="$(mktemp -d)"
107+
cd $TEMP_PATH
108+
109+
echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
110+
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" 2>&1
111+
echo '::endgroup::'
112+
113+
echo '::group:: Installing misspell ... https://github.com/client9/misspell'
114+
go install github.com/client9/misspell/cmd/misspell@latest
115+
echo '::endgroup::'
116+
117+
echo '::group:: Installing woke ... https://github.com/get-woke/woke'
118+
curl -sfL https://raw.githubusercontent.com/get-woke/woke/main/install.sh | sh -s -- -b "${TEMP_PATH}" "${WOKE_VERSION}" 2>&1
119+
echo '::endgroup::'
120+
121+
echo "${TEMP_PATH}" >> $GITHUB_PATH
122+
123+
- id: golangci_configuration
124+
uses: andstor/file-existence-action@v1
125+
with:
126+
files: .golangci.yaml
127+
- name: Go Lint
128+
if: steps.golangci_configuration.outputs.files_exists == 'true'
129+
run: |
130+
make run-lint
131+
132+
- name: misspell
133+
shell: bash
134+
if: ${{ always() }}
135+
env:
136+
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
137+
run: |
138+
set -e
139+
cd "${GITHUB_WORKSPACE}" || exit 1
140+
141+
echo '::group:: Running github.com/client9/misspell with reviewdog 🐶 ...'
142+
# Don't fail because of misspell
143+
set +o pipefail
144+
# Exclude generated and vendored files, plus some legacy
145+
# paths until we update all .gitattributes
146+
git ls-files |
147+
git check-attr --stdin linguist-generated | grep -Ev ': (set|true)$' | cut -d: -f1 |
148+
git check-attr --stdin linguist-vendored | grep -Ev ': (set|true)$' | cut -d: -f1 |
149+
grep -Ev '^(vendor/|third_party/|.git|utils/)' |
150+
xargs misspell -error |
151+
reviewdog -efm="%f:%l:%c: %m" \
152+
-name="github.com/client9/misspell" \
153+
-reporter="github-pr-check" \
154+
-filter-mode="added" \
155+
-fail-on-error="true" \
156+
-level="error"
157+
158+
echo '::endgroup::'
159+
160+
# - name: trailing whitespace
161+
# shell: bash
162+
# if: ${{ always() }}
163+
# env:
164+
# REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
165+
# run: |
166+
# set -e
167+
# cd "${GITHUB_WORKSPACE}" || exit 1
168+
#
169+
# echo '::group:: Flagging trailing whitespace with reviewdog 🐶 ...'
170+
# # Don't fail because of grep
171+
# set +o pipefail
172+
#
173+
# # Exclude generated and vendored files, plus some legacy
174+
# # paths until we update all .gitattributes
175+
# git ls-files |
176+
# git check-attr --stdin linguist-generated | grep -Ev ': (set|true)$' | cut -d: -f1 |
177+
# git check-attr --stdin linguist-vendored | grep -Ev ': (set|true)$' | cut -d: -f1 |
178+
# grep -Ev '^(vendor/|third_party/|.git|utils/)' |
179+
# xargs grep -nE " +$" |
180+
# reviewdog -efm="%f:%l:%m" \
181+
# -name="trailing whitespace" \
182+
# -reporter="github-pr-check" \
183+
# -filter-mode="added" \
184+
# -fail-on-error="true" \
185+
# -level="error"
186+
#
187+
# echo '::endgroup::'
188+
189+
- name: EOF newline
190+
shell: bash
191+
if: ${{ always() }}
192+
env:
193+
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
194+
run: |
195+
set -e
196+
cd "${GITHUB_WORKSPACE}" || exit 1
197+
198+
echo '::group:: Flagging missing EOF newlines with reviewdog 🐶 ...'
199+
# Don't fail because of misspell
200+
set +o pipefail
201+
# Lint exclude rule:
202+
# - nothing in vendor/
203+
# - nothing in third_party
204+
# - nothing in .git/
205+
# - no *.ai (Adobe Illustrator) files.
206+
LINT_FILES=$(git ls-files |
207+
git check-attr --stdin linguist-generated | grep -Ev ': (set|true)$' | cut -d: -f1 |
208+
git check-attr --stdin linguist-vendored | grep -Ev ': (set|true)$' | cut -d: -f1 |
209+
grep -Ev '^(vendor/|third_party/|.git|utils/)' |
210+
grep -v '\.ai$' |
211+
grep -v '\.svg$')
212+
213+
for x in $LINT_FILES; do
214+
# Based on https://stackoverflow.com/questions/34943632/linux-check-if-there-is-an-empty-line-at-the-end-of-a-file
215+
if [[ -f $x && ! ( -s "$x" && -z "$(tail -c 1 $x)" ) ]]; then
216+
# We add 1 to `wc -l` here because of this limitation (from the man page):
217+
# Characters beyond the final <newline> character will not be included in the line count.
218+
echo $x:$((1 + $(wc -l $x | tr -s ' ' | cut -d' ' -f 1))): Missing newline
219+
fi
220+
done |
221+
reviewdog -efm="%f:%l: %m" \
222+
-name="EOF Newline" \
223+
-reporter="github-pr-check" \
224+
-filter-mode="added" \
225+
-fail-on-error="true" \
226+
-level="error"
227+
228+
echo '::endgroup::'
229+
230+
# This is mostly copied from https://github.com/get-woke/woke-action-reviewdog/blob/main/entrypoint.sh
231+
# since their action is not yet released under a stable version.
232+
- name: Language
233+
if: ${{ always() && github.event_name == 'pull_request' }}
234+
shell: bash
235+
env:
236+
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
237+
run: |
238+
set -e
239+
cd "${GITHUB_WORKSPACE}" || exit 1
240+
241+
# Create a minimal .wokeignore if none already exist.
242+
if [ ! -f .wokeignore ]; then
243+
cat > .wokeignore <<EOF
244+
vendor/*
245+
third_party/*
246+
EOF
247+
fi
248+
249+
echo '::group:: Running woke with reviewdog 🐶 ...'
250+
woke --output simple \
251+
| reviewdog -efm="%f:%l:%c: %m" \
252+
-name="woke" \
253+
-reporter="github-pr-check" \
254+
-filter-mode="added" \
255+
-fail-on-error="true" \
256+
-level="error"
257+
echo '::endgroup::'

.github/workflows/codeql-analysis.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main ]
20+
schedule:
21+
- cron: '35 17 * * 6'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'go' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37+
# Learn more:
38+
# 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
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v2
43+
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
53+
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v1
58+
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
61+
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
65+
66+
#- run: |
67+
# make bootstrap
68+
# make release
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v1

0 commit comments

Comments
 (0)