Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add prowjobs #2

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@

run:
modules-download-mode: readonly
deadline: 20m
skip-files:
- zz_generated.*.go
timeout: 20m

linters:
enable:
- asciicheck
- bidichk
- bodyclose
- copyloopvar
- depguard
- durationcheck
- errcheck
- errname
- errorlint
- exportloopref
- goconst
- gocritic
- gocyclo
Expand All @@ -51,10 +49,14 @@ linters:
- wastedassign
- whitespace
disable-all: true

issues:
# defaults to 3, which often needlessly hides issues and forces
# to re-run the linter across the entire repo many times
max-same-issues: 50
max-same-issues: 0

exclude-files:
- zz_generated.*.go

# NOTE: Do not use commas in the exclude patterns, or else the regex will be
# split and you will be sad: https://github.com/golangci/golangci-lint/issues/665
Expand Down
89 changes: 89 additions & 0 deletions .prow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright 2025 The KCP Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

presubmits:
- name: pull-api-syncagent-verify
always_run: true
decorate: true
clone_uri: "https://github.com/kcp-dev/api-syncagent"
labels:
preset-goproxy: "true"
spec:
containers:
- image: ghcr.io/kcp-dev/infra/build:1.23.4-3
command:
- hack/ci/verify.sh
resources:
requests:
memory: 1Gi
cpu: 1

- name: pull-api-syncagent-lint
always_run: true
decorate: true
clone_uri: "https://github.com/kcp-dev/api-syncagent"
labels:
preset-goproxy: "true"
spec:
containers:
- image: ghcr.io/kcp-dev/infra/build:1.23.4-3
command:
- make
- lint
resources:
requests:
memory: 4Gi
cpu: 2

- name: pull-api-syncagent-build-image
always_run: true
decorate: true
clone_uri: "https://github.com/kcp-dev/api-syncagent"
labels:
preset-goproxy: "true"
spec:
containers:
- image: quay.io/containers/buildah:v1.30.0
command:
- hack/ci/build-image.sh
env:
- name: DRY_RUN
value: '1'
# docker-in-docker needs privileged mode
securityContext:
privileged: true
resources:
requests:
memory: 1Gi
cpu: 1

- name: pull-api-syncagent-test
always_run: true
decorate: true
clone_uri: "https://github.com/kcp-dev/api-syncagent"
labels:
preset-goproxy: "true"
spec:
containers:
- image: ghcr.io/kcp-dev/infra/build:1.23.4-3
command:
- make
- test
env:
- name: USE_GOTESTSUM
value: '1'
resources:
requests:
memory: 4Gi
cpu: 2
16 changes: 15 additions & 1 deletion hack/ci/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ cd $(dirname $0)/../..
source hack/lib.sh

EXIT_CODE=0
SUMMARY=

try() {
local title="$1"
shift

heading "$title"
echo -e "$@\n"
echo

start_time=$(date +%s)

Expand All @@ -38,13 +39,18 @@ try() {
elapsed_time=$(($(date +%s) - $start_time))
TEST_NAME="$title" write_junit $exitCode "$elapsed_time"

local status
if [[ $exitCode -eq 0 ]]; then
echo -e "\n[${elapsed_time}s] SUCCESS :)"
status=OK
else
echo -e "\n[${elapsed_time}s] FAILED."
status=FAIL
EXIT_CODE=1
fi

SUMMARY="$SUMMARY\n$(printf "%-35s %s" "$title" "$status")"

git reset --hard --quiet
git clean --force

Expand Down Expand Up @@ -87,4 +93,12 @@ try "Verify Go imports" verify_imports
try "Verify license compatibility" ./hack/verify-licenses.sh
try "Verify boilerplate" ./hack/verify-boilerplate.sh

echo
echo "SUMMARY"
echo "======="
echo
echo "Check Result"
echo -n "------------------------------------------"
echo -e "$SUMMARY"

exit $EXIT_CODE
6 changes: 3 additions & 3 deletions hack/download-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ fi
mkdir -p tmp
cd tmp

echo "Downloading $BINARY…" >&2
curl --fail -LO "$URL"
echo "Downloading $BINARY version $VERSION…" >&2
curl --fail --silent -LO "$URL"
archive="$(ls)"

UNCOMPRESSED=${UNCOMPRESSED:-false}
Expand All @@ -71,4 +71,4 @@ fi
rm -rf tmp
echo "$VERSION" > "$versionFile"

echo "Installed $BINARY version $VERSION." >&2
echo "Installed at _tools/$BINARY." >&2
Loading