Skip to content

Commit

Permalink
dont wait forever revlink warmup, wait 15 seconds
Browse files Browse the repository at this point in the history
display a success message for revlink, even if it was fast
  • Loading branch information
tphoney committed Dec 16, 2024
1 parent 9bd7af4 commit 93ebabe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- main

jobs:
# this tests the basic commands without checking the output
actions:
runs-on: depot-ubuntu-22.04-4
env:
Expand Down Expand Up @@ -83,6 +84,9 @@ jobs:
echo "E2E Tests Complete"
# this runs 2 commands that require user input,
# the `overmind terraform plan` subcommand has to be run first and succeed before the `overmind terraform apply` subcommand can be run
# the lost pixel tapes have built in sleeps to wait for commands to complete
interactive:
runs-on: depot-ubuntu-22.04-4
env:
Expand Down Expand Up @@ -140,7 +144,7 @@ jobs:
terraform init
cp -a $(which terraform) . # provide a terraform binary to the containers below
# see the workflow file for an explanation of what is happening here
docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_SESSION_TOKEN -e HONEYCOMB_API_KEY -e OVM_API_KEY -e TEABUG -v $PWD:/vhs -v ~/.aws:/root/.aws ghcr.io/charmbracelet/vhs /vhs/.github/e2eplan.tape
docker run --rm -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_DEFAULT_REGION -e AWS_REGION -e AWS_SESSION_TOKEN -e HONEYCOMB_API_KEY -e OVM_API_KEY -e TEABUG -v $PWD:/vhs -v ~/.aws:/root/.aws ghcr.io/charmbracelet/vhs /vhs/.github/e2eapply.tape
Expand Down
4 changes: 4 additions & 0 deletions cmd/pterm.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ func RunRevlinkWarmup(ctx context.Context, oi sdp.OvermindInstance, postPlanPrin

if spinner != nil {
spinner.Success("Discovered and linked all resources")
} else {
// if we didn't have a spinner, print a success message
// this can happen if the terminal is not available, or if the revlink warmup is very fast
pterm.Success.Println("Discovered and linked all resources")
}

return nil
Expand Down
17 changes: 13 additions & 4 deletions cmd/terraform_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,19 @@ func TerraformPlanImpl(ctx context.Context, cmd *cobra.Command, oi sdp.OvermindI

resourceExtractionSpinner.Success()

// wait for the revlink warmup to finish before we update the planned changes
err = revlinkPool.Wait()
if err != nil {
return fmt.Errorf("error waiting for revlink warmup: %w", err)
// wait for the revlink warmup for 15 seconds. if it takes longer, we'll just continue
waitCh := make(chan error, 1)
go func() {
waitCh <- revlinkPool.Wait()
}()

select {
case err = <-waitCh:
if err != nil {
return fmt.Errorf("error waiting for revlink warmup: %w", err)
}
case <-time.After(15 * time.Second):
pterm.Info.Print("Done waiting for revlink warmup")
}

///////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 93ebabe

Please sign in to comment.