Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/workflows/cli-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ jobs:
run: make build
- name: Run Tests
run: make test-coverage
- name: Upload Coverage Report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: all.coverprofile
flags: unittests
fail_ci_if_error: true
other-os-build:
strategy:
matrix:
Expand Down
14 changes: 12 additions & 2 deletions pkg/project/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (s *Batch) Run(stop <-chan bool, updates chan<- ServiceRunUpdate, env map[s
go func() {
err := cmd.Start()
if err != nil {
errChan <- err
errChan <- fmt.Errorf("error starting service %s: %w", s.Name, err)
} else {
updates <- ServiceRunUpdate{
ServiceName: s.Name,
Expand All @@ -118,7 +118,17 @@ func (s *Batch) Run(stop <-chan bool, updates chan<- ServiceRunUpdate, env map[s
}

err = cmd.Wait()
errChan <- err
if err != nil {
// provide runtime errors as a run update rather than as a fatal error
updates <- ServiceRunUpdate{
ServiceName: s.Name,
Label: "nitric",
Status: ServiceRunStatus_Error,
Err: err,
}
}

errChan <- nil
}()

go func(cmd *exec.Cmd) {
Expand Down
18 changes: 14 additions & 4 deletions pkg/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ func (p *Project) RunServicesWithCommand(localCloud *cloud.LocalCloud, stop <-ch
group.Go(func() error {
port, err := localCloud.AddService(svc.GetFilePath())
if err != nil {
return err
return fmt.Errorf("unable to add service %s: %w", svc.GetFilePath(), err)
}

envVariables := map[string]string{
Expand All @@ -434,7 +434,12 @@ func (p *Project) RunServicesWithCommand(localCloud *cloud.LocalCloud, stop <-ch
envVariables[key] = value
}

return svc.Run(stopChannels[idx], updates, envVariables)
err = svc.Run(stopChannels[idx], updates, envVariables)
if err != nil {
return fmt.Errorf("%s: %w", svc.GetFilePath(), err)
}

return nil
})
}

Expand All @@ -456,7 +461,7 @@ func (p *Project) RunBatchesWithCommand(localCloud *cloud.LocalCloud, stop <-cha
group.Go(func() error {
port, err := localCloud.AddBatch(svc.GetFilePath())
if err != nil {
return err
return fmt.Errorf("unable to add batch %s: %w", svc.GetFilePath(), err)
}

envVariables := map[string]string{
Expand All @@ -469,7 +474,12 @@ func (p *Project) RunBatchesWithCommand(localCloud *cloud.LocalCloud, stop <-cha
envVariables[key] = value
}

return svc.Run(stopChannels[idx], updates, envVariables)
err = svc.Run(stopChannels[idx], updates, envVariables)
if err != nil {
return fmt.Errorf("%s: %w", svc.GetFilePath(), err)
}

return nil
})
}

Expand Down
14 changes: 12 additions & 2 deletions pkg/project/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (s *Service) Run(stop <-chan bool, updates chan<- ServiceRunUpdate, env map
go func() {
err := cmd.Start()
if err != nil {
errChan <- err
errChan <- fmt.Errorf("error starting service %s: %w", s.Name, err)
} else {
updates <- ServiceRunUpdate{
ServiceName: s.Name,
Expand All @@ -289,7 +289,17 @@ func (s *Service) Run(stop <-chan bool, updates chan<- ServiceRunUpdate, env map
}

err = cmd.Wait()
errChan <- err
if err != nil {
// provide runtime errors as a run update rather than as a fatal error
updates <- ServiceRunUpdate{
ServiceName: s.Name,
Label: "nitric",
Status: ServiceRunStatus_Error,
Err: err,
}
}

errChan <- nil
}()

go func(cmd *exec.Cmd) {
Expand Down
Loading