diff --git a/ci/vizier_build_release.sh b/ci/vizier_build_release.sh index da7c404fed9..e8c4af3cc99 100755 --- a/ci/vizier_build_release.sh +++ b/ci/vizier_build_release.sh @@ -31,17 +31,28 @@ bazel run -c opt //src/utils/artifacts/versions_gen:versions_gen -- \ public="True" bucket="pixie-dev-public" +extra_bazel_args=() if [[ $release_tag == *"-"* ]]; then public="False" bucket="pixie-prod-artifacts" fi +if [[ -n $DEV_ARTIFACT_BUCKET ]]; then + public="False" + bucket="${DEV_ARTIFACT_BUCKET}" + if [[ -z $DEV_IMAGE_PREFIX ]]; then + echo "Must specify DEV_IMAGE_PREFIX, when specifying a dev release with DEV_ARTIFACT_BUCKET" + exit 1 + fi + extra_bazel_args+=("--define" "DEV_VIZIER_IMAGE_PREFIX=${DEV_IMAGE_PREFIX}") + extra_bazel_args+=("--//k8s/vizier:use_dev_vizier_images") +fi output_path="gs://${bucket}/vizier/${release_tag}" bazel run --stamp -c opt --define BUNDLE_VERSION="${release_tag}" \ - --stamp --define public="${public}" //k8s/vizier:vizier_images_push + --stamp --define public="${public}" //k8s/vizier:vizier_images_push "${extra_bazel_args[@]}" bazel build --stamp -c opt --define BUNDLE_VERSION="${release_tag}" \ - --stamp --define public="${public}" //k8s/vizier:vizier_yamls + --stamp --define public="${public}" //k8s/vizier:vizier_yamls "${extra_bazel_args[@]}" output_path="gs://${bucket}/vizier/${release_tag}" yamls_tar="${repo_path}/bazel-bin/k8s/vizier/vizier_yamls.tar" diff --git a/k8s/vizier/BUILD.bazel b/k8s/vizier/BUILD.bazel index 8effe5fb473..0bda57a4a81 100644 --- a/k8s/vizier/BUILD.bazel +++ b/k8s/vizier/BUILD.bazel @@ -14,6 +14,7 @@ # # SPDX-License-Identifier: Apache-2.0 +load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") load("@io_bazel_rules_docker//container:container.bzl", "container_bundle") load("@io_bazel_rules_docker//contrib:push-all.bzl", "container_push") @@ -33,6 +34,8 @@ VIZIER_IMAGE_MAP = { public_image_replacement = {"gcr.io/pixie-oss/pixie-dev": "gcr.io/pixie-oss/pixie-prod"} +dev_image_replacement = {"gcr.io/pixie-oss/pixie-dev": "$(DEV_VIZIER_IMAGE_PREFIX)"} + generate_vizier_yamls( name = "public_vizier_etcd_metadata_prod", srcs = glob(["**/*.yaml"]), @@ -49,6 +52,14 @@ generate_vizier_yamls( replace = {}, ) +generate_vizier_yamls( + name = "vizier_etcd_metadata_dev", + srcs = glob(["**/*.yaml"]), + out = "vizier_etcd_metadata_dev.yaml", + image_map = VIZIER_IMAGE_MAP, + replace = dev_image_replacement, +) + generate_vizier_metadata_persist_yamls( name = "public_vizier_metadata_persist_prod", srcs = glob(["**/*.yaml"]), @@ -65,6 +76,14 @@ generate_vizier_metadata_persist_yamls( replace = {}, ) +generate_vizier_metadata_persist_yamls( + name = "vizier_metadata_persist_dev", + srcs = glob(["**/*.yaml"]), + out = "vizier_metadata_persist_dev.yaml", + image_map = VIZIER_IMAGE_MAP, + replace = dev_image_replacement, +) + container_bundle( name = "private_vizier_images_bundle", images = image_map_with_bundle_version( @@ -83,15 +102,35 @@ container_bundle( ), ) +container_bundle( + name = "dev_vizier_images_bundle", + images = image_map_with_bundle_version( + image_map = VIZIER_IMAGE_MAP, + replace = dev_image_replacement, + tag_latest = False, + ), +) + container_push( name = "vizier_images_push", bundle = select({ + ":dev": ":dev_vizier_images_bundle", ":public": ":public_vizier_images_bundle", "//conditions:default": ":private_vizier_images_bundle", }), format = "Docker", ) +bool_flag( + name = "use_dev_vizier_images", + build_setting_default = False, +) + +config_setting( + name = "dev", + flag_values = {":use_dev_vizier_images": "True"}, +) + config_setting( name = "public", values = {"define": "public=True"}, @@ -101,6 +140,10 @@ pkg_tar( name = "vizier_yamls", srcs = select({ + ":dev": [ + "//k8s/vizier:vizier_etcd_metadata_dev.yaml", + "//k8s/vizier:vizier_metadata_persist_dev.yaml", + ], ":public": [ "//k8s/vizier:public_vizier_etcd_metadata_prod.yaml", "//k8s/vizier:public_vizier_metadata_persist_prod.yaml", @@ -119,6 +162,8 @@ pkg_tar( "/vizier/private_vizier_metadata_persist_prod.yaml": "vizier/vizier_metadata_persist_prod.yaml", "/vizier/public_vizier_etcd_metadata_prod.yaml": "vizier/vizier_etcd_metadata_prod.yaml", "/vizier/public_vizier_metadata_persist_prod.yaml": "vizier/vizier_metadata_persist_prod.yaml", + "/vizier/vizier_etcd_metadata_dev.yaml": "vizier/vizier_etcd_metadata_prod.yaml", + "/vizier/vizier_metadata_persist_dev.yaml": "vizier/vizier_metadata_persist_prod.yaml", }, strip_prefix = "/k8s", )