Speed up drone build and fix upload ip
continuous-integration/drone/push Build is failing Details
continuous-integration/drone Build is failing Details

This commit is contained in:
neri 2022-06-30 14:29:02 +02:00
parent 0032d44ec1
commit e269418090
1 changed files with 42 additions and 41 deletions

View File

@ -3,15 +3,15 @@ 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
@ -19,13 +19,6 @@ steps:
- 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
- cat platformio.ini
- pip install -U platformio
# Build image
- platformio run --environment d1_mini
# Build file system image
- platformio run --target buildfs --environment d1_mini
environment: environment:
hostname: hostname:
from_secret: hostname from_secret: hostname
@ -33,16 +26,24 @@ steps:
from_secret: iotssid from_secret: iotssid
iotpwd: iotpwd:
from_secret: iotpwd from_secret: iotpwd
- name: upload - name: build
image: python:3.10 image: suculent/platformio-docker-build
commands: 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)
# Upload image with espota-gateway # Upload image with espota-gateway
- | - |
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 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
# TODO: Upload file system image with espota-gateway, if the device is available again (or leave it to espota-gateway to retry often enough) # 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 -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 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/