Skip to content

Commit

Permalink
Fix some shellcheck issues
Browse files Browse the repository at this point in the history
Summary:
There were some shellcheck ignores that should have been addressed.
Also cleanup the shell cmds in some genrules.

Test Plan: Ran the rules, ensured that the output was correct.

Reviewers: michelle, zasgar

Reviewed By: michelle

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

Differential Revision: https://phab.corp.pixielabs.ai/D12885

GitOrigin-RevId: acebfb7d14986be9057a06dcc4c7a56c738f76c3
  • Loading branch information
vihangm authored and copybaranaut committed Jan 21, 2023
1 parent 4dff708 commit f9c6e19
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
16 changes: 8 additions & 8 deletions ci/cloud_build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ if [[ "$PUBLIC" == "true" ]]; then
gsutil cp "${repo_path}/bazel-bin/tools/licenses/all_licenses.json" "gs://pixie-dev-public/oss-licenses/latest.json"

# 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"
kustomize build "k8s/cloud_deps/base/elastic/operator" >> "${repo_path}/pixie_cloud/yamls/cloud_deps_elastic_operator.yaml"
kustomize build "k8s/cloud_deps/base/elastic/operator" > "${repo_path}/pixie_cloud/yamls/cloud_deps_elastic_operator.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_deps_elastic_operator.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}"
deploy_yamls=(
"${repo_path}/pixie_cloud/yamls/cloud_deps.yaml"
"${repo_path}/pixie_cloud/yamls/cloud_deps_elastic_operator.yaml"
"${repo_path}/pixie_cloud/yamls/cloud.yaml"
)

yq e '.. | .image? | select(.)' -o=json "${deploy_yamls[@]}" | jq 'strings' | sort | uniq > "${image_list_file}"

cd "${repo_path}"
tar -czvf "${repo_path}/pixie_cloud.tar.gz" "pixie_cloud"
Expand Down
3 changes: 1 addition & 2 deletions ci/operator_helm_build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ version: ${VERSION}" > "${helm_path}/Chart.yaml"
cp "${repo_path}/k8s/operator/crd/base/px.dev_viziers.yaml" "${helm_path}/crds/vizier_crd.yaml"

# Updates templates with Helm-specific template functions.
#shellcheck disable=SC2016,SC2086
helm_tmpl_checks="$(cat ${repo_path}/k8s/operator/helm/olm_template_checks.tmpl)"
helm_tmpl_checks="$(cat "${repo_path}/k8s/operator/helm/olm_template_checks.tmpl")"
sed -i "1c${helm_tmpl_checks}" "${repo_path}/k8s/operator/helm/templates/00_olm.yaml"
rm "${repo_path}/k8s/operator/helm/olm_template_checks.tmpl"

Expand Down
8 changes: 2 additions & 6 deletions k8s/vizier/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ genrule(
],
outs = ["vizier_etcd_image_list.txt"],
cmd = """
T=`mktemp -d`
for FILE in $(SRCS); do cat $$FILE | yq e '.. | .image? | select(.)' -o=json - | jq 'strings' | sort | uniq >> $@; done
touch $@
yq e '.. | .image? | select(.)' -o=json $(SRCS) | jq 'strings' | sort | uniq > $@
""",
)

Expand All @@ -313,9 +311,7 @@ genrule(
],
outs = ["vizier_image_list.txt"],
cmd = """
T=`mktemp -d`
for FILE in $(SRCS); do cat $$FILE | yq e '.. | .image? | select(.)' -o=json - | jq 'strings' | sort | uniq >> $@; done
touch $@
yq e '.. | .image? | select(.)' -o=json $(SRCS) | jq 'strings' | sort | uniq > $@
""",
)

Expand Down

0 comments on commit f9c6e19

Please sign in to comment.