Speed up drone build and fix upload ip
This commit is contained in:
parent
0032d44ec1
commit
e269418090
81
.drone.yml
81
.drone.yml
|
@ -3,46 +3,47 @@ kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: default
|
||||||
steps:
|
steps:
|
||||||
- name: prereq
|
- name: fetch ip
|
||||||
image: cburki/mosquitto-clients
|
image: cburki/mosquitto-clients
|
||||||
commands:
|
commands:
|
||||||
- mosquitto_sub -h mqtt.ctdo.de -t "homie/$hostname/\$localip" -C 1 | tr -d '\n' >lastknownip
|
- mosquitto_sub -h mqtt.ctdo.de -t "homie/$hostname/\$localip" -C 1 | tr -d '\n' >lastknownip
|
||||||
environment:
|
environment:
|
||||||
hostname:
|
hostname:
|
||||||
from_secret: hostname
|
from_secret: hostname
|
||||||
- name: build
|
- name: configure
|
||||||
image: python:3.10
|
image: alpine
|
||||||
commands:
|
commands:
|
||||||
- sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json
|
- sed -i "s/WIFISSID/$IOTSSID/" data/homie/config.json
|
||||||
- sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json
|
- sed -i "s/WIFIPASS/$iotpwd/" data/homie/config.json
|
||||||
- sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json
|
- sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json
|
||||||
- sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json
|
- sed -i "s/HOSTNAME/$hostname/g" data/homie/config.json
|
||||||
- lastknownip=$(cat lastknownip)
|
- lastknownip=$(cat lastknownip)
|
||||||
- sed -i "s/HOSTNAME/$lastknownip/g" platformio.ini
|
- sed -i "s/HOSTNAME/$lastknownip/g" platformio.ini
|
||||||
- cat data/homie/config.json
|
environment:
|
||||||
- cat platformio.ini
|
hostname:
|
||||||
- pip install -U platformio
|
from_secret: hostname
|
||||||
# Build image
|
IOTSSID:
|
||||||
- platformio run --environment d1_mini
|
from_secret: iotssid
|
||||||
# Build file system image
|
iotpwd:
|
||||||
- platformio run --target buildfs --environment d1_mini
|
from_secret: iotpwd
|
||||||
environment:
|
- name: build
|
||||||
hostname:
|
image: suculent/platformio-docker-build
|
||||||
from_secret: hostname
|
commands:
|
||||||
IOTSSID:
|
# - pip install -U platformio
|
||||||
from_secret: iotssid
|
# Build image
|
||||||
iotpwd:
|
- platformio run --environment d1_mini
|
||||||
from_secret: iotpwd
|
# Build file system image
|
||||||
- name: upload
|
- platformio run --target buildfs --environment d1_mini
|
||||||
image: python:3.10
|
- name: upload
|
||||||
commands:
|
image: curlimages/curl
|
||||||
# Upload image with espota-gateway
|
commands:
|
||||||
- |
|
- lastknownip=$(cat lastknownip)
|
||||||
curl -k --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$lastknownip" --form firmware=@.pio/build/d1_mini/firmware.bin -N
|
# Upload image with espota-gateway
|
||||||
# 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 --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 -N
|
||||||
curl -k --request POST --url "https://espota.ctdo.de/" --header "Content-Type: multipart/form-data" --form ip="$lastknownip" --form spiffs=@.pio/build/d1_mini/spiffs.bin -N
|
# 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 --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 -N
|
||||||
|
|
||||||
### matrix-builds? - for multiple volumeknobs?
|
### matrix-builds? - for multiple volumeknobs?
|
||||||
### https://0-8-0.docs.drone.io/matrix-builds/
|
### https://0-8-0.docs.drone.io/matrix-builds/
|
||||||
|
|
Loading…
Reference in New Issue