From 2b6dfe43d0ae92485f06ddbc0ef0d06ac3fa8bd2 Mon Sep 17 00:00:00 2001 From: anuejn Date: Sat, 2 Nov 2019 22:47:17 +0100 Subject: [PATCH] [ci] use cirrus ci artifacs for storage --- .cirrus.yml | 46 ++++++++++++++++------------------ makefiles/host/docker_entry.sh | 6 ++++- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 89ac4400..57978063 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -2,8 +2,6 @@ docker_builder: only_if: $CIRRUS_TAG !=~ "nightly/.*" env: TOKEN: ENCRYPTED[4e4d80e944992ff037ce22e89b29a5151ef75bf44b133db67fb3cfb5ff1f3aaf7722bf86028957fc99a07edecfbe0962] - UPLOAD_KEY: ENCRYPTED[218507b6609fd0eb0cd00663c48a10082930967672efe5655b56118e4f515561f0bbc893dbb6a5a943d55f384ec1285c] - SSH_PRIVATE_KEY: ENCRYPTED[f2f0f5401824d85c731ff5e6663a2388663a776deef6ccbbaee0bb0f968718131a87bbbfebb8960b3ad686cfa8b3debe] matrix: DEVICE: beta DEVICE: micro @@ -15,16 +13,31 @@ docker_builder: git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR fi; git reset --hard $CIRRUS_CHANGE_IN_REPO - make_script: ./makefiles/docker-make.sh DEVICE=$DEVICE - test_script: ./makefiles/docker-make.sh DEVICE=$DEVICE test - release_script: | + make_script: | + ./makefiles/docker-make.sh DEVICE=$DEVICE + # compress the image - [ -z $CIRRUS_PR ] || PR="-pr-$CIRRUS_PR" - FILE=axiom-$DEVICE$PR-$(git describe --always --abbrev=8).img.xz + FILE=axiom-$DEVICE$([ -z $CIRRUS_PR ] || echo "-pr-$CIRRUS_PR")-$(git describe --always --abbrev=8).img.xz xz -T $(nproc) build/axiom-$DEVICE.img mv build/axiom-$DEVICE.img.xz build/$FILE - + image_upload_artifacts: + path: "build/axiom-*.img.xz" + image_notify_script: | + if [ $DEVICE = 'beta' ]; then + if [[ ! -z "$CIRRUS_PR" ]]; then + wget https://github.com/cloudposse/github-commenter/releases/download/0.5.0/github-commenter_linux_amd64 + chmod a+x github-commenter_linux_amd64 + ./github-commenter_linux_amd64 -token $TOKEN -owner $CIRRUS_REPO_OWNER -repo $CIRRUS_REPO_NAME -type pr -number $CIRRUS_PR \ + -comment "[//]: # (tracking-code: wasDinkDrybatghivSeerz8opDyajMoartEvbagyivwavdapGa) + Download a build of the latest (untested) commit at https://api.cirrus-ci.com/v1/artifact/task/$CIRRUS_TASK_ID/image_upload/$(ls build/axiom-*.img.xz)" \ + -delete-comment-regex "wasDinkDrybatghivSeerz8opDyajMoartEvbagyivwavdapGa" + fi + fi + test_script: | + ./makefiles/docker-make.sh DEVICE=$DEVICE test + github_release_script: | if [ $CIRRUS_BRANCH = 'master' ]; then + FILE=axiom-$DEVICE$([ -z $CIRRUS_PR ] || echo "-pr-$CIRRUS_PR")-$(git describe --always --abbrev=8).img.xz # get the github-release tool wget https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 tar -xf linux-amd64-github-release.tar.bz2 @@ -41,21 +54,4 @@ docker_builder: ./bin/linux/amd64/github-release upload -u $CIRRUS_REPO_OWNER -r $CIRRUS_REPO_NAME -t "nightly/$(git describe --always --abbrev=8)" -s $TOKEN -n "$FILE" -f build/$FILE else echo "not creating a github release, because this is not a build for the master branch" - fi - - echo "$UPLOAD_KEY" | tr -d '\r' > /tmp/storage_key - chmod 600 /tmp/storage_key - scp -oStrictHostKeyChecking=no -i /tmp/storage_key -P 22201 build/$FILE file_storage@vup.niemo.de:/data/file_storage/data - rm /tmp/storage_key - - echo "Download the image of this build at https://axiom-images.niemo.de/$FILE" - - if [ $DEVICE = 'beta' ]; then - if [[ ! -z "$CIRRUS_PR" ]]; then - wget https://github.com/cloudposse/github-commenter/releases/download/0.5.0/github-commenter_linux_amd64 - chmod a+x github-commenter_linux_amd64 - ./github-commenter_linux_amd64 -token $TOKEN -owner $CIRRUS_REPO_OWNER -repo $CIRRUS_REPO_NAME -type pr -number $CIRRUS_PR -comment "[//]: # (tracking-code: wasDinkDrybatghivSeerz8opDyajMoartEvbagyivwavdapGa) - - Download a build of the latest commit at https://axiom-images.niemo.de/$FILE " -delete-comment-regex "wasDinkDrybatghivSeerz8opDyajMoartEvbagyivwavdapGa" - fi fi diff --git a/makefiles/host/docker_entry.sh b/makefiles/host/docker_entry.sh index 7d618714..9cd36640 100755 --- a/makefiles/host/docker_entry.sh +++ b/makefiles/host/docker_entry.sh @@ -20,5 +20,9 @@ else fi make -f makefiles/host/main.mk -I makefiles/host -j $(nproc) $* +RETURN_CODE=$? + umount build/root.fs -losetup -d /dev/loop0 \ No newline at end of file +losetup -d /dev/loop0 + +exit $RETURN_CODE