Skip to content

Commit 6be30f8

Browse files
authored
Merge branch 'main' into cache-mod-deps
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
2 parents 1051dee + 9afad9a commit 6be30f8

File tree

300 files changed

+11768
-3765
lines changed

Some content is hidden

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

300 files changed

+11768
-3765
lines changed

.github/workflows/e2e-test-kind.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
- name: Build Velero Image
4343
if: steps.image-cache.outputs.cache-hit != 'true'
4444
run: |
45-
IMAGE=velero VERSION=pr-test make container
46-
docker save velero:pr-test -o ./velero.tar
45+
IMAGE=velero VERSION=pr-test BUILD_OUTPUT_TYPE=docker make container
46+
docker save velero:pr-test-linux-amd64 -o ./velero.tar
4747
# Create json of k8s versions to test
4848
# from guide: https://stackoverflow.com/a/65094398/4590470
4949
setup-test-matrix:
@@ -130,7 +130,7 @@ jobs:
130130
ADDITIONAL_BSL_CONFIG=region=minio,s3ForcePathStyle="true",s3Url=http://$(hostname -i):9000 \
131131
ADDITIONAL_CREDS_FILE=/tmp/credential \
132132
ADDITIONAL_BSL_BUCKET=additional-bucket \
133-
VELERO_IMAGE=velero:pr-test \
133+
VELERO_IMAGE=velero:pr-test-linux-amd64 \
134134
GINKGO_LABELS="${{ matrix.labels }}" \
135135
make -C test/ run-e2e
136136
timeout-minutes: 30

.github/workflows/pr-ci-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Make ci
1717
run: make ci
1818
- name: Upload test coverage
19-
uses: codecov/codecov-action@v4
19+
uses: codecov/codecov-action@v5
2020
with:
2121
token: ${{ secrets.CODECOV_TOKEN }}
2222
files: coverage.out

.github/workflows/pr-codespell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Codespell
1414
uses: codespell-project/actions-codespell@master
1515
with:
16-
# ignore the config/.../crd.go file as it's generated binary data that is edited elswhere.
16+
# ignore the config/.../crd.go file as it's generated binary data that is edited elsewhere.
1717
skip: .git,*.png,*.jpg,*.woff,*.ttf,*.gif,*.ico,./config/crd/v1beta1/crds/crds.go,./config/crd/v1/crds/crds.go,./config/crd/v2alpha1/crds/crds.go,./go.sum,./LICENSE
1818
ignore_words_list: iam,aks,ist,bridget,ue,shouldnot,atleast,notin,sme,optin
1919
check_filenames: true

.github/workflows/push.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Test
4848
run: make test
4949
- name: Upload test coverage
50-
uses: codecov/codecov-action@v4
50+
uses: codecov/codecov-action@v5
5151
with:
5252
token: ${{ secrets.CODECOV_TOKEN }}
5353
files: coverage.out
@@ -68,24 +68,4 @@ jobs:
6868
6969
# Build and push Velero image to docker registry
7070
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
71-
VERSION=$(./hack/docker-push.sh | grep 'VERSION:' | awk -F: '{print $2}' | xargs)
72-
73-
# Upload Velero image package to GCS
74-
source hack/ci/build_util.sh
75-
BIN=velero
76-
RESTORE_HELPER_BIN=velero-restore-helper
77-
GCS_BUCKET=velero-builds
78-
VELERO_IMAGE=${BIN}-${VERSION}
79-
VELERO_RESTORE_HELPER_IMAGE=${RESTORE_HELPER_BIN}-${VERSION}
80-
VELERO_IMAGE_FILE=${VELERO_IMAGE}.tar.gz
81-
VELERO_RESTORE_HELPER_IMAGE_FILE=${VELERO_RESTORE_HELPER_IMAGE}.tar.gz
82-
VELERO_IMAGE_BACKUP_FILE=${VELERO_IMAGE}-'build.'${GITHUB_RUN_NUMBER}.tar.gz
83-
VELERO_RESTORE_HELPER_IMAGE_BACKUP_FILE=${VELERO_RESTORE_HELPER_IMAGE}-'build.'${GITHUB_RUN_NUMBER}.tar.gz
84-
85-
cp ${VELERO_IMAGE_FILE} ${VELERO_IMAGE_BACKUP_FILE}
86-
cp ${VELERO_RESTORE_HELPER_IMAGE_FILE} ${VELERO_RESTORE_HELPER_IMAGE_BACKUP_FILE}
87-
88-
uploader ${VELERO_IMAGE_FILE} ${GCS_BUCKET}
89-
uploader ${VELERO_RESTORE_HELPER_IMAGE_FILE} ${GCS_BUCKET}
90-
uploader ${VELERO_IMAGE_BACKUP_FILE} ${GCS_BUCKET}
91-
uploader ${VELERO_RESTORE_HELPER_IMAGE_BACKUP_FILE} ${GCS_BUCKET}
71+
./hack/docker-push.sh

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ tilt-resources/cloud
5353
# test generated files
5454
test/e2e/report.xml
5555
coverage.out
56-
__debug_bin*
56+
__debug_bin*
57+
58+
# make lint cache
59+
.cache/

