Skip to content

Commit

Permalink
feat(apps/prod/tekton/configs/tasks): limit nightly tiup publish freq…
Browse files Browse the repository at this point in the history
…uence (#1134)

1 per day

Signed-off-by: wuhuizuo <wuhuizuo@126.com>

---------

Signed-off-by: wuhuizuo <wuhuizuo@126.com>
  • Loading branch information
wuhuizuo authored May 8, 2024
1 parent 580fec8 commit 82e00f3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions apps/prod/tekton/configs/tasks/publish-tiup-from-oci-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ spec:
- name: CACHE_READ_SERVER_BASE_URL
value: "http://fileserver.pingcap.net/download"
script: |
#!/usr/bin/env bash
set -exo pipefail
# limit the nightly publish
if [ "$(workspaces.lock-tiup.bound)" == "true" ] ; then
if [ "$(params.nightly)" == "true" ]; then
to_match_record="$(params.artifact-url) => $(date +%Y%m%d)"
if grep "$to_match_record" $(workspaces.lock-tiup.path)/nigtly-records; then
echo "nightly have published today, skip the rest publish today."
exit 0
fi
fi
fi
gen_script_github_raw_path_url="PingCAP-QE/artifacts/main/packages/scripts/gen-delivery-tiup-script.sh"
gen_script_url="https://raw.githubusercontent.com/$gen_script_github_raw_path_url"
if wget -q --spider "$CACHE_READ_SERVER_BASE_URL/raw.githubusercontent.com/$gen_script_github_raw_path_url"; then
Expand Down Expand Up @@ -66,6 +80,14 @@ spec:
# publish the tiup packages
chmod +x publish.sh && ./publish.sh
# add the nightly published record.
if [ "$(workspaces.lock-tiup.bound)" == "true" ] ; then
if [ "$(params.nightly)" == "true" ]; then
record="$(params.artifact-url) => $(date +%Y%m%d)"
echo "$record" >> $(workspaces.lock-tiup.path)/nigtly-records
fi
fi
workspaces:
- description: Includes a TiUP private key `private.json`
name: tiup-keys
Expand Down

0 comments on commit 82e00f3

Please sign in to comment.