-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Build image with ko #2955
Build image with ko #2955
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2022 The Kubernetes Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
if ! command -v ko &> /dev/null; then | ||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1 | ||
go install github.com/google/ko@v0.12.0 | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,8 +153,6 @@ spec: | |
value: "{{ $value }}" | ||
{{- end }} | ||
{{- end }} | ||
command: | ||
- /controller | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a standard entrypoint for ko built container images? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. See the last sentence of https://ko.build/get-started There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. The entrypoint change will introduce backwards incompatibility with the existing manifests, we will release note it. |
||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 10 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,21 +72,7 @@ build_push_controller_image() { | |
fi | ||
|
||
echo "build and push docker image ${CONTROLLER_IMAGE_NAME}" | ||
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx create --use | ||
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx inspect --bootstrap | ||
|
||
# TODO: the first buildx build sometimes fails on new created builder instance. | ||
# figure out why and remove this retry. | ||
n=0 | ||
until [ "$n" -ge 2 ]; do | ||
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build . --target bin \ | ||
--tag "${CONTROLLER_IMAGE_NAME}" \ | ||
--push \ | ||
--progress plain \ | ||
--platform linux/amd64 && break | ||
n=$((n + 1)) | ||
sleep 2 | ||
done | ||
make docker-push IMG=${CONTROLLER_IMAGE_NAME} IMG_PLATFORM=linux/amd64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would this not affect the multi-arch tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old code specified |
||
|
||
if [[ $? -ne 0 ]]; then | ||
echo "unable to build and push docker image" >&2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It failed for me with the following error:
I was able to install v0.11.2 and run the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're apparently not the first to run across this. I found go-openapi/analysis#81
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed ko-build/ko#940
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I back off to v0.11.2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets back off to v0.11.2, we can update in future