Skip to content

cloudbuild: fix epoch dating on staged image tags #15

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

Conversation

BlaineEXE
Copy link
Contributor

Using gcloud container images add-tag to add tags to images built and pushed to GCR was resulting in the added tags having a date of Dec. 31, 1969 (the epoch). In order to avoid tags having epoch dates, adjust the cloudbuild script to use --tag arguments for each tag.

I did a dry run of this, and I think everything looks right

GIT_TAG: hash-v0.2.0-stuff
PULL_BASE_REF: v0.2.0
PLATFORM: linux/amd64,linux/arm64
+ REPO=gcr.io/k8s-staging-sig-storage
+ CONTROLLER_IMAGE=gcr.io/k8s-staging-sig-storage/objectstorage-controller
+ SIDECAR_IMAGE=gcr.io/k8s-staging-sig-storage/objectstorage-sidecar
+ export DOCKER=/buildx-entrypoint
+ DOCKER=/buildx-entrypoint
+ export PLATFORM
+ export SIDECAR_TAG=gcr.io/k8s-staging-sig-storage/objectstorage-sidecar:hash-v0.2.0-stuff
+ SIDECAR_TAG=gcr.io/k8s-staging-sig-storage/objectstorage-sidecar:hash-v0.2.0-stuff
+ export CONTROLLER_TAG=gcr.io/k8s-staging-sig-storage/objectstorage-controller:hash-v0.2.0-stuff
+ CONTROLLER_TAG=gcr.io/k8s-staging-sig-storage/objectstorage-controller:hash-v0.2.0-stuff
+ ADDITIONAL_BUILD_ARGS=--push
+ ADDITIONAL_CONTROLLER_TAGS=()
+ ADDITIONAL_SIDECAR_TAGS=()
+ [[ v0.2.0 == main ]]
+ [[ v0.2.0 == release-* ]]
+ [[ v0.2.0 == controller/* ]]
+ [[ v0.2.0 == sidecar/* ]]
+ [[ v0.2.0 == \v\0\.* ]]
+ echo ' ! ! ! this is a tagged controller + sidecar release ! ! !'
 ! ! ! this is a tagged controller + sidecar release ! ! !
+ TAG=v0.2.0
+ ADDITIONAL_CONTROLLER_TAGS+=("${CONTROLLER_IMAGE}:${TAG}")
+ ADDITIONAL_SIDECAR_TAGS+=("${SIDECAR_IMAGE}:${TAG}")
+ BUILD_ARGS=--push
+ for tag in "${ADDITIONAL_CONTROLLER_TAGS[@]}"
+ BUILD_ARGS='--push --tag=gcr.io/k8s-staging-sig-storage/objectstorage-controller:v0.2.0'
+ export BUILD_ARGS
+ echo make build.controller
make build.controller
+ BUILD_ARGS=--push
+ for tag in "${ADDITIONAL_SIDECAR_TAGS[@]}"
+ BUILD_ARGS='--push --tag=gcr.io/k8s-staging-sig-storage/objectstorage-sidecar:v0.2.0'
+ export BUILD_ARGS
+ echo make build.sidecar
make build.sidecar

Using `gcloud container images add-tag` to add tags to images built and
pushed to GCR was resulting in the added tags having a date of Dec. 31,
1969 (the epoch). In order to avoid tags having epoch dates, adjust the
cloudbuild script to use `--tag` arguments for each tag.

Signed-off-by: Blaine Gardner <[email protected]>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 6, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BlaineEXE

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 6, 2025
@xing-yang
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 6, 2025
@k8s-ci-robot k8s-ci-robot merged commit a70bf11 into kubernetes-sigs:main Feb 6, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants