This repository was archived by the owner on Dec 6, 2024. It is now read-only.
generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 29
set up new release tooling for controller/sidecar subrepos #97
Merged
k8s-ci-robot
merged 1 commit into
kubernetes-retired:monorepo
from
BlaineEXE:cloudbuild
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# K8s infra build example: https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md | ||
# GCloud build docs: https://cloud.google.com/cloud-build/docs/build-config | ||
# Builds go to https://console.cloud.google.com/gcr/images/k8s-staging-sig-storage/GLOBAL | ||
# Build logs in https://testgrid.k8s.io/sig-storage-image-build | ||
timeout: 3600s | ||
options: | ||
substitution_option: 'ALLOW_LOOSE' | ||
machineType: 'E2_HIGHCPU_8' | ||
substitutions: | ||
# K8s provides custom substitutions _GIT_TAG and _PULL_BASE_REF: | ||
# https://github.com/kubernetes/test-infra/blob/master/config/jobs/image-pushing/README.md#custom-substitutions | ||
_GIT_TAG: '12345' # e.g., vYYYYMMDD-hash, vYYYYMMDD-tag, or vYYYYMMDD-tag-n-ghash | ||
_PULL_BASE_REF: 'master' # e.g., master or release-0.2 for a PR merge, or v0.2 for a tag | ||
# COSI substitutions: | ||
_PLATFORMS: linux/amd64,linux/arm64 # add more platforms here if desired | ||
steps: | ||
# TODO: currently gcr.io/k8s-testimages/gcb-docker-gcloud has not moved to Artifact Registry | ||
# gcr.io will be shut down 18 Mar 2025, and we need replacement before then. Latest info below: | ||
# https://github.com/kubernetes/test-infra/blob/master/images/gcb-docker-gcloud/cloudbuild.yaml | ||
- id: do-multi-arch-build-all-images | ||
name: gcr.io/k8s-testimages/gcb-docker-gcloud:v20240718-5ef92b5c36 | ||
args: | ||
- hack/cloudbuild.sh | ||
env: | ||
- GIT_TAG=$_GIT_TAG | ||
- PULL_BASE_REF=$_PULL_BASE_REF | ||
- PLATFORM=$_PLATFORMS |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
set -o errexit | ||
set -o nounset | ||
|
||
# with nounset, these will fail if necessary vars are missing | ||
echo "GIT_TAG: ${GIT_TAG}" | ||
echo "PULL_BASE_REF: ${PULL_BASE_REF}" | ||
echo "PLATFORM: ${PLATFORM}" | ||
|
||
# debug the rest of the script in case of image/CI build issues | ||
set -o xtrace | ||
|
||
REPO="gcr.io/k8s-staging-sig-storage" | ||
|
||
CONTROLLER_IMAGE="${REPO}/objectstorage-controller" | ||
SIDECAR_IMAGE="${REPO}/objectstorage-sidecar" | ||
|
||
# args to 'make build' | ||
export DOCKER="/buildx-entrypoint" # available in gcr.io/k8s-testimages/gcb-docker-gcloud image | ||
export BUILD_ARGS="--push" | ||
export PLATFORM | ||
export SIDECAR_TAG="${SIDECAR_IMAGE}:${GIT_TAG}" | ||
export CONTROLLER_TAG="${CONTROLLER_IMAGE}:${GIT_TAG}" | ||
|
||
# build in parallel | ||
make --jobs --output-sync build | ||
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 any benefit for multiprocessing here? 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. In my local testing, this increases the build speed, but it isn't significant. Maybe a 20-30% improvement. I am also testing on macos where the linux native tools don't run as efficiently. It would be hard to guess whether the improvement on the linux build environments would be more or less impactful. |
||
|
||
# add latest tag to just-built images | ||
gcloud container images add-tag "${CONTROLLER_TAG}" "${CONTROLLER_IMAGE}:latest" | ||
gcloud container images add-tag "${SIDECAR_TAG}" "${SIDECAR_IMAGE}:latest" | ||
|
||
# PULL_BASE_REF is 'controller/TAG' for a controller release | ||
if [[ "${PULL_BASE_REF}" == controller/* ]]; then | ||
echo " ! ! ! this is a tagged controller release ! ! !" | ||
TAG="${PULL_BASE_REF#controller/*}" | ||
gcloud container images add-tag "${CONTROLLER_TAG}" "${CONTROLLER_IMAGE}:${TAG}" | ||
fi | ||
|
||
# PULL_BASE_REF is 'sidecar/TAG' for a controller release | ||
if [[ "${PULL_BASE_REF}" == sidecar/* ]]; then | ||
echo " ! ! ! this is a tagged sidecar release ! ! !" | ||
TAG="${PULL_BASE_REF#sidecar/*}" | ||
gcloud container images add-tag "${SIDECAR_TAG}" "${SIDECAR_IMAGE}:${TAG}" | ||
fi | ||
|
||
# else, PULL_BASE_REF is a branch name (e.g., master, release-0.2) or a tag (e.g., client/v0.2.0, proto/v0.2.0) |
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Maybe just leave it as an empty string?
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.
This is copy-pasted from the previous cloudbuild files -- copy-pasted from an example that I found in some docs. I don't know exactly why, but IIRC it was in the example file as well, so it seemed like it might have some use for testing/validation.