Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
137134: build: publish build metadata as a part of Make and Publish Build r=celiala a=rail

We already publish the build metadata as a part of release qualification. Sometimes we need this information before the qualification test is finished.

Let's publish this metadata as a part of Make and Publish build as well, but to a different location, so we can distinguish them.

Fixes: cockroachdb#137109
Release note: None

Co-authored-by: Rail Aliiev <[email protected]>
  • Loading branch information
craig[bot] and rail committed Dec 10, 2024
2 parents 46e8e0f + 8a55611 commit a3957e4
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,22 @@ if [[ -z "${DRY_RUN}" ]]; then
# Used for docker login for gcloud
gcr_hostname="us-docker.pkg.dev"
gcs_bucket="cockroach-builds-artifacts-prod"
metadata_gcs_bucket="cockroach-release-qualification-prod"
metadata_google_credentials=$GCS_CREDENTIALS_PROD
else
gcs_bucket="cockroach-customized-builds-artifacts-prod"
gcr_repository="us-docker.pkg.dev/cockroach-cloud-images/cockroachdb-customized/cockroach-customized"
metadata_gcs_bucket="cockroach-release-qualification-test"
metadata_google_credentials=$GCS_CREDENTIALS_DEV
fi
else
gcs_bucket="cockroach-builds-artifacts-dryrun"
google_credentials="$GOOGLE_COCKROACH_RELEASE_CREDENTIALS"
gcr_repository="us.gcr.io/cockroach-release/cockroach-test"
build_name="${build_name}.dryrun"
gcr_hostname="us.gcr.io"
metadata_gcs_bucket="cockroach-release-qualification-test"
metadata_google_credentials=$GCS_CREDENTIALS_DEV
fi

cat << EOF
Expand Down Expand Up @@ -112,3 +118,22 @@ if [[ -n "${is_customized_build}" ]] ; then
git_wrapped push ssh://[email protected]/cockroachdb/cockroach.git --delete "${TC_BUILD_BRANCH}"
tc_end_block "Delete custombuild tag"
fi

# Publish build metadata to a stable location.
tc_start_block "Metadata"
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
metadata_file="artifacts/metadata.json"
mkdir -p artifacts
cat > "$metadata_file" << EOF
{
"sha": "$BUILD_VCS_NUMBER",
"timestamp": "$timestamp",
"tag": "$build_name"
}
EOF
# Run jq to pretty print and validate JSON
jq . "$metadata_file"
google_credentials=$metadata_google_credentials log_into_gcloud
gsutil cp "$metadata_file" "gs://$metadata_gcs_bucket/builds/$BUILD_VCS_NUMBER.json"
echo "Published to https://storage.googleapis.com/$metadata_gcs_bucket/builds/$BUILD_VCS_NUMBER.json"
tc_end_block "Metadata"

0 comments on commit a3957e4

Please sign in to comment.