From b8c7f9e8f583e10692809b549733018a391fd283 Mon Sep 17 00:00:00 2001 From: Davide N Date: Thu, 15 May 2025 12:11:09 +0200 Subject: [PATCH 1/4] feat: add demo task for local auto-update workflow of the Agent --- Taskfile.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Taskfile.yml b/Taskfile.yml index bba07548..20118c11 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -149,6 +149,26 @@ tasks: - task: go:vet - task: go:lint + autoupdate:demo: + desc: Demo the local auto-update workflow for the Agent + prompt: Before continuing, please make sure you’ve opened the "Open Configuration" option from the Agent menu and set the updateUrl=http://127.0.0.1:3000/ + cmds: + - task: go:build + - go install github.com/sanbornm/go-selfupdate/...@latest + # agent will search the new bin into "CreateAgent/Stable/{platform}.json" and "https://downloads.arduino.cc/CreateAgent/Stable/%7Bversion%7D/%7Bplatform%7D.gz" + - go-selfupdate -o public/CreateAgent/Stable ./arduino-cloud-agent {{.VERSION}} + - docker rm -f agent-static-server + - docker run --rm -d -v "$PWD/public:/usr/share/nginx/html:ro" -p 3000:80 --name agent-static-server nginx:alpine + - | + echo "Waiting for http://127.0.0.1:3000 to become available..." + until nc -z 127.0.0.1 3000; do + sleep 1 + done + echo "Server is up!" + - curl -X POST http://127.0.0.1:8991/update + + + vars: # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml PROJECT_NAME: arduino-cloud-agent From 84b93885ac2fb2ecb2ec721a1bfed7b155f70e36 Mon Sep 17 00:00:00 2001 From: Davide N Date: Thu, 15 May 2025 12:16:10 +0200 Subject: [PATCH 2/4] fix: update autoupdate demo description and improve server wait logic --- Taskfile.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 20118c11..f5797538 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -150,7 +150,7 @@ tasks: - task: go:lint autoupdate:demo: - desc: Demo the local auto-update workflow for the Agent + desc: Demo the local auto-update workflow for the Agent (for linux and mac user) prompt: Before continuing, please make sure you’ve opened the "Open Configuration" option from the Agent menu and set the updateUrl=http://127.0.0.1:3000/ cmds: - task: go:build @@ -159,12 +159,7 @@ tasks: - go-selfupdate -o public/CreateAgent/Stable ./arduino-cloud-agent {{.VERSION}} - docker rm -f agent-static-server - docker run --rm -d -v "$PWD/public:/usr/share/nginx/html:ro" -p 3000:80 --name agent-static-server nginx:alpine - - | - echo "Waiting for http://127.0.0.1:3000 to become available..." - until nc -z 127.0.0.1 3000; do - sleep 1 - done - echo "Server is up!" + - sleep 5 # wait the server is up before starting the update - curl -X POST http://127.0.0.1:8991/update From cb531555865e1cae91f423288b8d021710f33448 Mon Sep 17 00:00:00 2001 From: Davide N Date: Thu, 15 May 2025 12:22:47 +0200 Subject: [PATCH 3/4] fix: remove unnecessary blank lines in Taskfile.yml --- Taskfile.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index f5797538..e662ec30 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -162,8 +162,6 @@ tasks: - sleep 5 # wait the server is up before starting the update - curl -X POST http://127.0.0.1:8991/update - - vars: # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml PROJECT_NAME: arduino-cloud-agent From e2d2c385f83403c48fdf4134fb78b623b09ea816 Mon Sep 17 00:00:00 2001 From: Davide N Date: Thu, 15 May 2025 12:24:01 +0200 Subject: [PATCH 4/4] fix: clarify the importance of the 'CreateAgent/Stable' path in update file search --- Taskfile.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index e662ec30..681c8274 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -155,7 +155,8 @@ tasks: cmds: - task: go:build - go install github.com/sanbornm/go-selfupdate/...@latest - # agent will search the new bin into "CreateAgent/Stable/{platform}.json" and "https://downloads.arduino.cc/CreateAgent/Stable/%7Bversion%7D/%7Bplatform%7D.gz" + # NOTE: the path 'CreateAgent/Stable' is important to keep as is + # because agent searches the update files into "CreateAgent/Stable/{platform}.json" and "https://downloads.arduino.cc/CreateAgent/Stable/%7Bversion%7D/%7Bplatform%7D.gz" - go-selfupdate -o public/CreateAgent/Stable ./arduino-cloud-agent {{.VERSION}} - docker rm -f agent-static-server - docker run --rm -d -v "$PWD/public:/usr/share/nginx/html:ro" -p 3000:80 --name agent-static-server nginx:alpine