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

Image promoter: Reenable Windows test image building #89152

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions test/images/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

REGISTRY ?= gcr.io/kubernetes-e2e-test-images
GOARM ?= 7
DOCKER_CERT_BASE_PATH ?=
QEMUVERSION=v2.9.1
GOLANG_VERSION=1.13.9
export
Expand Down
2 changes: 2 additions & 0 deletions test/images/agnhost/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
approvers:
- claudiubelu
14 changes: 7 additions & 7 deletions test/images/agnhost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ For example, let's consider the following `pod.yaml` file:
containers:
- args:
- dns-suffix
image: us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11
image: us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.14
name: agnhost
dnsConfig:
nameservers:
Expand Down Expand Up @@ -207,7 +207,7 @@ Usage:

```console
guestbook="test/e2e/testing-manifests/guestbook"
sed_expr="s|{{.AgnhostImage}}|us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11|"
sed_expr="s|{{.AgnhostImage}}|us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.14|"

# create the services.
kubectl create -f ${guestbook}/frontend-service.yaml
Expand Down Expand Up @@ -290,14 +290,14 @@ Examples:

```console
docker run -i \
us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11 \
us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.14 \
logs-generator --log-lines-total 10 --run-duration 1s
```

```console
kubectl run logs-generator \
--generator=run-pod/v1 \
--image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11 \
--image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.14 \
--restart=Never \
-- logs-generator -t 10 -d 1s
```
Expand Down Expand Up @@ -464,7 +464,7 @@ Usage:
```console
kubectl run test-agnhost \
--generator=run-pod/v1 \
--image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11 \
--image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.14 \
--restart=Never \
--env "POD_IP=<POD_IP>" \
--env "NODE_IP=<NODE_IP>" \
Expand Down Expand Up @@ -519,7 +519,7 @@ Usage:
```console
kubectl run test-agnhost \
--generator=run-pod/v1 \
--image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11 \
--image=us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.14 \
--restart=Never \
--env "BIND_ADDRESS=localhost" \
--env "BIND_PORT=8080" \
Expand Down Expand Up @@ -647,6 +647,6 @@ The Windows `agnhost` image includes a `nc` binary that is 100% compliant with i

## Image

The image can be found at `us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.11` for both Linux and
The image can be found at `us.gcr.io/k8s-artifacts-prod/e2e-test-images/agnhost:2.14` for both Linux and
Windows containers (based on `mcr.microsoft.com/windows/servercore:ltsc2019`,
`mcr.microsoft.com/windows/servercore:1903`, and `mcr.microsoft.com/windows/servercore:1909`).
2 changes: 1 addition & 1 deletion test/images/agnhost/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.13
2.14
2 changes: 1 addition & 1 deletion test/images/agnhost/agnhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import (
)

func main() {
rootCmd := &cobra.Command{Use: "app", Version: "2.13"}
rootCmd := &cobra.Command{Use: "app", Version: "2.14"}

rootCmd.AddCommand(auditproxy.CmdAuditProxy)
rootCmd.AddCommand(connect.CmdConnect)
Expand Down
2 changes: 2 additions & 0 deletions test/images/busybox/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
approvers:
- claudiubelu
5 changes: 5 additions & 0 deletions test/images/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ timeout: 5400s
# or any new substitutions added in the future.
options:
substitution_option: ALLOW_LOOSE
machineType: 'N1_HIGHCPU_8'
steps:
- name: 'gcr.io/k8s-testimages/gcb-docker-gcloud:v20190906-745fed4'
entrypoint: make
Expand All @@ -17,6 +18,10 @@ steps:
- BASE_REF=$_PULL_BASE_REF
- WHAT=$_WHAT
- REGISTRY=gcr.io/k8s-staging-e2e-test-images
- DOCKER_CERT_BASE_PATH=/root
- REMOTE_DOCKER_URL_1809=tcp://img-promoter-1809.eastus.cloudapp.azure.com:2376
- REMOTE_DOCKER_URL_1903=tcp://img-promoter-1903.eastus.cloudapp.azure.com:2376
- REMOTE_DOCKER_URL_1909=tcp://img-promoter-1909.eastus.cloudapp.azure.com:2376
# TODO(claudiub): Readd the REMOTE_DOCKER_URL_${os_version} to reenable the Windows test image building process.
args:
- all-build-and-push
Expand Down
22 changes: 11 additions & 11 deletions test/images/image-util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ set -o pipefail
TASK=$1
WHAT=$2

# Connecting to a Remote Docker requires certificates for authentication, which can be found
# at this path. By default, they can be found in the ${HOME} folder. We're expecting to find
# here ".docker-${os_version}" folders which contains the necessary certificates.
DOCKER_CERT_BASE_PATH="${DOCKER_CERT_BASE_PATH:-${HOME}}"

KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
source "${KUBE_ROOT}/hack/lib/logging.sh"
source "${KUBE_ROOT}/hack/lib/util.sh"
Expand Down Expand Up @@ -135,8 +140,8 @@ build() {
# The node requires TLS authentication, and thus it is expected that the
# ca.pem, cert.pem, key.pem files can be found in the ${HOME}/.docker-${os_version} folder.
# TODO(claudiub): add "build --isolation=hyperv" once GCE introduces Hyper-V support.
docker --tlsverify --tlscacert "${HOME}/.docker-${os_version}/ca.pem" \
--tlscert "${HOME}/.docker-${os_version}/cert.pem" --tlskey "${HOME}/.docker-${os_version}/key.pem" \
docker --tlsverify --tlscacert "${DOCKER_CERT_BASE_PATH}/.docker-${os_version}/ca.pem" \
--tlscert "${DOCKER_CERT_BASE_PATH}/.docker-${os_version}/cert.pem" --tlskey "${DOCKER_CERT_BASE_PATH}/.docker-${os_version}/key.pem" \
-H "${REMOTE_DOCKER_URL}" build --pull -t "${REGISTRY}/${image}:${TAG}-${os_name}-${arch}-${os_version}" \
--build-arg BASEIMAGE="${BASEIMAGE}" -f $dockerfile_name .
else
Expand Down Expand Up @@ -192,21 +197,16 @@ push() {
docker push "${REGISTRY}/${image}:${TAG}-${os_name}-${arch}"
elif [[ -n "${REMOTE_DOCKER_URL:-}" ]]; then
# NOTE(claudiub): We're pushing the image we built on the remote Windows node.
docker --tlsverify --tlscacert "${HOME}/.docker-${os_version}/ca.pem" \
--tlscert "${HOME}/.docker-${os_version}/cert.pem" --tlskey "${HOME}/.docker-${os_version}/key.pem" \
docker --tlsverify --tlscacert "${DOCKER_CERT_BASE_PATH}/.docker-${os_version}/ca.pem" \
--tlscert "${DOCKER_CERT_BASE_PATH}/.docker-${os_version}/cert.pem" --tlskey "${DOCKER_CERT_BASE_PATH}/.docker-${os_version}/key.pem" \
-H "${REMOTE_DOCKER_URL}" push "${REGISTRY}/${image}:${TAG}-${os_name}-${arch}-${os_version}"
else
echo "Cannot push the image '${image}' for ${os_arch}. REMOTE_DOCKER_URL_${os_version} should be set, containing the URL to a Windows docker daemon."
# we should exclude this image from the manifest list as well, we couldn't build / push it.
os_archs=$(printf "%s\n" "$os_archs" | grep -v "$os_arch" || true)
fi
done

# NOTE(claudiub): if the REMOTE_DOCKER_URL var is not set, or it is an empty string, we mustn't include
# Windows images into the manifest list.
if test -z "${REMOTE_DOCKER_URL:-}" && printf "%s\n" "$os_archs" | grep -q '^windows'; then
echo "Skipping pushing the image '${image}' for Windows. REMOTE_DOCKER_URL_\${os_version} should be set, containing the URL to a Windows docker daemon."
os_archs=$(printf "%s\n" "$os_archs" | grep -v "^windows" || true)
fi

if test -z "${os_archs}"; then
# this can happen for Windows-only images if they have been skipped entirely.
echo "No image for the manifest list. Skipping ${image}."
Expand Down
13 changes: 8 additions & 5 deletions test/images/kitten/BASEIMAGE
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
linux/amd64=REGISTRY/agnhost:2.13-linux-amd64
linux/arm=REGISTRY/agnhost:2.13-linux-arm
linux/arm64=REGISTRY/agnhost:2.13-linux-arm64
linux/ppc64le=REGISTRY/agnhost:2.13-linux-ppc64le
linux/s390x=REGISTRY/agnhost:2.13-linux-s390x
linux/amd64=REGISTRY/agnhost:2.14-linux-amd64
linux/arm=REGISTRY/agnhost:2.14-linux-arm
linux/arm64=REGISTRY/agnhost:2.14-linux-arm64
linux/ppc64le=REGISTRY/agnhost:2.14-linux-ppc64le
linux/s390x=REGISTRY/agnhost:2.14-linux-s390x
windows/amd64/1809=REGISTRY/agnhost:2.14-windows-amd64-1809
windows/amd64/1903=REGISTRY/agnhost:2.14-windows-amd64-1903
windows/amd64/1909=REGISTRY/agnhost:2.14-windows-amd64-1909
1 change: 1 addition & 0 deletions test/images/kitten/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ ARG BASEIMAGE
FROM $BASEIMAGE
COPY html/kitten.jpg kitten.jpg
COPY html/data.json data.json
CMD ["test-webserver"]
3 changes: 3 additions & 0 deletions test/images/kitten/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
approvers:
- claudiubelu
- mkumatag
13 changes: 8 additions & 5 deletions test/images/nautilus/BASEIMAGE
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
linux/amd64=REGISTRY/agnhost:2.13-linux-amd64
linux/arm=REGISTRY/agnhost:2.13-linux-arm
linux/arm64=REGISTRY/agnhost:2.13-linux-arm64
linux/ppc64le=REGISTRY/agnhost:2.13-linux-ppc64le
linux/s390x=REGISTRY/agnhost:2.13-linux-s390x
linux/amd64=REGISTRY/agnhost:2.14-linux-amd64
linux/arm=REGISTRY/agnhost:2.14-linux-arm
linux/arm64=REGISTRY/agnhost:2.14-linux-arm64
linux/ppc64le=REGISTRY/agnhost:2.14-linux-ppc64le
linux/s390x=REGISTRY/agnhost:2.14-linux-s390x
windows/amd64/1809=REGISTRY/agnhost:2.14-windows-amd64-1809
windows/amd64/1903=REGISTRY/agnhost:2.14-windows-amd64-1903
windows/amd64/1909=REGISTRY/agnhost:2.14-windows-amd64-1909
1 change: 1 addition & 0 deletions test/images/nautilus/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ ARG BASEIMAGE
FROM $BASEIMAGE
COPY html/nautilus.jpg nautilus.jpg
COPY html/data.json data.json
CMD ["test-webserver"]
3 changes: 3 additions & 0 deletions test/images/nautilus/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
approvers:
- claudiubelu
- mkumatag