Merge pull request #104296 from claudiubelu/test-images/automate-agnhost-binary-version

test images: Simplifies the agnhost binary version
This commit is contained in:
Kubernetes Prow Robot 2021-08-11 04:36:47 -07:00 committed by GitHub
commit 7dd4f1742f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 29 deletions

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -1 +1 @@
2.32
2.33

View File

@ -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)

View File

@ -278,7 +278,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
}