Skip to content

Auto-update docker and act in run_workflows_locally.sh#50

Merged
gensyn merged 5 commits intomainfrom
copilot/update-docker-and-act
Mar 30, 2026
Merged

Auto-update docker and act in run_workflows_locally.sh#50
gensyn merged 5 commits intomainfrom
copilot/update-docker-and-act

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

install_docker() and install_act() in run_workflows_locally.sh short-circuited on first presence check, never updating already-installed tools.

Changes

  • install_docker(): when Docker is present, attempt an in-place upgrade via the OS package manager before returning

    • apt-get install --only-upgrade on Debian/Ubuntu
    • yum update on RHEL/Fedora/CentOS
    • Warns (does not fail) on unsupported platforms
  • install_act(): when act is present, compare the installed version against the latest GitHub release tag; re-run the upstream install.sh only when they differ

    • Gracefully skips the check when either version string is unresolvable (e.g. offline)
    • Emits specific warnings indicating whether the installed or latest version could not be determined
    • Uses grep -oE '[0-9]+\.[0-9]+\.[0-9]+' on both sources so the v-prefix in GitHub tags is stripped consistently
# Before — always returned immediately if the binary existed
if command_exists act; then
    info "act is already installed: $(act --version)"
    return 0
fi

# After — checks latest release, updates only when behind
current_version="$(act --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)"
latest_version="$(curl … | grep '"tag_name"' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)"

if [[ "$current_version" == "$latest_version" ]]; then
    info "act is already up to date: $(act --version)"
    return 0
fi

header "Updating act from ${current_version} to ${latest_version}"
curl -fsSL https://raw.githubusercontent.com/nektos/act/master/install.sh \
    | sudo bash -s -- -b /usr/local/bin

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI changed the title [WIP] Update docker and act versions if newer releases are available Auto-update docker and act in run_workflows_locally.sh Mar 30, 2026
Copilot AI requested a review from gensyn March 30, 2026 06:40
@gensyn
Copy link
Copy Markdown
Owner

gensyn commented Mar 30, 2026

@copilot Why are those functions in run_workflows_locally.sh when docker and act are only needed by run_playwright_tests.sh?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 30, 2026

@copilot Why are those functions in run_workflows_locally.sh when docker and act are only needed by run_playwright_tests.sh?

Good catch — the install/update logic was in the wrong script. Fixed in e671e4b: run_workflows_locally.sh is reverted to its original state (install-only, no update checks), and run_playwright_tests.sh now owns the full install-and-update logic for both docker and act, making it self-contained.

Copilot AI changed the title Auto-update docker and act in run_workflows_locally.sh Auto-update docker and act in run_playwright_tests.sh Mar 30, 2026
@gensyn
Copy link
Copy Markdown
Owner

gensyn commented Mar 30, 2026

@copilot Oh no, my mistake. run_worklflows_locally.sh also needs docker and act so the logic was fine. Please revert your last changes.

… run_playwright_tests.sh

Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/a24f4bcc-7aa7-4448-a8e4-43ebb5b74701

Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 30, 2026

@copilot Oh no, my mistake. run_worklflows_locally.sh also needs docker and act so the logic was fine. Please revert your last changes.

Reverted in 5891708run_workflows_locally.sh is back with the update logic, and run_playwright_tests.sh is restored to its original state.

Copilot AI changed the title Auto-update docker and act in run_playwright_tests.sh Auto-update docker and act in run_workflows_locally.sh Mar 30, 2026
@gensyn
Copy link
Copy Markdown
Owner

gensyn commented Mar 30, 2026

@copilot When I run run_workflows_locally.sh I see the following output:

