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

ensuring error status 1 occurs when deployment fails #1072

Merged
merged 3 commits into from
Dec 15, 2021

Conversation

danaelhe
Copy link
Member

@danaelhe danaelhe commented Dec 14, 2021

Per #1071, this PR ensures a status error of 1 occurs when the app is created, but the deployment fails. It changes this:

danaelhertani@xxx doctl % go run cmd/doctl/main.go  apps create --upsert --spec app-spec.yml --wait --verbose                            
Notice: App already exists, updating
Notice: App creation is in progress, waiting for app to be running
Warning: App deployment couldn't enter `running` state: GET https://api.digitalocean.com/v2/apps/<APP-ID>/deployments/: 400 (request "<REQ-ID>") invalid uuid
ID                                      Spec Name             Default Ingress                                        Active Deployment ID                    In Progress Deployment ID    Created At                       Updated At
<APP-ID>   sample-golang-test    https://sample-golang-test.ondigitalocean.app    <DEPLOYMENT-ID>                                 2021-12-14 18:19:39 +0000 UTC    2021-12-14 18:36:45.711987968 +0000 UTC
danaelhertani@xxx doctl % echo $?
0

to this:

danaelhertani@xxx doctl % go run cmd/doctl/main.go  apps create --upsert --spec app-spec.yml --wait --verbose
Notice: App already exists, updating
Notice: App creation is in progress, waiting for app to be running
ID                                      Spec Name             Default Ingress                                        Active Deployment ID                    In Progress Deployment ID    Created At                       Updated At
<APP-ID>    sample-golang-test    https://sample-golang-test.ondigitalocean.app    <DEPLOYMENT-ID>                                 2021-12-14 18:19:39 +0000 UTC    2021-12-14 18:49:59.897000821 +0000 UTC
Error: 1 error occurred:
        * app deployment couldn't enter `running` state: GET https://api.digitalocean.com/v2/apps/<APP-ID>/deployments/: 400 (request "<REQ-ID>") invalid uuid


exit status 1
danaelhertani@xxx doctl % echo $?
1

Notice, the warning is turned to an error but we're able to keep the output of the app information. The error status also becomes 1.

Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

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

👍 Nice stuff!

I did leave a suggestion inline as well.

commands/apps.go Outdated Show resolved Hide resolved
app-spec.yml Outdated Show resolved Hide resolved
Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

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

👍

@danaelhe danaelhe merged commit 2fcbadc into main Dec 15, 2021
@ChiefMateStarbuck ChiefMateStarbuck deleted the fix-apps-create-error branch March 7, 2022 14:53
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.

None yet

2 participants