Blinky/.drone.yml

49 lines
1.6 KiB
YAML
Raw Permalink 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:
2022-08-30 19:04:57 +00:00
# Build images
2022-08-30 15:50:09 +00:00
- platformio run --environment d1_mini
2022-08-30 19:04:57 +00:00
- |
chmod u+x ./configurefs.sh
2022-09-06 18:46:51 +00:00
chmod u+x ./uploadfs.sh
2022-08-30 19:04:57 +00:00
./configurefs.sh
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 19:34:50 +00:00
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
2022-08-30 17:09:18 +00:00
done
2022-08-30 19:04:57 +00:00
- name: upload configs
image: curlimages/curl
2022-08-30 17:09:18 +00:00
commands:
2022-08-30 19:28:55 +00:00
- ls -lA .
2022-09-06 19:16:49 +00:00
- /bin/sh ./uploadfs.sh
2022-08-30 17:09:18 +00:00
environment:
IOTSSID:
from_secret: iotssid
iotpwd:
from_secret: iotpwd