.golangci.yaml

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,61 @@ linters-settings:
227227
require-explanation: true
228228
# Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
229229
require-specific: true
230+
perfsprint:
231+
strconcat: false
232+
sprintf1: false
233+
errorf: false
234+
int-conversion: true
235+
fiximports: true
230236
revive:
231237
rules:
238+
- name: blank-imports
239+
disabled: true
240+
- name: context-as-argument
241+
disabled: true
242+
- name: context-keys-type
243+
- name: dot-imports
244+
disabled: true
245+
- name: early-return
246+
disabled: true
247+
arguments:
248+
- "preserveScope"
249+
- name: empty-block
250+
disabled: true
251+
- name: error-naming
252+
disabled: true
253+
- name: error-return
254+
disabled: true
255+
- name: error-strings
256+
disabled: true
257+
- name: errorf
258+
disabled: true
259+
- name: increment-decrement
260+
disabled: true
261+
- name: indent-error-flow
262+
disabled: true
263+
- name: range
264+
- name: receiver-naming
265+
disabled: true
266+
- name: redefines-builtin-id
267+
disabled: true
268+
- name: superfluous-else
269+
disabled: true
270+
arguments:
271+
- "preserveScope"
272+
- name: time-naming
232273
- name: unexported-return
233274
disabled: true
275+
- name: unnecessary-stmt
276+
disabled: true
277+
- name: unreachable-code
278+
- name: unused-parameter
279+
disabled: true
280+
- name: use-any
281+
disabled: true
282+
- name: var-declaration
283+
- name: var-naming
284+
disabled: true
234285

235286
rowserrcheck:
236287
packages:
@@ -277,7 +328,7 @@ linters-settings:
277328
force-case-trailing-whitespace: 0
278329
# Force cuddling of err checks with err var assignment
279330
force-err-cuddling: false
280-
# Allow leading comments to be separated with empty liens
331+
# Allow leading comments to be separated with empty lines
281332
allow-separated-leading-comment: false
282333

283334
linters:
@@ -310,6 +361,7 @@ linters:
310361
- nilerr
311362
- noctx
312363
- nolintlint
364+
- perfsprint
313365
- revive
314366
- staticcheck
315367
- stylecheck
@@ -331,7 +383,6 @@ issues:
331383
text: "DefaultVolumesToRestic" # No need to report deprecate for DefaultVolumesToRestic.
332384
- path: ".*_test.go$"
333385
linters:
334-
- dupword
335386
- errcheck
336387
- goconst
337388
- gosec
@@ -342,7 +393,6 @@ issues:
342393
- unused
343394
- path: test/
344395
linters:
345-
- dupword
346396
- errcheck
347397
- goconst
348398
- gosec
@@ -351,6 +401,14 @@ issues:
351401
- stylecheck
352402
- unparam
353403
- unused
404+
- path: ".*data_upload_controller_test.go$"
405+
linters:
406+
- dupword
407+
text: "type"
408+
- path: ".*config_test.go$"
409+
linters:
410+
- dupword
411+
text: "bucket"
354412

355413
# The list of ids of default excludes to include or disable. By default it's empty.
356414
include:

Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,16 @@ COPY go.mod go.sum /go/src/github.com/vmware-tanzu/velero/
4242
# velero-builder and restic-builder uses a different go.mod from each other. id helps to avoid sharing cache with velero-builder.
4343
RUN --mount=type=cache,target=/go/pkg/mod,id=vbb go mod download
4444
COPY . /go/src/github.com/vmware-tanzu/velero
45-
RUN --mount=type=cache,target=/go/pkg/mod,id=vbb GOARM=$( echo "${GOARM}" | cut -c2-) go build -o /output/${BIN} \
46-
-ldflags "${LDFLAGS}" ${PKG}/cmd/${BIN}
47-
RUN --mount=type=cache,target=/go/pkg/mod,id=vbb GOARM=$( echo "${GOARM}" | cut -c2-) go build -o /output/velero-helper \
48-
-ldflags "${LDFLAGS}" ${PKG}/cmd/velero-helper
45+
46+
RUN --mount=type=cache,target=/go/pkg/mod,id=vbb mkdir -p /output/usr/bin && \
47+
export GOARM=$( echo "${GOARM}" | cut -c2-) && \
48+
go build -o /output/${BIN} \
49+
-ldflags "${LDFLAGS}" ${PKG}/cmd/${BIN} && \
50+
go build -o /output/velero-restore-helper \
51+
-ldflags "${LDFLAGS}" ${PKG}/cmd/velero-restore-helper && \
52+
go build -o /output/velero-helper \
53+
-ldflags "${LDFLAGS}" ${PKG}/cmd/velero-helper && \
54+
go clean -modcache -cache
4955

5056
# Restic binary build section
5157
FROM --platform=$BUILDPLATFORM golang:1.22-bookworm AS restic-builder

Dockerfile-Windows

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright the Velero contributors.
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+
ARG OS_VERSION=1809
16+
17+
# Velero binary build section
18+
FROM --platform=$BUILDPLATFORM golang:1.22-bookworm AS velero-builder
19+
20+
ARG GOPROXY
21+
ARG BIN
22+
ARG PKG
23+
ARG VERSION
24+
ARG REGISTRY
25+
ARG GIT_SHA
26+
ARG GIT_TREE_STATE
27+
ARG TARGETOS
28+
ARG TARGETARCH
29+
ARG TARGETVARIANT
30+
31+
ENV CGO_ENABLED=0 \
32+
GO111MODULE=on \
33+
GOPROXY=${GOPROXY} \
34+
GOOS=${TARGETOS} \
35+
GOARCH=${TARGETARCH} \
36+
GOARM=${TARGETVARIANT} \
37+
LDFLAGS="-X ${PKG}/pkg/buildinfo.Version=${VERSION} -X ${PKG}/pkg/buildinfo.GitSHA=${GIT_SHA} -X ${PKG}/pkg/buildinfo.GitTreeState=${GIT_TREE_STATE} -X ${PKG}/pkg/buildinfo.ImageRegistry=${REGISTRY}"
38+
39+
WORKDIR /go/src/github.com/vmware-tanzu/velero
40+
41+
COPY . /go/src/github.com/vmware-tanzu/velero
42+
43+
RUN mkdir -p /output/usr/bin && \
44+
export GOARM=$( echo "${GOARM}" | cut -c2-) && \
45+
go build -o /output/${BIN}.exe \
46+
-ldflags "${LDFLAGS}" ${PKG}/cmd/${BIN} && \
47+
go build -o /output/velero-helper.exe \
48+
-ldflags "${LDFLAGS}" ${PKG}/cmd/velero-helper && \
49+
go clean -modcache -cache
50+
51+
# Velero image packing section
52+
FROM mcr.microsoft.com/windows/nanoserver:${OS_VERSION}
53+
COPY --from=velero-builder /output /
54+
55+
USER ContainerUser

MAINTAINERS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
| Daniel Jiang | [reasonerjt](https://github.com/reasonerjt) | [VMware](https://www.github.com/vmware/) |
1111
| Wenkai Yin | [ywk253100](https://github.com/ywk253100) | [VMware](https://www.github.com/vmware/) |
1212
| Xun Jiang | [blackpiglet](https://github.com/blackpiglet) | [VMware](https://www.github.com/vmware/) |
13-
| Ming Qiu | [qiuming-best](https://github.com/qiuming-best) | [VMware](https://www.github.com/vmware/) |
1413
| Shubham Pampattiwar | [shubham-pampattiwar](https://github.com/shubham-pampattiwar) | [OpenShift](https://github.com/openshift) |
1514
| Yonghui Li | [Lyndon-Li](https://github.com/Lyndon-Li) | [VMware](https://www.github.com/vmware/) |
1615
| Anshul Ahuja | [anshulahuja98](https://github.com/anshulahuja98) | [Microsoft Azure](https://www.github.com/azure/) |
@@ -27,7 +26,8 @@
2726
* Bridget McErlean ([zubron](https://github.com/zubron))
2827
* JenTing Hsiao ([jenting](https://github.com/jenting))
2928
* Dave Smith-Uchida ([dsu-igeek](https://github.com/dsu-igeek))
30-
29+
* Ming Qiu ([qiuming-best](https://github.com/qiuming-best))
30+
3131
## Velero Contributors & Stakeholders
3232

3333
| Feature Area | Lead |

0 commit comments

Comments
 (0)