Skip to content

kube-cross: Fix image pushing job failures #1202

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

Merged
merged 2 commits into from
Mar 22, 2020
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
20 changes: 10 additions & 10 deletions images/build/cross/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ STAGING_REGISTRY?=gcr.io/k8s-staging-build-image
PROD_REGISTRY?=us.gcr.io/k8s-artifacts-prod/build-image
IMAGE=kube-cross

TAG?=kubernetes-$(shell git describe --tags --match='v*' --abbrev=14)
KUBE_CROSS_VERSION=$(shell cat VERSION)
TAG?=$(shell git describe --tags --always --dirty)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably leave --abbrev=14 in

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise the sha suffix will not be of the same length everytime

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately, the tag we care about here is VERSION; TAG is more of a sanity check so we have an idea of what we're promoting compared to VERSION.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll know soon enough if something breaks i guess

VERSION=$(shell cat VERSION)
# TODO: Support multi-arch kube-cross images
# ref:
# - https://github.com/kubernetes/release/pull/1140/commits/e96924f58d9ce2bb73045fbba13f259b4345c0d9#r395056830
Expand All @@ -32,16 +32,16 @@ all: build push
build:
docker build \
-t $(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(TAG) \
-t $(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(KUBE_CROSS_VERSION) \
-t $(PROD_REGISTRY)/$(IMAGE)-$(ARCH):$(KUBE_CROSS_VERSION) \
-t $(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(VERSION) \
-t $(PROD_REGISTRY)/$(IMAGE)-$(ARCH):$(VERSION) \
.

push:
docker push $(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(TAG)
docker push $(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(KUBE_CROSS_VERSION)
docker manifest create --amend $(STAGING_REGISTRY)/$(IMAGE):$(KUBE_CROSS_VERSION) \
$(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(KUBE_CROSS_VERSION)
docker manifest annotate $(STAGING_REGISTRY)/$(IMAGE):$(KUBE_CROSS_VERSION) \
$(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(KUBE_CROSS_VERSION) \
docker push $(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(VERSION)
docker manifest create --amend $(STAGING_REGISTRY)/$(IMAGE):$(VERSION) \
$(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(VERSION)
docker manifest annotate $(STAGING_REGISTRY)/$(IMAGE):$(VERSION) \
$(STAGING_REGISTRY)/$(IMAGE)-$(ARCH):$(VERSION) \
--arch $(ARCH)
docker manifest push -p $(STAGING_REGISTRY)/$(IMAGE):$(KUBE_CROSS_VERSION)
docker manifest push -p $(STAGING_REGISTRY)/$(IMAGE):$(VERSION)
2 changes: 1 addition & 1 deletion images/build/cross/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.13.9-1
v1.13.9-2
9 changes: 7 additions & 2 deletions images/build/cross/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ steps:
entrypoint: make
env:
- DOCKER_CLI_EXPERIMENTAL=enabled
- TAG=$_GIT_TAG
- PULL_BASE_REF=$_PULL_BASE_REF
args:
- all
images:
- 'gcr.io/$PROJECT_ID/kube-cross:kubernetes-${_GIT_TAG}'
substitutions:
# _GIT_TAG will be filled with a git-based tag for the image, of the form vYYYYMMDD-hash, and
# can be used as a substitution
_GIT_TAG: '12345'
_PULL_BASE_REF: 'dev'