Skip to content

Commit b2b9887

Browse files
authored
ci(Taskfile): add a command to test autoupdate (#1033)
* feat: add demo task for local auto-update workflow of the Agent * fix: update autoupdate demo description and improve server wait logic * fix: remove unnecessary blank lines in Taskfile.yml * fix: clarify the importance of the 'CreateAgent/Stable' path in update file search
1 parent e7ea376 commit b2b9887

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Taskfile.yml

+14
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,20 @@ tasks:
149149
- task: go:vet
150150
- task: go:lint
151151

152+
autoupdate:demo:
153+
desc: Demo the local auto-update workflow for the Agent (for linux and mac user)
154+
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/
155+
cmds:
156+
- task: go:build
157+
- go install github.com/sanbornm/go-selfupdate/...@latest
158+
# NOTE: the path 'CreateAgent/Stable' is important to keep as is
159+
# because agent searches the update files into "CreateAgent/Stable/{platform}.json" and "https://downloads.arduino.cc/CreateAgent/Stable/{version}/{platform}.gz"
160+
- go-selfupdate -o public/CreateAgent/Stable ./arduino-cloud-agent {{.VERSION}}
161+
- docker rm -f agent-static-server
162+
- docker run --rm -d -v "$PWD/public:/usr/share/nginx/html:ro" -p 3000:80 --name agent-static-server nginx:alpine
163+
- sleep 5 # wait the server is up before starting the update
164+
- curl -X POST http://127.0.0.1:8991/update
165+
152166
vars:
153167
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml
154168
PROJECT_NAME: arduino-cloud-agent

0 commit comments

Comments
 (0)