Skip to content

Commit c061a3e

Browse files
[releases] Remove staging/prod deploys from cloud_build_release (#1312)
Summary: TSIA Type of change: /kind cleanup Test Plan: N/A removing stale code. Signed-off-by: James Bartlett <jamesbartlett@pixielabs.ai>
1 parent 8fe1a49 commit c061a3e

2 files changed

Lines changed: 29 additions & 67 deletions

File tree

.github/workflows/cloud_release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
export ARTIFACTS_DIR="$(pwd)/artifacts"
4545
mkdir -p "${ARTIFACTS_DIR}"
4646
./ci/save_version_info.sh
47-
./ci/cloud_build_release.sh -p
47+
./ci/cloud_build_release.sh
4848
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
4949
with:
5050
name: cloud-artifacts

ci/cloud_build_release.sh

Lines changed: 28 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,6 @@
1919
set -ex
2020
printenv
2121

22-
usage() {
23-
echo "Usage: $0 [-p]"
24-
echo " -p : Create a public cloud release."
25-
}
26-
27-
parse_args() {
28-
while test $# -gt 0; do
29-
case "$1" in
30-
-p) PUBLIC=true
31-
shift
32-
;;
33-
*) usage ;;
34-
esac
35-
done
36-
}
37-
38-
parse_args "$@"
39-
4022
artifacts_dir="${ARTIFACTS_DIR:?}"
4123

4224
repo_path=$(pwd)
@@ -50,61 +32,41 @@ fi
5032

5133
echo "The image tag is: ${release_tag}"
5234

53-
# We are building the OSS images/YAMLs. In this case, we only want to push the images but not deploy the YAMLs.
54-
if [[ "$PUBLIC" == "true" ]]; then
55-
bazel run --config=stamp -c opt --action_env=GOOGLE_APPLICATION_CREDENTIALS --//k8s:image_version="${release_tag}" \
56-
--//k8s:build_type=public //k8s/cloud:cloud_images_push
57-
58-
all_licenses_opts=("//tools/licenses:all_licenses" "--action_env=GOOGLE_APPLICATION_CREDENTIALS" "--remote_download_outputs=toplevel")
59-
all_licenses_path="$(bazel cquery "${all_licenses_opts[@]}" --output starlark --starlark:expr "target.files.to_list()[0].path" 2> /dev/null)"
60-
bazel build "${all_licenses_opts[@]}"
61-
62-
gsutil cp "${all_licenses_path}" "gs://pixie-dev-public/oss-licenses/${release_tag}.json"
63-
if [[ "${release}" == "true" ]]; then
64-
gsutil cp "${all_licenses_path}" "gs://pixie-dev-public/oss-licenses/latest.json"
65-
fi
66-
67-
# Write YAMLs + image paths to a tar file to support easy deployment.
68-
mkdir -p "${repo_path}/pixie_cloud/yamls"
69-
image_list_file="${repo_path}/pixie_cloud/cloud_image_list.txt"
70-
71-
kustomize build "k8s/cloud_deps/public/" > "${repo_path}/pixie_cloud/yamls/cloud_deps.yaml"
72-
kustomize build "k8s/cloud_deps/base/elastic/operator" > "${repo_path}/pixie_cloud/yamls/cloud_deps_elastic_operator.yaml"
73-
kustomize build "k8s/cloud/public/" > "${repo_path}/pixie_cloud/yamls/cloud.yaml"
35+
bazel run --config=stamp -c opt --action_env=GOOGLE_APPLICATION_CREDENTIALS --//k8s:image_version="${release_tag}" \
36+
--//k8s:build_type=public //k8s/cloud:cloud_images_push
7437

75-
deploy_yamls=(
76-
"${repo_path}/pixie_cloud/yamls/cloud_deps.yaml"
77-
"${repo_path}/pixie_cloud/yamls/cloud_deps_elastic_operator.yaml"
78-
"${repo_path}/pixie_cloud/yamls/cloud.yaml"
79-
)
38+
all_licenses_opts=("//tools/licenses:all_licenses" "--action_env=GOOGLE_APPLICATION_CREDENTIALS" "--remote_download_outputs=toplevel")
39+
all_licenses_path="$(bazel cquery "${all_licenses_opts[@]}" --output starlark --starlark:expr "target.files.to_list()[0].path" 2> /dev/null)"
40+
bazel build "${all_licenses_opts[@]}"
8041

