Skip to content

added ability to run actions after deploy with maintenance-off#80

Open
TomasLudvik wants to merge 1 commit intomainfrom
TL/after-deploy-actions
Open

added ability to run actions after deploy with maintenance-off#80
TomasLudvik wants to merge 1 commit intomainfrom
TL/after-deploy-actions

Conversation

@TomasLudvik
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 16, 2026 13:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-blocking Phing 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.

Comment thread deploy/parts/deploy.sh
Comment on lines +217 to +219
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"
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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."

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henzigo Can you check this, please?

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.

3 participants