Test pseudo-matrix-build
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
41685f46f3
commit
b96fe80792
88
.drone.yml
88
.drone.yml
|
@ -4,53 +4,57 @@ kind: pipeline
|
|||
type: docker
|
||||
name: default
|
||||
steps:
|
||||
- name: fetch ip
|
||||
- name: fetch ips
|
||||
image: cburki/mosquitto-clients
|
||||
commands:
|
||||
- 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
|
||||
- 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
|
||||
commands:
|
||||
- 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
|
||||
# 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)
|
||||
environment:
|
||||
IOTSSID:
|
||||
from_secret: iotssid
|
||||
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