81-
bazel run @com_github_mikefarah_yq_v4//:v4 -- '..|.image?|select(.|type == "!!str")' -o=json "${deploy_yamls[@]}" | sort | uniq > "${image_list_file}"
42+
gsutil cp "${all_licenses_path}" "gs://pixie-dev-public/oss-licenses/${release_tag}.json"
43+
if [[ "${release}" == "true" ]]; then
44+
gsutil cp "${all_licenses_path}" "gs://pixie-dev-public/oss-licenses/latest.json"
45+
fi
8246

83-
cd "${repo_path}"
84-
tar -czvf "${repo_path}/pixie_cloud.tar.gz" "pixie_cloud"
85-
gsutil cp "${repo_path}/pixie_cloud.tar.gz" "gs://pixie-dev-public/cloud/${release_tag}/pixie_cloud.tar.gz"
86-
if [[ "${release}" == "true" ]]; then
87-
gsutil cp "${repo_path}/pixie_cloud.tar.gz" "gs://pixie-dev-public/cloud/latest/pixie_cloud.tar.gz"
88-
fi
47+
# Write YAMLs + image paths to a tar file to support easy deployment.
48+
mkdir -p "${repo_path}/pixie_cloud/yamls"
49+
image_list_file="${repo_path}/pixie_cloud/cloud_image_list.txt"
8950

90-
sha256sum "${repo_path}/pixie_cloud.tar.gz" | awk '{print $1}' > sha
91-
cp "${repo_path}/pixie_cloud.tar.gz" "${artifacts_dir}/pixie_cloud.tar.gz"
92-
cp sha "${artifacts_dir}/pixie_cloud.tar.gz.sha256"
51+
kustomize build "k8s/cloud_deps/public/" > "${repo_path}/pixie_cloud/yamls/cloud_deps.yaml"
52+
kustomize build "k8s/cloud_deps/base/elastic/operator" > "${repo_path}/pixie_cloud/yamls/cloud_deps_elastic_operator.yaml"
53+
kustomize build "k8s/cloud/public/" > "${repo_path}/pixie_cloud/yamls/cloud.yaml"
9354

94-
exit 0
95-
fi
55+
deploy_yamls=(
56+
"${repo_path}/pixie_cloud/yamls/cloud_deps.yaml"
57+
"${repo_path}/pixie_cloud/yamls/cloud_deps_elastic_operator.yaml"
58+
"${repo_path}/pixie_cloud/yamls/cloud.yaml"
59+
)
9660

97-
bazel run --config=stamp -c opt --action_env=GOOGLE_APPLICATION_CREDENTIALS --//k8s:image_version="${release_tag}" \
98-
--//k8s:build_type=proprietary //k8s/cloud:cloud_images_push
61+
bazel run @com_github_mikefarah_yq_v4//:v4 -- '..|.image?|select(.|type == "!!str")' -o=json "${deploy_yamls[@]}" | sort | uniq > "${image_list_file}"
9962

100-
yaml_path="${repo_path}/bazel-bin/k8s/cloud/pixie_staging_cloud.yaml"
63+
cd "${repo_path}"
64+
tar -czvf "${repo_path}/pixie_cloud.tar.gz" "pixie_cloud"
65+
gsutil cp "${repo_path}/pixie_cloud.tar.gz" "gs://pixie-dev-public/cloud/${release_tag}/pixie_cloud.tar.gz"
10166
if [[ "${release}" == "true" ]]; then
102-
# Build prod YAMLs.
103-
yaml_path="${repo_path}/bazel-bin/k8s/cloud/pixie_prod_cloud.yaml"
104-
bazel build --config=stamp -c opt --//k8s:image_version="${release_tag}" //k8s/cloud:pixie_prod_cloud
105-
else
106-
# Build staging YAMLs.
107-
bazel build --config=stamp -c opt --//k8s:image_version="${release_tag}" //k8s/cloud:pixie_staging_cloud
67+
gsutil cp "${repo_path}/pixie_cloud.tar.gz" "gs://pixie-dev-public/cloud/latest/pixie_cloud.tar.gz"
10868
fi
10969

110-
kubectl apply -f "$yaml_path"
70+
sha256sum "${repo_path}/pixie_cloud.tar.gz" | awk '{print $1}' > sha
71+
cp "${repo_path}/pixie_cloud.tar.gz" "${artifacts_dir}/pixie_cloud.tar.gz"
72+
cp sha "${artifacts_dir}/pixie_cloud.tar.gz.sha256"

0 commit comments

Comments
 (0)