| test_setup_entry_fails_when_service_absent_from_plain_list (test_init.TestAsyncSetupEntry.test_setup_entry_fails_when_service_absent_from_plain_list)
| Setup fails when docker_services returns a plain list that does not include the service. ... /opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/mock.py:2252: RuntimeWarning: coroutine '_discover_services' was never awaited
| Coroutine created at (most recent call last)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/case.py", line 669, in run
|     self._callTestMethod(testMethod)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 102, in _callTestMethod
|     result = self._callMaybeAsync(method)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 128, in _callMaybeAsync
|     return self._asyncioRunner.run(
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/runners.py", line 127, in run
|     return self._loop.run_until_complete(task)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 706, in run_until_complete
|     self.run_forever()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 677, in run_forever
|     self._run_once()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 2038, in _run_once
|     handle._run()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py", line 94, in _run
|     self._context.run(self._callback, *self._args)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/tests/unit_tests/test_init.py", line 298, in test_cache_avoids_second_ssh_call_for_same_host
|     await async_setup_entry(hass, entry1)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/__init__.py", line 219, in async_setup_entry
|     hass.async_create_task(_discover_services(hass, entry))
|   def __init__(self, name, parent):
| RuntimeWarning: Enable tracemalloc to get the object allocation traceback
| /opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/mock.py:2252: RuntimeWarning: coroutine '_discover_services' was never awaited
| Coroutine created at (most recent call last)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/case.py", line 669, in run
|     self._callTestMethod(testMethod)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 102, in _callTestMethod
|     result = self._callMaybeAsync(method)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 128, in _callMaybeAsync
|     return self._asyncioRunner.run(
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/runners.py", line 127, in run
|     return self._loop.run_until_complete(task)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 706, in run_until_complete
|     self.run_forever()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 677, in run_forever
|     self._run_once()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 2038, in _run_once
|     handle._run()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py", line 94, in _run
|     self._context.run(self._callback, *self._args)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/tests/unit_tests/test_init.py", line 299, in test_cache_avoids_second_ssh_call_for_same_host
|     await async_setup_entry(hass, entry2)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/__init__.py", line 219, in async_setup_entry
|     hass.async_create_task(_discover_services(hass, entry))
|   def __init__(self, name, parent):
| RuntimeWarning: Enable tracemalloc to get the object allocation traceback
| /opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/mock.py:2252: RuntimeWarning: coroutine '_discover_services' was never awaited
| Coroutine created at (most recent call last)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/case.py", line 669, in run
|     self._callTestMethod(testMethod)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 102, in _callTestMethod
|     result = self._callMaybeAsync(method)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 128, in _callMaybeAsync
|     return self._asyncioRunner.run(
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/runners.py", line 127, in run
|     return self._loop.run_until_complete(task)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 706, in run_until_complete
|     self.run_forever()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 677, in run_forever
|     self._run_once()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 2038, in _run_once
|     handle._run()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py", line 94, in _run
|     self._context.run(self._callback, *self._args)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/tests/unit_tests/test_init.py", line 335, in test_cache_expires_after_ttl
|     await async_setup_entry(hass, entry)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/__init__.py", line 219, in async_setup_entry
|     hass.async_create_task(_discover_services(hass, entry))
|   def __init__(self, name, parent):
| RuntimeWarning: Enable tracemalloc to get the object allocation traceback
| /opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/mock.py:2252: RuntimeWarning: coroutine '_discover_services' was never awaited
| Coroutine created at (most recent call last)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/case.py", line 669, in run
|     self._callTestMethod(testMethod)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 102, in _callTestMethod
|     result = self._callMaybeAsync(method)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 128, in _callMaybeAsync
|     return self._asyncioRunner.run(
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/runners.py", line 127, in run
|     return self._loop.run_until_complete(task)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 706, in run_until_complete
|     self.run_forever()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 677, in run_forever
|     self._run_once()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 2038, in _run_once
|     handle._run()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py", line 94, in _run
|     self._context.run(self._callback, *self._args)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/tests/unit_tests/test_init.py", line 348, in test_cache_expires_after_ttl
|     await async_setup_entry(hass, entry)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/__init__.py", line 219, in async_setup_entry
|     hass.async_create_task(_discover_services(hass, entry))
|   def __init__(self, name, parent):
| RuntimeWarning: Enable tracemalloc to get the object allocation traceback
| /opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/mock.py:2252: RuntimeWarning: coroutine '_discover_services' was never awaited
| Coroutine created at (most recent call last)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/case.py", line 669, in run
|     self._callTestMethod(testMethod)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 102, in _callTestMethod
|     result = self._callMaybeAsync(method)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 128, in _callMaybeAsync
|     return self._asyncioRunner.run(
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/runners.py", line 127, in run
|     return self._loop.run_until_complete(task)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 706, in run_until_complete
|     self.run_forever()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 677, in run_forever
|     self._run_once()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 2038, in _run_once
|     handle._run()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py", line 94, in _run
|     self._context.run(self._callback, *self._args)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/tests/unit_tests/test_init.py", line 317, in test_cache_is_keyed_per_host
|     await async_setup_entry(hass, entry_a)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/__init__.py", line 219, in async_setup_entry
|     hass.async_create_task(_discover_services(hass, entry))
|   def __init__(self, name, parent):
| RuntimeWarning: Enable tracemalloc to get the object allocation traceback
| /opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/mock.py:2252: RuntimeWarning: coroutine '_discover_services' was never awaited
| Coroutine created at (most recent call last)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/case.py", line 669, in run
|     self._callTestMethod(testMethod)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 102, in _callTestMethod
|     result = self._callMaybeAsync(method)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 128, in _callMaybeAsync
|     return self._asyncioRunner.run(
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/runners.py", line 127, in run
|     return self._loop.run_until_complete(task)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 706, in run_until_complete
|     self.run_forever()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 677, in run_forever
|     self._run_once()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 2038, in _run_once
|     handle._run()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py", line 94, in _run
|     self._context.run(self._callback, *self._args)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/tests/unit_tests/test_init.py", line 318, in test_cache_is_keyed_per_host
|     await async_setup_entry(hass, entry_b)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/__init__.py", line 219, in async_setup_entry
|     hass.async_create_task(_discover_services(hass, entry))
|   def __init__(self, name, parent):
| RuntimeWarning: Enable tracemalloc to get the object allocation traceback
| /opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/mock.py:2252: RuntimeWarning: coroutine '_discover_services' was never awaited
| Coroutine created at (most recent call last)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/case.py", line 669, in run
|     self._callTestMethod(testMethod)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 102, in _callTestMethod
|     result = self._callMaybeAsync(method)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 128, in _callMaybeAsync
|     return self._asyncioRunner.run(
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/runners.py", line 127, in run
|     return self._loop.run_until_complete(task)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 706, in run_until_complete
|     self.run_forever()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 677, in run_forever
|     self._run_once()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 2038, in _run_once
|     handle._run()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py", line 94, in _run
|     self._context.run(self._callback, *self._args)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/tests/unit_tests/test_init.py", line 366, in test_cache_stores_none_when_docker_services_absent
|     result1 = await async_setup_entry(hass, entry1)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/__init__.py", line 219, in async_setup_entry
|     hass.async_create_task(_discover_services(hass, entry))
|   def __init__(self, name, parent):
| RuntimeWarning: Enable tracemalloc to get the object allocation traceback
| /opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/mock.py:2252: RuntimeWarning: coroutine '_discover_services' was never awaited
| Coroutine created at (most recent call last)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/case.py", line 669, in run
|     self._callTestMethod(testMethod)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 102, in _callTestMethod
|     result = self._callMaybeAsync(method)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/unittest/async_case.py", line 128, in _callMaybeAsync
|     return self._asyncioRunner.run(
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/runners.py", line 127, in run
|     return self._loop.run_until_complete(task)
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 706, in run_until_complete
|     self.run_forever()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 677, in run_forever
|     self._run_once()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/base_events.py", line 2038, in _run_once
|     handle._run()
|   File "/opt/hostedtoolcache/Python/3.14.3/x64/lib/python3.14/asyncio/events.py", line 94, in _run
|     self._context.run(self._callback, *self._args)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/tests/unit_tests/test_init.py", line 367, in test_cache_stores_none_when_docker_services_absent
|     result2 = await async_setup_entry(hass, entry2)
|   File "/media/christoph/Projekte/PyCharm/core/config/custom_components/ssh_docker/__init__.py", line 219, in async_setup_entry
|     hass.async_create_task(_discover_services(hass, entry))
|   def __init__(self, name, parent):
| RuntimeWarning: Enable tracemalloc to get the object allocation traceback

This feels like an error that needs to be adressed, but the overall result is that all tests were successful.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 30, 2026

@copilot When I run run_workflows_locally.sh I see the following output:

...

Fixed in 7bdc8bf. The warning was caused by hass.async_create_task being a plain MagicMock — it received the _discover_services coroutine but never awaited or closed it, so Python's GC emitted the warning.

The fix changes _make_hass_for_setup() to use a lambda that closes the coroutine:

hass.async_create_task = lambda coro, *a, **kw: coro.close()

This explicitly discards the coroutine (matching what a real "fire and forget" background task would do in tests) and suppresses the warning. All 76 unit tests still pass.

@gensyn gensyn marked this pull request as ready for review March 30, 2026 07:24
@gensyn gensyn merged commit 3512785 into main Mar 30, 2026
5 checks passed
@gensyn gensyn deleted the copilot/update-docker-and-act branch March 30, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants