Blinky/.drone.yml

49 lines
1.9 KiB
YAML
Raw Normal View History

2022-08-30 15:50:09 +00:00
---
kind: pipeline
type: docker
name: default
steps:
2022-08-30 17:09:18 +00:00
- name: fetch ips
2022-08-30 15:50:09 +00:00
image: cburki/mosquitto-clients
commands:
2022-08-30 17:17:34 +00:00
- #mosquitto_sub -h raum.ctdo.de -t "homie/blinky1/\$localip" -C 1
2022-08-30 17:18:55 +00:00
- rm -f lastknownhostips
2022-08-30 17:11:15 +00:00
- cat hosts
2022-08-30 17:17:34 +00:00
- for h in $(cat hosts); do echo $h; echo $h; done
2022-08-30 17:20:27 +00:00
- 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
2022-08-30 17:09:18 +00:00
- cat lastknownhostips
2022-08-30 17:20:27 +00:00
- cat lastknownips
2022-08-30 17:23:54 +00:00
- name: build
2022-08-30 15:50:09 +00:00
image: suculent/platformio-docker-build
commands:
# Build image
- platformio run --environment d1_mini
2022-08-30 17:09:18 +00:00
- name: upload image
2022-08-30 15:50:09 +00:00
image: curlimages/curl
commands:
# Upload image with espota-gateway
2022-08-30 17:09:18 +00:00
# All hosts receive the identical image
2022-08-30 15:50:09 +00:00
- |
2022-08-30 17:49:07 +00:00
cat lastknownips
2022-08-30 17:09:18 +00:00
for thisip in $(cat lastknownips)
do
2022-08-30 17:49:07 +00:00
echo "Current IP to upload is $thisip"
2022-08-30 17:09:18 +00:00
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:
2022-08-30 15:50:09 +00:00
- |
2022-08-30 18:47:29 +00:00
chmod u+x ./configureandupload.sh
./configureandupload.sh
2022-08-30 17:09:18 +00:00
environment:
IOTSSID:
from_secret: iotssid
iotpwd:
from_secret: iotpwd