mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-01-22 13:58:48 +01:00
Resolve KASM-3663 "Feature/ host tip of master preview builds"
This commit is contained in:
parent
4d3a9b749a
commit
d5080eca8f
@ -89,3 +89,26 @@ detect_revision() {
|
|||||||
|
|
||||||
REVISION=$(echo "$package" | sed "s/_${arch}.\+//" | sed 's/.\++//')
|
REVISION=$(echo "$package" | sed "s/_${arch}.\+//" | sed 's/.\++//')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
make_index_html() {
|
||||||
|
local body=""
|
||||||
|
local bname
|
||||||
|
|
||||||
|
for f in "$@"; do
|
||||||
|
bname=$(basename "$f")
|
||||||
|
body="${body}<a href=/$f>$bname</a><br>"
|
||||||
|
done
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
<!doctype html>
|
||||||
|
<html lang=en>
|
||||||
|
<head>
|
||||||
|
<meta charset=utf-8>
|
||||||
|
<title>KasmVNC preview build</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
$body
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
@ -486,6 +486,9 @@ test:
|
|||||||
upload:
|
upload:
|
||||||
stage: upload
|
stage: upload
|
||||||
image: ubuntu:focal
|
image: ubuntu:focal
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- output/
|
||||||
before_script:
|
before_script:
|
||||||
- . .ci/upload.sh
|
- . .ci/upload.sh
|
||||||
script:
|
script:
|
||||||
@ -502,6 +505,7 @@ upload:
|
|||||||
done
|
done
|
||||||
- export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}"
|
- export S3_BUILD_DIRECTORY="kasmvnc/${CI_COMMIT_SHA}"
|
||||||
- export RELEASE_VERSION=$(.ci/next_release_version "$CI_COMMIT_REF_NAME")
|
- export RELEASE_VERSION=$(.ci/next_release_version "$CI_COMMIT_REF_NAME")
|
||||||
|
- uploaded_files=()
|
||||||
- for package in `find output/ -type f -name '*.deb' -or -name '*.rpm' -or -name '*.tgz'`; do
|
- for package in `find output/ -type f -name '*.deb' -or -name '*.rpm' -or -name '*.tgz'`; do
|
||||||
prepare_upload_filename "$package";
|
prepare_upload_filename "$package";
|
||||||
upload_filename="${S3_BUILD_DIRECTORY}/$upload_filename";
|
upload_filename="${S3_BUILD_DIRECTORY}/$upload_filename";
|
||||||
@ -510,4 +514,23 @@ upload:
|
|||||||
upload_to_s3 "$package" "$upload_filename" "$S3_BUCKET";
|
upload_to_s3 "$package" "$upload_filename" "$S3_BUCKET";
|
||||||
UPLOAD_NAME=$(basename $upload_filename | sed 's#kasmvncserver_##' | sed -r 's#_([0-9]{1,3}\.){2}[0-9]{1,2}_\S+?([a-f0-9]{6})##' | sed -r 's#\.(deb|rpm|tgz)##');
|
UPLOAD_NAME=$(basename $upload_filename | sed 's#kasmvncserver_##' | sed -r 's#_([0-9]{1,3}\.){2}[0-9]{1,2}_\S+?([a-f0-9]{6})##' | sed -r 's#\.(deb|rpm|tgz)##');
|
||||||
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${UPLOAD_NAME}&target_url=${S3_URL}";
|
curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=${UPLOAD_NAME}&target_url=${S3_URL}";
|
||||||
|
uploaded_files+=("$upload_filename");
|
||||||
done
|
done
|
||||||
|
- make_index_html "${uploaded_files[@]}" > output/index.html;
|
||||||
|
|
||||||
|
upload_build_preview:
|
||||||
|
stage: upload
|
||||||
|
needs: ["upload"]
|
||||||
|
dependencies: ["upload"]
|
||||||
|
image: ubuntu:focal
|
||||||
|
before_script:
|
||||||
|
- . .ci/upload.sh
|
||||||
|
resource_group: upload_build_preview
|
||||||
|
only:
|
||||||
|
variables:
|
||||||
|
- $CI_COMMIT_BRANCH == 'master'
|
||||||
|
script:
|
||||||
|
- prepare_to_run_scripts_and_s3_uploads
|
||||||
|
- preview_builds_dir=kasmvnc/preview-builds
|
||||||
|
- upload_to_s3 "output/index.html" "$preview_builds_dir/index.html" "$S3_BUCKET"
|
||||||
|
- curl --request POST --header "PRIVATE-TOKEN:${GITLAB_API_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/statuses/${CI_COMMIT_SHA}?state=success&name=index.html&target_url=${S3_URL}";
|
||||||
|
Loading…
Reference in New Issue
Block a user