ci: fix AI triage (a.k.a. 'traiage') workflow (#19912)

- Updates default template name
- Set `GITHUB_TOKEN` env
- Implement simple `traiage.sh resume` script to download output
artifact
This commit is contained in:
Cian Johnston
2025-09-22 16:42:42 +01:00
committed by GitHub
parent d2da8357cf
commit 6d1c425421
2 changed files with 40 additions and 23 deletions
+26 -2
View File
@@ -140,7 +140,7 @@ wait_agentapi_stable() {
}
archive() {
requiredenvs CODER_URL CODER_SESSION_TOKEN WORKSPACE_NAME DESTINATION_PREFIX
requiredenvs CODER_URL CODER_SESSION_TOKEN WORKSPACE_NAME BUCKET_PREFIX
ssh_config
# We want the heredoc to be expanded locally and not remotely.
@@ -153,7 +153,7 @@ archive() {
set -euo pipefail
ARCHIVE_PATH=\$(coder-archive-create)
ARCHIVE_NAME=\$(basename "\${ARCHIVE_PATH}")
ARCHIVE_DEST="${DESTINATION_PREFIX%%/}/\${ARCHIVE_NAME}"
ARCHIVE_DEST="${BUCKET_PREFIX%%/}/\${ARCHIVE_NAME}"
if [[ ! -f "\${ARCHIVE_PATH}" ]]; then
echo "FATAL: Archive not found at expected path: \${ARCHIVE_PATH}"
exit 1
@@ -215,6 +215,27 @@ delete() {
exit 0
}
resume() {
requiredenvs CODER_URL CODER_SESSION_TOKEN WORKSPACE_NAME BUCKET_PREFIX
# Note: WORKSPACE_NAME here is really the 'context key'.
# Files are uploaded to the GCS bucket under this key.
# This just happens to be the same as the workspace name.
src="${BUCKET_PREFIX%%/}/${WORKSPACE_NAME}.tar.gz"
dest="${TEMPDIR}/${WORKSPACE_NAME}.tar.gz"
gcloud storage cp "${src}" "${dest}"
if [[ ! -f "${dest}" ]]; then
echo "FATAL: Failed to download archive from ${src}"
exit 1
fi
resume_dest="${HOME}/workspaces/${WORKSPACE_NAME}"
mkdir -p "${resume_dest}"
tar -xzvf "${dest}" -C "${resume_dest}" || exit 1
echo "Workspace restored to ${resume_dest}"
}
main() {
dependencies coder
@@ -241,6 +262,9 @@ main() {
wait-agentapi-stable)
wait_agentapi_stable
;;
resume)
resume
;;
*)
echo "Unknown option: $1"
usage