Skip to content

Commit

Permalink
fix: Happy fails with "Invalid run parameters: Configuration version …
Browse files Browse the repository at this point in the history
…is still being processed."
  • Loading branch information
alexlokshin-czi committed Feb 22, 2024
1 parent 096f448 commit 793aca3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions shared/workspace_repo/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,26 @@ func (s *TFEWorkspace) UploadVersion(ctx context.Context, targzFilePath string)
if err := s.tfc.ConfigurationVersions.Upload(ctx, configVersion.UploadURL, targzFilePath); err != nil {
return "", errors.Wrapf(err, "failed to upload configuration version for workspace %s; uploadUrl=%s; targzFilePath=%s", s.GetWorkspaceID(), configVersion.UploadURL, targzFilePath)
}

uploaded, err := util.IntervalWithTimeout(func() (bool, error) {
cv, err := s.tfc.ConfigurationVersions.Read(ctx, configVersion.ID)
if err != nil {
return false, errors.Wrapf(err, "Failed to retrieve configuration version")
}
if cv.Status != tfe.ConfigurationUploaded {
return false, errors.New("configuration version not uploaded yet")
}
return true, nil
}, 500*time.Millisecond, 1*time.Minute)

if err != nil {
return "", errors.Wrapf(err, "failed to upload configuration version")
}

if !*uploaded {
return "", errors.New("failed to upload configuration version")
}

return configVersion.ID, nil
}

Expand Down

0 comments on commit 793aca3

Please sign in to comment.