summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjak1 <mike.wollmann@gmail.com>2021-03-19 11:12:36 +0100
committerjak1 <mike.wollmann@gmail.com>2021-03-19 11:12:36 +0100
commitee65d419275f5c61148aa85b3280e9696280efd4 (patch)
tree325e799ba2a587d49b81c5b469ce53321fb053e0
parenta8db49ef5de4f2cacd2317c25ae1859879533831 (diff)
downloaddocker-windows-builder-ee65d419275f5c61148aa85b3280e9696280efd4.tar.gz
docker-windows-builder-ee65d419275f5c61148aa85b3280e9696280efd4.tar.bz2
docker-windows-builder-ee65d419275f5c61148aa85b3280e9696280efd4.tar.xz
docker-windows-builder-ee65d419275f5c61148aa85b3280e9696280efd4.zip
Testing
- added test deployment (i guess i could also use custom CI variables to test stuff... whatever, now we have it this way...)
-rw-r--r--.gitlab-ci.yml1
-rw-r--r--pages.sh75
2 files changed, 63 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3ab50d0..3c5ebad 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -69,7 +69,6 @@ pages:
script:
- echo "[WIP] mirror"
- ./pages.sh
- - scp -o StrictHostKeyChecking=no versions.txt $DEPLOY_HOST:$DEPLOY_LOCATION
- rm -rf ~/.ssh
<<: *job-deploy
allow_failure: true
diff --git a/pages.sh b/pages.sh
index 068d78e..f21aeab 100644
--- a/pages.sh
+++ b/pages.sh
@@ -3,14 +3,19 @@
version_file="versions.txt"
checksum_file="sha256checksum.txt"
deploy_dir="public"
+mode_url="https://manaplus.germantmw.de/versions/"
+mode_file="mode.txt"
+mirror_file="mirrorlist"
if [[ ${CI_PROJECT_DIR} == "" ]]; then
version_url="https://jak89_1.gitlab.io/docker-testing/${version_file}" # change me!
- version_url2="https://gitlab.com/jak89_1/docker-testing/-/jobs/artifacts/master/raw/public/${version_file}?job=pages" # change me
+ version_url2="https://gitlab.com/jak89_1/docker-testing/-/jobs/artifacts/master/raw/$deploy_dir/${version_file}?job=pages" # change me
echo "[NON CI] : using local paths"
+ local=1
else
version_url="${CI_PAGES_URL}/${version_file}"
- version_url2="https://gitlab.com/jak89_1/docker-testing/-/jobs/artifacts/master/raw/public/${version_file}?job=${CI_JOB_NAME}" # change me
+ version_url2="https://gitlab.com/jak89_1/docker-testing/-/jobs/artifacts/master/raw/$deploy_dir/${version_file}?job=${CI_JOB_NAME}" # change me
+ local=0
fi
version_url3="https://manaplus.germantmw.de/versions/${version_file}" # fallback to my server if gitlab breaks its own pages *blames gitlab*
@@ -85,14 +90,14 @@ gen_page(){
_x "</versions>\n";
_j "}\n"
_b "</table>"
- _b "<a href='$version_file'>versions.txt</a>"
+ _b "<a href='$version_file'>$version_file</a>"
_b "</center></body>"
_b "</html>"
- #write out files (keep source formating for xml)
- echo $BUFFER_HTML > $deploy_dir/mirrorlist.html
- echo -e "$BUFFER_XML" > $deploy_dir/mirrorlist.xml
- echo -e "$BUFFER_JSON" > $deploy_dir/mirrorlist.json
+ #write out files (keep source formating for xml & json)
+ echo $BUFFER_HTML > $deploy_dir/$mirror_file.html
+ echo -e "$BUFFER_XML" > $deploy_dir/$mirror_file.xml
+ echo -e "$BUFFER_JSON" > $deploy_dir/$mirror_file.json
}
add_new_release(){
@@ -100,7 +105,6 @@ add_new_release(){
#if #TODO: check if new tag/version exists, of if the pipeline got trigerred manualy
checksum=$(<${checksum_file})
echo $checksum >> $version_file
- rm $checksum_file || exit 1
#fi
}
@@ -125,11 +129,58 @@ get_version_file(){
fi
}
+# simple mode check for testings only
+get_mode(){
+ mode=""
+ wget $mode_url$mode_file -q
+ if grep -q testing "$mode_file"; then
+ echo "[deploy] test only!"
+ mode="test"
+ return 0
+ elif grep -q release "$mode_file"; then
+ echo "[deploy] release/stable!"
+ return 1
+ else # we can also add other modes here, atm just to dont deploy tonns of test versions :)
+ echo "[deploy] ERR: unknown mode!"
+ exit 1
+ fi
+}
+
+local_cleanup(){
+ rm $checksum_file
+ rm $mode_file
+}
+
+deploy(){
+ mv $version_file $deploy_dir || exit 1
+
+ if [[ $local == 0 ]]; then
+ scp -o StrictHostKeyChecking=no $deploy_dir/$version_file $DEPLOY_HOST:$DEPLOY_LOCATION$mode || echo "WARN: cant deploy to Server!"
+ scp -o StrictHostKeyChecking=no $deploy_dir/$mirror_file.xml $DEPLOY_HOST:$DEPLOY_LOCATION$mode || echo "WARN: cant deploy to Server!"
+ scp -o StrictHostKeyChecking=no $deploy_dir/$mirror_file.json $DEPLOY_HOST:$DEPLOY_LOCATION$mode || echo "WARN: cant deploy to Server!"
+ scp -o StrictHostKeyChecking=no $deploy_dir/$mirror_file.html $DEPLOY_HOST:$DEPLOY_LOCATION$mode || echo "WARN: cant deploy to Server!"
+ fi
+
+ # i guess i need to get old artifacts to keep pages in case it was a test build
+ if get_mode; then
+ find $deploy_dir -type f -not -name '*.xsd' -delete
+ #else
+ # deploying versions
+ #scp -o StrictHostKeyChecking=no $deploy_dir/.zip $DEPLOY_HOST:$DEPLOY_LOCATION$mode || echo "WARN: cant deploy to Server!"
+ #scp -o StrictHostKeyChecking=no $checksum_file.txt $DEPLOY_HOST:$DEPLOY_LOCATION$mode || echo "WARN: cant deploy to Server!"
+ fi
+
+}
+
+linters(){
+ xmllint --schema $deploy_dir/$mirror_file.xsd $deploy_dir/$mirror_file.xml --noout || exit 1
+}
+
get_version_file
add_new_release
gen_page
+linters
+deploy
+local_cleanup
-xmllint --schema $deploy_dir/mirrorlist.xsd $deploy_dir/mirrorlist.xml --noout || exit 1
-
-mv $version_file $deploy_dir || exit 1
-echo "deploy passed \\o/"
+echo "${mode}deploy passed \\o/"