From 7438040ea9c9ff641072089b185c56e04da2b9b1 Mon Sep 17 00:00:00 2001 From: Michelle Nguyen Date: Mon, 11 Jul 2022 18:03:16 -0700 Subject: [PATCH] Tar cloud YAMLs in cloud build release Summary: We want to build a tar of the public cloud YAMLs + a list of the image tags to: - Make it easier to deploy cloud without requiring kustomize - Make it easier to deploy cloud in an air-gapped environment Test Plan: Run the jenkins job, check the generated files: https://storage.googleapis.com/pixie-dev-public/cloud/latest/pixie_cloud.tar.gz Reviewers: vihang Reviewed By: vihang Signed-off-by: Michelle Nguyen Differential Revision: https://phab.corp.pixielabs.ai/D11792 GitOrigin-RevId: 428c924b5d2b52adb60ddb5c84efe9330ec38c44 --- ci/cloud_build_release.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ci/cloud_build_release.sh b/ci/cloud_build_release.sh index dab22467c8d..0f7ca6ab3ce 100755 --- a/ci/cloud_build_release.sh +++ b/ci/cloud_build_release.sh @@ -66,6 +66,27 @@ if [[ "$PUBLIC" == "true" ]]; then //src/cloud/plugin/load_db:push_plugin_db_updater_image bazel run --stamp -c opt --action_env=GOOGLE_APPLICATION_CREDENTIALS --define BUNDLE_VERSION="latest" \ //src/cloud/plugin/load_db:push_plugin_db_updater_image + + # Write YAMLs + image paths to a tar file to support easy deployment. + mkdir -p "${repo_path}/pixie_cloud" + mkdir -p "${repo_path}/pixie_cloud/yamls" + image_list_file="${repo_path}/pixie_cloud/cloud_image_list.txt" + + kustomize build "k8s/cloud_deps/public/" > "${repo_path}/pixie_cloud/yamls/cloud_deps.yaml" + echo "---" >> "${repo_path}/pixie_cloud/yamls/cloud_deps.yaml" + kustomize build "k8s/cloud_deps/base/elastic/operator" >> "${repo_path}/pixie_cloud/yamls/cloud_deps.yaml" + kustomize build "k8s/cloud/public/" > "${repo_path}/pixie_cloud/yamls/cloud.yaml" + + #shellcheck disable=SC2002 + cat "${repo_path}/pixie_cloud/yamls/cloud_deps.yaml" | yq e '.. | .image? | select(.)' -o=json - | jq 'strings' | sort | uniq > "${image_list_file}" + #shellcheck disable=SC2002 + cat "${repo_path}/pixie_cloud/yamls/cloud.yaml" | yq e '.. | .image? | select(.)' -o=json - | jq 'strings' | sort | uniq >> "${image_list_file}" + + cd "${repo_path}" + tar -czvf "${repo_path}/pixie_cloud.tar.gz" "pixie_cloud" + gsutil cp "${repo_path}/pixie_cloud.tar.gz" "gs://pixie-dev-public/cloud/${image_tag}/pixie_cloud.tar.gz" + gsutil cp "${repo_path}/pixie_cloud.tar.gz" "gs://pixie-dev-public/cloud/latest/pixie_cloud.tar.gz" + exit 0 fi