From 473926d5a7c5964472ab8dc4e021f76d57df2046 Mon Sep 17 00:00:00 2001 From: neri Date: Thu, 30 Jun 2022 14:29:02 +0200 Subject: [PATCH] Try to speed up drone deployment --- .drone.yml | 83 +++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/.drone.yml b/.drone.yml index 7410d4e..3f1651c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,47 +3,48 @@ kind: pipeline type: docker name: default steps: -- name: prereq - image: cburki/mosquitto-clients - commands: - - mosquitto_sub -h mqtt.ctdo.de -t "homie/$hostname/\$localip" -C 1 | tr -d '\n' >lastknownip - environment: - hostname: - from_secret: hostname -- name: build - image: python:3.10 - commands: - - sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json - - sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json - - sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json - - sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json - - lastknownip=$(cat lastknownip) - - sed -i "s/HOSTNAME/$lastknownip/g" platformio.ini - - cat data/homie/config.json - - cat platformio.ini - - pip install -U platformio - # Build image - - platformio run --environment d1_mini - # Build file system image - - platformio run --target buildfs --environment d1_mini - environment: - hostname: - from_secret: hostname - IOTSSID: - from_secret: iotssid - iotpwd: - from_secret: iotpwd -- name: upload - image: python:3.10 - commands: - # Upload image with espota-gateway - - | - curl -k --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$lastknownip" --form firmware=@.pio/build/d1_mini/firmware.bin -N - # TODO: Upload file system image with espota-gateway, if the device is available again (or leave it to espota-gateway to retry often enough) - - | - curl -k --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$lastknownip" --form spiffs=@.pio/build/d1_mini/spiffs.bin -N - + - name: fetch ip + image: cburki/mosquitto-clients + commands: + - mosquitto_sub -h mqtt.ctdo.de -t "homie/$hostname/\$localip" -C 1 | tr -d '\n' >lastknownip + environment: + hostname: + from_secret: hostname + - name: configure + image: alpine + commands: + - sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json + - sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json + - sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json + - sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json + - lastknownip=$(cat lastknownip) + - sed -i "s/HOSTNAME/$lastknownip/g" platformio.ini + environment: + hostname: + from_secret: hostname + IOTSSID: + from_secret: iotssid + iotpwd: + from_secret: iotpwd + - name: build + image: suculent/platformio-docker-build + commands: + # - pip install -U platformio + # Build image + - platformio run --environment d1_mini + # Build file system image + - platformio run --target buildfs --environment d1_mini + - name: upload + image: curlimages/curl + commands: + - lastknownip=$(cat lastknownip) + # Upload image with espota-gateway + - | + curl --insecure --fail-with-body --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$lastknownip" --form firmware=@.pio/build/d1_mini/firmware.bin -N + # TODO: Upload file system image with espota-gateway, if the device is available again (or leave it to espota-gateway to retry often enough) + - | + curl --insecure --fail-with-body --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$lastknownip" --form spiffs=@.pio/build/d1_mini/spiffs.bin -N ### matrix-builds? - for multiple volumeknobs? ### https://0-8-0.docs.drone.io/matrix-builds/ -### +###