Blinky/.drone.yml

49 lines
1.9 KiB
YAML

---
kind: pipeline
type: docker
name: default
steps:
- name: fetch ips
image: cburki/mosquitto-clients
commands:
- #mosquitto_sub -h raum.ctdo.de -t "homie/blinky1/\$localip" -C 1
- rm -f lastknownhostips
- cat hosts
- for h in $(cat hosts); do echo $h; echo $h; done
- for h in $(cat hosts); do mosquitto_sub -h raum.ctdo.de -t "homie/$h/\$localip" -C 1; done >lastknownips
- for h in $(cat hosts); do echo -n "$h," >>lastknownhostips; mosquitto_sub -h raum.ctdo.de -t "homie/$h/\$localip" -C 1 >>lastknownhostips; done
- cat lastknownhostips
- cat lastknownips
- name: build
image: suculent/platformio-docker-build
commands:
# Build image
- platformio run --environment d1_mini
- name: upload image
image: curlimages/curl
commands:
# Upload image with espota-gateway
# All hosts receive the identical image
- |
cat lastknownips
for thisip in $(cat lastknownips)
do
echo "Current IP to upload is $thisip"
curl --insecure --no-progress-meter --fail-with-body --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$thisip" --form firmware=@.pio/build/d1_mini/firmware.bin --no-buffer
done
# Upload file system image with espota-gateway, leave it to espota-gateway to retry often enough
#- |
# curl --insecure --no-progress-meter --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 --no-buffer
- name: build configs
image: suculent/platformio-docker-build
commands:
- |
chmod u+x ./configureandupload.sh
./configureandupload.sh
environment:
IOTSSID:
from_secret: iotssid
iotpwd:
from_secret: iotpwd