Blinky/.drone.yml

49 lines
1.6 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 images
- platformio run --environment d1_mini
- |
chmod u+x ./configurefs.sh
chmod u+x ./uploadfs.sh
./configurefs.sh
- 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 -m 180 --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
- name: upload configs
image: curlimages/curl
commands:
- ls -lA .
- /bin/sh ./uploadfs.sh
environment:
IOTSSID:
from_secret: iotssid
iotpwd:
from_secret: iotpwd