Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: astro deploy status #1086

Closed
2 of 4 tasks
sunkickr opened this issue Feb 16, 2023 · 4 comments
Closed
2 of 4 tasks

CLI: astro deploy status #1086

sunkickr opened this issue Feb 16, 2023 · 4 comments

Comments

@sunkickr
Copy link
Contributor

sunkickr commented Feb 16, 2023

✍️ Is your feature request related to a problem? Please describe.

Today when you run astro deploy you don't know if your code was applied correctly. If docker push was successful you get a success message but issues after he push could cause your deploy to not work or for your deployment to become unsuccessful.

🧩 Describe the solution you'd like

The astro deploy command should always give you the status of your deployment after a deploy wether that is healthy, unhealthy, unknown, or creating. If the status is deploying the CLI should continually poll until it receives a healthy or unhealthy status. Unknown should be displayed but only if it is continuously received. The point of polling and showing status is so that users know that their changes were successfully applied after a deploy. If possible user should be told why their deployment become unhealthy.

Examples:

Successful deploy - astro deploy --wait:

Successfully pushed Docker image to Astronomer registry.

Deployment my-deployment is currently deploying... This may take a few minutes.

Your Deploy has finished Successfully.
NAME                 my-deployment
DEPLOYMENT ID        cl8bx6swa178701iz1tesba3u9
DEPLOYMENT STATUS    HEALTHY
DOCKER IMAGE TAG     deploy-2022-08-11T14-22 # this is ideally the tag currently being run in the webserver 
RUNTIME VERSION      6.0.0 (based on Airflow 2.4.0)

Deployment can be accessed at the following URLs: 

 Deployment Dashboard: cloud.astronomer-dev.io/ckmzjm22937931d35puw3tcdo/deployments/cl8bx6swa178701iz1tesba3u9
 Airflow Dashboard: astronomer.astronomer-dev.run/desba3u9?orgId=org_dlgevirUCwI9vX10

Unsuccessfully deploy - astro deploy --wait - webserver crashes after deploy

Successfully pushed Docker image to Astronomer registry.

Deployment my-deployment is currently deploying... This may take a few minutes.

ERROR: The Deploy was unsucessful. The Deployment my-deployment is unhealthy:
Your Deployment’s webserver is not reponding

Deployment Information
NAME                 my-deployment
DEPLOYMENT ID        cl8bx6swa178701iz1tesba3u9
DEPLOYMENT STATUS    UNHEALTHY
DOCKER IMAGE TAG     deploy-2022-08-11T14-22 # this is ideally the tag currently being run in the webserver 
RUNTIME VERSION      6.0.0 (based on Airflow 2.4.0)

Check it out at the Deployment URLs below, debug, and try deploying again with 'astro deploy --wait': 

Deployment Dashboard: cloud.astronomer-dev.io/ckmzjm22937931d35puw3tcdo/deployments/cl8bx6swa178701iz1tesba3u9
Airflow Dashboard: astronomer.astronomer-dev.run/desba3u9?orgId=org_dlgevirUCwI9vX10

Unsuccessfully deploy - astro deploy --wait - docker push failed(status should show even code doesn't get deployed):

ERROR: Permssioned Denied:

There was an error while pushing your docker image. Your deployment will not update

Deployment Information
NAME                 my-deployment
DEPLOYMENT ID        cl8bx6swa178701iz1tesba3u9
DEPLOYMENT STATUS    HEALTHY
DOCKER IMAGE TAG     deploy-2022-08-11T14-22 # this is ideally the tag currently being run in the webserver 
RUNTIME VERSION      6.0.0 (based on Airflow 2.4.0)

Check it out at the Deployment URLs below, debug, and try deploying again with 'astro deploy --wait': 

Deployment Dashboard: cloud.astronomer-dev.io/ckmzjm22937931d35puw3tcdo/deployments/cl8bx6swa178701iz1tesba3u9
Airflow Dashboard: astronomer.astronomer-dev.run/desba3u9?orgId=org_dlgevirUCwI9vX10

🤔 Describe alternatives you've considered

Is your feature request specific to a particular Astronomer Platform?

  • Astro
  • Software
  • None/Unknown

💡 Additional context

#4 in solution alignment in this document: https://www.notion.so/astronomerio/CLI-Deploy-Feedback-ec283f96a86348a9b61941e00f469603

@sunkickr
Copy link
Contributor Author

The deployment should only wait for healthy status if the users uses the --wait flag(like in create). Make sure changes don't cause users to loose information

@adammarples
Copy link

I would add that I've been working around this by polling the astro deployment inspect --key metadata.status and have been running into issues because it takes the api about 25 seconds to even realise it is DEPLOYING after the deploy command runs, so it reports that it is HEALTHY when I poll.

Therefore I'm in the odd situation of first having to poll for it to begin being in DEPLOYING status, then check for HEALTHY. This is critical for actually having reliable deployments in CICD that can be automatically tested.

status-check () {
  # Keep polling until deployment reaches desired status
  until {
    local health=$(astro deployment inspect --clean-output --workspace-id $ASTRO_WORKSPACE_ID --deployment-name $ASTRO_DEPLOYMENT_NAME -k metadata.status)
    echo "status: $health, waiting for $1"
    test "$health" = "$1"
  }
  do
    echo "Retrying in $2 seconds..."
    sleep $2
  done
}

status-check "DEPLOYING" 1
status-check "HEALTHY" 10

@kushalmalani
Copy link
Contributor

@adammarples This should be addressed and the wait flag should come out in 1.18 release next week. You no longer would need additional polling since the CLI now would do this for you.

Usually once your deploy is successfully pushed from CLI, the api goes into deploying state immediately once all validations are passed and it takes a few minutes for it to finish deploying. When you upgrade to 1.18 and if you see any issues, feel free to create a github issue and we can look into it.

@adammarples
Copy link

Thank you very much @kushalmalani

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants