added ability to run actions after deploy with maintenance-off#80
added ability to run actions after deploy with maintenance-off#80TomasLudvik wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional post-deploy hook that runs after maintenance-off, and documents the change for upgrades.
Changes:
- Run
build-deploy-part-3-non-blockingPhing target after maintenance is turned off (only if the target exists). - Add upgrade note describing the new post-deploy behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| deploy/parts/deploy.sh | Detects availability of a Phing target and runs non-blocking post-deploy tasks after maintenance-off. |
| UPGRADE.md | Documents the new deploy behavior for upgrading from v5.0.0 to v5.1.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if kubectl exec ${RUNNING_WEBSERVER_PHP_FPM_POD} --namespace=${PROJECT_NAME} -- ./phing -l 2>/dev/null | grep -q "build-deploy-part-3-non-blocking"; then | ||
| echo -n "Run non-blocking post-deploy tasks " | ||
| runCommand "FAILED" "kubectl exec ${RUNNING_WEBSERVER_PHP_FPM_POD} --namespace=${PROJECT_NAME} -- ./phing build-deploy-part-3-non-blocking" |
There was a problem hiding this comment.
The existence check for the Phing target suppresses all stderr and also treats any kubectl exec failure the same as “target not present” (the step will be silently skipped). This can hide real deployment issues (e.g., exec failing due to pod/container problems) and make post-deploy behavior non-deterministic.
Consider capturing the output and exit code of kubectl exec separately: only skip when the command succeeds but the target is not listed; otherwise surface a warning/failure. Also prefer a fixed-string match (e.g., grep -F) and/or anchoring to avoid accidental substring matches.
| if kubectl exec ${RUNNING_WEBSERVER_PHP_FPM_POD} --namespace=${PROJECT_NAME} -- ./phing -l 2>/dev/null | grep -q "build-deploy-part-3-non-blocking"; then | |
| echo -n "Run non-blocking post-deploy tasks " | |
| runCommand "FAILED" "kubectl exec ${RUNNING_WEBSERVER_PHP_FPM_POD} --namespace=${PROJECT_NAME} -- ./phing build-deploy-part-3-non-blocking" | |
| echo -n "Check non-blocking post-deploy target " | |
| PHING_TARGET_LIST_OUTPUT=$(kubectl exec ${RUNNING_WEBSERVER_PHP_FPM_POD} --namespace=${PROJECT_NAME} -- ./phing -l 2>&1) | |
| PHING_TARGET_LIST_EXIT_CODE=$? | |
| if [ ${PHING_TARGET_LIST_EXIT_CODE} -ne 0 ]; then | |
| echo -e "[${RED}ERROR${NO_COLOR}]" | |
| echo "${PHING_TARGET_LIST_OUTPUT}" | |
| slack_notification "error" | |
| exit 1 | |
| fi | |
| if printf '%s\n' "${PHING_TARGET_LIST_OUTPUT}" | grep -Eq '^[[:space:]]*build-deploy-part-3-non-blocking([[:space:]]|$)'; then | |
| echo -e "[${GREEN}OK${NO_COLOR}]" | |
| echo -n "Run non-blocking post-deploy tasks " | |
| runCommand "FAILED" "kubectl exec ${RUNNING_WEBSERVER_PHP_FPM_POD} --namespace=${PROJECT_NAME} -- ./phing build-deploy-part-3-non-blocking" | |
| else | |
| echo -e "[${YELLOW}SKIP${NO_COLOR}]" | |
| echo "" | |
| echo "Phing target build-deploy-part-3-non-blocking is not available and will be skipped." |
No description provided.