Compare commits
No commits in common. "b96fe80792e29689865ff9884070069c7d7c576a" and "111f7aa6e175e81a37b572fc1c375d8f3a9bd19f" have entirely different histories.
b96fe80792
...
111f7aa6e1
90
.drone.yml
90
.drone.yml
|
@ -4,57 +4,53 @@ kind: pipeline
|
|||
type: docker
|
||||
name: default
|
||||
steps:
|
||||
- name: fetch ips
|
||||
- name: fetch ip
|
||||
image: cburki/mosquitto-clients
|
||||
commands:
|
||||
- rm -f lastknownips
|
||||
- rm -f lastknownhostips
|
||||
- for h in $(cat hosts); do mosquitto_sub -h raum.ctdo.de -t \"homie/${h}/\$localip\" -C 1 | tr -d '\n' >>lastknownips
|
||||
- for h in $(cat hosts); do echo "${h},$(mosquitto_sub -h raum.ctdo.de -t \"homie/${h}/\$localip\" -C 1 | tr -d '\n')" >>lastknownhostips
|
||||
# - mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n'
|
||||
# - mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n' >lastknownip
|
||||
- cat lastknownips
|
||||
- cat lastknownhostips
|
||||
- name: build image
|
||||
image: suculent/platformio-docker-build
|
||||
- echo "Hostname is ---${HOST}--- $HOST ... \$HOST ... \${HOST} +++ $\{HOST\}"
|
||||
- mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n'
|
||||
- mosquitto_sub -h raum.ctdo.de -t "homie/${HOST}/\$localip" -C 1 | tr -d '\n' >lastknownip
|
||||
- cat "lastknownip"
|
||||
- name: configure
|
||||
image: alpine
|
||||
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
|
||||
- |
|
||||
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)
|
||||
- sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json
|
||||
- sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json
|
||||
- sed -i "s/HOSTNAME/${HOST}/g" data/homie/config.json
|
||||
- sed -i "s/HOSTNAME/${HOST}/g" data/homie/config.json
|
||||
- lastknownip=$(cat lastknownip)
|
||||
- sed -i "s/HOSTNAME/$lastknownip/g" platformio.ini
|
||||
environment:
|
||||
IOTSSID:
|
||||
from_secret: iotssid
|
||||
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