-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(apps/prod/tekton/configs): use delicated publisher to fast t…
…iup publishing Signed-off-by: wuhuizuo <[email protected]>
- Loading branch information
Showing
3 changed files
with
67 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
apps/prod/tekton/configs/tasks/publish-tiup-from-oci-artifact-v2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: publish-tiup-from-oci-artifact-v2 | ||
spec: | ||
description: | | ||
The working flow: | ||
1. fetch the manifect config | ||
2. get the `.tiup` filed from the config. | ||
3. loop to publish to tiup mirror. | ||
params: | ||
- name: artifact-url | ||
description: | | ||
The full url of the pushed image, contain the tag part. | ||
It will parse the repo from it. | ||
- name: publisher-url | ||
description: Staging is http://publisher-staging-mirror.apps.svc, product is http://publisher-prod-mirror.apps.svc. | ||
default: http://publisher-staging-mirror.apps.svc | ||
- name: force-version | ||
description: > | ||
Force set the version. | ||
Default is the artifact version read from `org.opencontainers.image.version` of the manifest config. | ||
default: "" | ||
results: | ||
- name: request-ids | ||
type: array | ||
steps: | ||
- name: request-and-wait | ||
image: ghcr.io/pingcap-qe/ee-apps/publisher:v2024.10.14-4-ga7470b6 | ||
script: | | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
# send event | ||
/app/publisher-cli --url $(params.publisher-url) tiup request-to-publish --body '{ "artifact_url": "$(params.artifact-url)" }' | tee $(results.request-ids.path) | ||
# wait for request statuses | ||
for request_id in $(jq -r '.[]' $(results.request-ids.path)); do | ||
echo "🔍 query for request id: ${request_id} ..." | ||
while true; do | ||
status=$(/app/publisher-cli --url $(params.publisher-url) tiup query-publishing-status --request-id "$request_id" | jq -r .) | ||
if [ "$status" = "failed" ]; then | ||
echo "❌ $status" | ||
exit 1 | ||
elif [ "$status" = "success" ]; then | ||
echo "✅ $status" | ||
break | ||
else | ||
echo "⌛️ $status" | ||
sleep 10 | ||
fi | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters