[8.x] ci(deploy): dead deploy fix script (#195753) (#195800)

# Backport

This will backport the following commits from `main` to `8.x`:
- [ci(deploy): dead deploy fix script
(#195753)](https://github.com/elastic/kibana/pull/195753)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2024-10-10T15:29:49Z","message":"ci(deploy):
dead deploy fix script (#195753)\n\nThis fixes edge case with dead
deploys failing current server deploy\r\njobs in
https://github.com/elastic/kibana/pull/191898","sha":"bc75d03f5ca01889a4a7813f8abbeeee239921c3","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Operations","release_note:skip","v9.0.0","backport:prev-major"],"title":"ci(deploy):
dead deploy fix
script","number":195753,"url":"https://github.com/elastic/kibana/pull/195753","mergeCommit":{"message":"ci(deploy):
dead deploy fix script (#195753)\n\nThis fixes edge case with dead
deploys failing current server deploy\r\njobs in
https://github.com/elastic/kibana/pull/191898","sha":"bc75d03f5ca01889a4a7813f8abbeeee239921c3"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195753","number":195753,"mergeCommit":{"message":"ci(deploy):
dead deploy fix script (#195753)\n\nThis fixes edge case with dead
deploys failing current server deploy\r\njobs in
https://github.com/elastic/kibana/pull/191898","sha":"bc75d03f5ca01889a4a7813f8abbeeee239921c3"}}]}]
BACKPORT-->

Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
This commit is contained in:
Kibana Machine 2024-10-11 04:42:53 +11:00 committed by GitHub
parent 4b9dae83a7
commit ae803ed659
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -51,7 +51,7 @@ fi
if is_pr_with_label "ci:cloud-redeploy"; then
echo "--- Shutdown Previous Deployment"
CLOUD_DEPLOYMENT_ID=$(ecctl deployment list --output json | jq -r '.deployments[] | select(.name == "'$CLOUD_DEPLOYMENT_NAME'") | .id')
if [ -z "${CLOUD_DEPLOYMENT_ID}" ]; then
if [ -z "${CLOUD_DEPLOYMENT_ID}" ] || [ "${CLOUD_DEPLOYMENT_ID}" == "null" ]; then
echo "No deployment to remove"
else
echo "Shutting down previous deployment..."

View file

@ -56,7 +56,7 @@ deploy() {
PROJECT_ID=$(jq -r '[.items[] | select(.name == "'$PROJECT_NAME'")] | .[0].id' $PROJECT_EXISTS_LOGS)
if is_pr_with_label "ci:project-redeploy"; then
if [ -z "${PROJECT_ID}" ]; then
if [ -z "${PROJECT_ID}" ] || [ "${PROJECT_ID}" == "null" ]; then
echo "No project to remove"
else
echo "Shutting down previous project..."