Compare commits
No commits in common. "b96fe80792e29689865ff9884070069c7d7c576a" and "111f7aa6e175e81a37b572fc1c375d8f3a9bd19f" have entirely different histories.
b96fe80792
...
111f7aa6e1
88
.drone.yml
88
.drone.yml
|
@ -4,57 +4,53 @@ kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: default
|
||||||
steps:
|
steps:
|
||||||
- name: fetch ips
|
- name: fetch ip
|
||||||
image: cburki/mosquitto-clients
|
image: cburki/mosquitto-clients
|
||||||
commands:
|
commands:
|
||||||
- rm -f lastknownips
|
- echo "Hostname is ---${HOST}--- $HOST ... \$HOST ... \${HOST} +++ $\{HOST\}"
|
||||||
- rm -f lastknownhostips
|
- mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n'
|
||||||
- for h in $(cat hosts); do mosquitto_sub -h raum.ctdo.de -t \"homie/${h}/\$localip\" -C 1 | tr -d '\n' >>lastknownips
|
- mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n' >lastknownip
|
||||||
- for h in $(cat hosts); do echo "${h},$(mosquitto_sub -h raum.ctdo.de -t \"homie/${h}/\$localip\" -C 1 | tr -d '\n')" >>lastknownhostips
|
- cat "lastknownip"
|
||||||
# - mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n'
|
- name: configure
|
||||||
# - mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n' >lastknownip
|
image: alpine
|
||||||
- cat lastknownips
|
|
||||||
- cat lastknownhostips
|
|
||||||
- name: build image
|
|
||||||
image: suculent/platformio-docker-build
|
|
||||||
commands:
|
commands:
|
||||||
# Build image
|
- sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json
|
||||||
- platformio run --environment d1_mini
|
- sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json
|
||||||
- name: upload image
|
- sed -i "s/HOSTNAME/${HOST}/g" data/homie/config.json
|
||||||
image: curlimages/curl
|
- sed -i "s/HOSTNAME/${HOST}/g" data/homie/config.json
|
||||||
commands:
|
- lastknownip=$(cat lastknownip)
|
||||||
# Upload image with espota-gateway
|
- sed -i "s/HOSTNAME/$lastknownip/g" platformio.ini
|
||||||
# All hosts receive the identical image
|
|
||||||
- |
|
|
||||||
for thisip in $(cat lastknownips)
|
|
||||||
do
|
|
||||||
echo ${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:
|
|
||||||
- |
|
|
||||||
while IFS="," read -r curhost, curip
|
|
||||||
do
|
|
||||||
echo "Host ${curhost} and IP ${curip}"
|
|
||||||
cp data/homie/config.json data/homie/config.json.sample
|
|
||||||
sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json
|
|
||||||
sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json
|
|
||||||
sed -i "s/HOSTNAME/${curhost}/g" data/homie/config.json
|
|
||||||
sed -i "s/HOSTNAME/${curhost}/g" data/homie/config.json
|
|
||||||
# Build image with these parameters
|
|
||||||
platformio run --target buildfs --environment d1_mini
|
|
||||||
# Upload this image
|
|
||||||
curl --insecure --no-progress-meter --fail-with-body --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$curip" --form spiffs=@.pio/build/d1_mini/spiffs.bin --no-buffer
|
|
||||||
# Revert config.json
|
|
||||||
cp data/homie/config.json.sample data/homie/config.json
|
|
||||||
done < <(cat lastknownhostips)
|
|
||||||
environment:
|
environment:
|
||||||
IOTSSID:
|
IOTSSID:
|
||||||
from_secret: iotssid
|
from_secret: iotssid
|
||||||
iotpwd:
|
iotpwd:
|
||||||
from_secret: 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)
|
||||||
|
- echo "$lastknownip"
|
||||||
|
# Upload image with espota-gateway
|
||||||
|
- |
|
||||||
|
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 firmware=@.pio/build/d1_mini/firmware.bin --no-buffer
|
||||||
|
# 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 --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
|
||||||
|
|
||||||
|
### matrix-builds? - for multiple volumeknobs?
|
||||||
|
### https://0-8-0.docs.drone.io/matrix-builds/
|
||||||
|
###
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
HOST:
|
||||||
|
- blinky1
|
||||||
|
- blinky2
|
||||||
|
|
Loading…
Reference in New Issue