Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

sg: cloud ephemeral - handle multiple job reasons#62929

Merged
burmudar merged 3 commits into
mainfrom
wb/sg-handle-multiple-job-reasons
May 27, 2024
Merged

sg: cloud ephemeral - handle multiple job reasons#62929
burmudar merged 3 commits into
mainfrom
wb/sg-handle-multiple-job-reasons

Conversation

@burmudar

Copy link
Copy Markdown
Contributor

Sometimes cloud ephemeral can return multiple job reasons seperate by ;. In this PR we check for the presence of multiple job reasons and parse it accordingly.

Example of reason with multiple job reasons:

step 1/3:creating instance, job-url:https://github.com/sourcegraph/cloud/actions/runs/9255560228, state:completed, conclusion:failure; step 1/3:creating instance, job-url:https://github.com/sourcegraph/cloud/actions/runs/9177645150, state:completed, conclusion:failure; step 1/3:creating instance, job-url:https://github.com/sourcegraph/cloud/actions/runs/9161687255, state:completed, conclusion:failure

At the moment we're only interested in the last job and the overall status of all jobs.

Test plan

Tested locally

Failure

Name                                     Expires At           Status                                   JobURL
william-bezu-5-4-0                       n/a                  in-progress (1/3 creating instance, job-url:https://github.com/sourcegraph/cloud/actions/runs/9255560228, state:completed, conclusion:failure; step 1/3:creating instance, job-url:https://github.com/sourcegraph/cloud/actions/runs/9177645150, state:completed, conclusion:failure; step 1/3:creating instance) https://github.com/sourcegraph/cloud/actions/runs/9161687255 (completed)

Fixed

o run ./dev/sg cloud eph status --name william-bezu-5-4-0
✅ Ephemeral instance "william-bezu-5-4-0" status retrieved
Ephemeral instance details:
Name                                     Expires at           Status                                   Job count  Overall job status
william-bezu-5-4-0                       n/a                  in-progress (1/3 creating instance)      3          failure

Status with job no reason also still works

go run ./dev/sg cloud eph status --name wb-feature-x
✅ Ephemeral instance "wb-feature-x" status retrieved
Ephemeral instance details:
Name                                     Expires at           Status                                   Jobs  Overall job status
wb-feature-x                             2024-05-28T16:00:28Z completed                                0     completed
💡 Some names may be truncated. To see the full names use the --raw format
go run ./dev/sg cloud eph status --name william-bezu-5-4-0 --raw
✅ Ephemeral instance "william-bezu-5-4-0" status retrieved
Ephemeral instance details:
ID           : src-9cbb2cca0553c5bd2e67
Name         : william-bezu-5-4-0
InstanceType : internal
Environment  : dev
Version      : 5.4.0
URL          : https://william-bezu-5-4-0.sgdev.dev
AdminEmail   :
CreatedAt    : n/a
DeletetAt    : n/a
ExpiresAt    : n/a
Project      : src-096248487daeb92b4055
Region       : us-central1
Status       : in-progress
Step         : 1/3
Phase        : creating instance
JobURL       : https://github.com/sourcegraph/cloud/actions/runs/9161687255
JobState     : completed
Overall      : failure

@burmudar burmudar requested review from a team and filiphaftek May 27, 2024 13:53
@burmudar burmudar self-assigned this May 27, 2024
@cla-bot cla-bot Bot added the cla-signed label May 27, 2024
@burmudar burmudar enabled auto-merge (squash) May 27, 2024 16:39
@burmudar burmudar merged commit 57824e6 into main May 27, 2024
@burmudar burmudar deleted the wb/sg-handle-multiple-job-reasons branch May 27, 2024 16:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants