feat(deploy): gitea sha-watch safety net - reload-only deploys [#734]
REST sensor polls master HEAD (scoped read token in host secrets); sha change -> pull + reload_all, no core bounce. Webhook stays the fast path pending gitea ALLOWED_HOST_LIST widening (CGNAT target). Detail: https://projects.knownelement.com/issues/734
This commit is contained in:
+47
-1
@@ -256,7 +256,7 @@
|
||||
+ (trigger.json.commits | default([]) | map(attribute='removed') | flatten | list)
|
||||
+ (trigger.json.commits | default([]) | map(attribute='modified') | flatten | list) }}
|
||||
need_restart: >-
|
||||
{{ changed_files | select('in', ['configuration.yaml', 'packages/plant_snmp.yaml']) | list | count > 0 }}
|
||||
{{ changed_files | select('match', '^(configuration\.yaml|packages/.+)') | list | count > 0 }}
|
||||
push_message: >-
|
||||
Git push ({{ trigger.json.sender.login | default('unknown') }}):
|
||||
{{ trigger.json.commits | default([]) | map(attribute='message') | join(' | ') | truncate(120) }}.
|
||||
@@ -315,3 +315,49 @@
|
||||
data:
|
||||
title: PFV deploy complete
|
||||
message: "Pulled + reloaded YAML at {{ now().strftime('%H:%M:%S') }} - no core restart. Files: {{ changed_files | join(', ') | truncate(120) }}"
|
||||
# Deploy pipeline safety net [#734]: polls gitea master HEAD (rest sensor
|
||||
# in packages/deploy_pipeline.yaml) and applies pulls reload-only. The
|
||||
# gitea webhook is the fast path once gitea's SSRF allowlist permits
|
||||
# pfv-bms.knel.net; until then this net catches every push within 5 min
|
||||
# with NO core restart. Restarts for new platform sensors stay manual
|
||||
# (22222 shell) until the webhook path is live.
|
||||
- id: pfv_deploy_sha_watch
|
||||
alias: PFV deploy - gitea sha watch safety net
|
||||
description: >-
|
||||
Master HEAD sha changed -> pull + reload_all, no core restart.
|
||||
Interim deploy trigger while gitea webhook delivery is blocked by
|
||||
its SSRF host allowlist [#734].
|
||||
mode: single
|
||||
max_exceeded: silent
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id: sensor.pfv_deploy_gitea_master_head
|
||||
not:
|
||||
- unknown
|
||||
- unavailable
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{{ trigger.from_state is not none
|
||||
and trigger.from_state.state not in ['unknown', 'unavailable']
|
||||
and trigger.to_state is not none
|
||||
and trigger.from_state.state != trigger.to_state.state }}
|
||||
actions:
|
||||
- action: hassio.addon_restart
|
||||
data:
|
||||
addon: core_git_pull
|
||||
- delay:
|
||||
hours: 0
|
||||
minutes: 0
|
||||
seconds: 20
|
||||
- action: homeassistant.reload_all
|
||||
- action: notify.send_message
|
||||
target:
|
||||
entity_id:
|
||||
- notify.ultix_sidecar_new
|
||||
- notify.allthes_ipad
|
||||
data:
|
||||
title: PFV deploy (sha watch)
|
||||
message: >-
|
||||
New master HEAD pulled + reloaded at {{ now().strftime('%H:%M:%S') }}
|
||||
- no core restart. HEAD {{ states('sensor.pfv_deploy_gitea_master_head')[:7] }}
|
||||
|
||||
Reference in New Issue
Block a user