mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 02:11:09 +00:00
test images: Simplifies the agnhost binary version
Currently, whenever agnhost/VERSION is bumped, the version in agnhost/agnhost.go has to be bumped as well. This is also verified on presubmit (build/dependencies.yaml). This means that whenever we need to bump the agnhost image version, someone has to approve the build/dependencies.yaml, which is not as easy. This commit removes the need for this check by automatically setting the Version inside agnhost.go at build time, simplifying the process.
This commit is contained in:
parent
6a043332be
commit
94ac896269
@ -16,22 +16,6 @@ dependencies:
|
||||
- path: hack/tools/go.mod
|
||||
match: sigs.k8s.io/zeitgeist\ v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?
|
||||
|
||||
# agnhost: bump this one first
|
||||
- name: "agnhost"
|
||||
version: "2.32"
|
||||
refPaths:
|
||||
- path: test/images/agnhost/VERSION
|
||||
match: \d.\d
|
||||
- path: test/images/agnhost/agnhost.go
|
||||
match: "Version:"
|
||||
|
||||
# then after merge and successful postsubmit image push / promotion, bump this
|
||||
- name: "agnhost: dependents"
|
||||
version: "2.32"
|
||||
refPaths:
|
||||
- path: test/utils/image/manifest.go
|
||||
match: configs\[Agnhost\] = Config{list\.PromoterE2eRegistry, "agnhost", "\d+\.\d+"}
|
||||
|
||||
# CNI plugins
|
||||
- name: "cni"
|
||||
version: 0.9.1
|
||||
|
@ -104,8 +104,7 @@ These images are then used by the rest of the E2E test images as a cache / base
|
||||
Make updates to the functionality of the images required for your test case and update the version number.
|
||||
|
||||
The version can easily be bumped by modifying the file `test/images/${IMAGE_NAME}/VERSION`, which will
|
||||
be used when building the image. Additionally, for the `agnhost` image, also bump the `Version` in
|
||||
`test/images/agnhost/agnhost.go`.
|
||||
be used when building the image.
|
||||
|
||||
Some test images (`agnhost`) are used as bases for other images (`kitten`, `nautilus`). If the parent
|
||||
image's `VERSION` has been bumped, also bump the version in the children's `BASEIMAGE` files in order
|
||||
|
@ -19,6 +19,8 @@ TARGET ?= $(CURDIR)
|
||||
GOARM ?= 7
|
||||
GOLANG_VERSION ?= latest
|
||||
SRC_DIR = $(notdir $(shell pwd))
|
||||
VERSION = $(shell cat VERSION)
|
||||
LD_FLAGS = -X 'main.Version=$(VERSION)'
|
||||
export
|
||||
|
||||
bin:
|
||||
|
@ -16,14 +16,6 @@ The image was created for testing purposes, reducing the need for having differe
|
||||
cases for the same tested behaviour.
|
||||
|
||||
|
||||
## Developer notes
|
||||
|
||||
We've introduced versioning into the `agnhost` binary for debugging purposes (e.g.: if the
|
||||
image and binary versions do not match, see [here](https://github.com/kubernetes/kubernetes/pull/79667#discussion_r304198370)).
|
||||
|
||||
Whenever the image `VERSION` is bumped, the `Version` in `agnhost.go` will also have to be bumped.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
The `agnhost` binary has several subcommands which are can be used to test different
|
||||
|
@ -1 +1 @@
|
||||
2.32
|
||||
2.33
|
||||
|
@ -48,10 +48,12 @@ import (
|
||||
"k8s.io/kubernetes/test/images/agnhost/webhook"
|
||||
)
|
||||
|
||||
var Version = "development"
|
||||
|
||||
func main() {
|
||||
rootCmd := &cobra.Command{
|
||||
Use: "app",
|
||||
Version: "2.32",
|
||||
Version: Version,
|
||||
}
|
||||
|
||||
rootCmd.AddCommand(auditproxy.CmdAuditProxy)
|
||||
|
@ -277,7 +277,7 @@ bin() {
|
||||
golang:"${GOLANG_VERSION}" \
|
||||
/bin/bash -c "\
|
||||
cd /go/src/k8s.io/kubernetes/test/images/${SRC_DIR} && \
|
||||
CGO_ENABLED=0 ${arch_prefix} GOOS=${OS} GOARCH=${ARCH} go build -a -installsuffix cgo --ldflags '-w' -o ${TARGET}/${SRC} ./$(dirname "${SRC}")"
|
||||
CGO_ENABLED=0 ${arch_prefix} GOOS=${OS} GOARCH=${ARCH} go build -a -installsuffix cgo --ldflags \"-w ${LD_FLAGS}\" -o ${TARGET}/${SRC} ./$(dirname "${SRC}")"
|
||||
done
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user