incident-io / catalog-importer

Import data into the incident.io Catalog from a variety of sources.
MIT License
15 stars 6 forks source link

Improve error messaging when files missing #48

Open tragiclifestories opened 1 year ago

tragiclifestories commented 1 year ago

given a pipeline:

{
  sync_id: 'backstage',
  pipelines: [
    {
      sources: [
        {
          'local': {
            files: [
              'catalog-info.yaml',
            ],
          },
        },
      ],
    },
  ]
}

If the catalog-info.yaml file is not found, the import proceeds, but (in this case at least, when there are no other files) you get an error:

catalog-importer: error: outputs (type_name = 'Custom["BackstageComponent"]'): found 0 matching entries and would delete everything but --allow-delete-all not set

In my opinion, importing a non-existent local file should be a hard error as soon as you stat it - it's almost certainly something that needs attention.

PS:

I got into this situation because I was expecting the local paths to be relative to the pipeline file, but they seem to be relative to the directory where you're invoking the binary. I leave this as a discussion point - people may have different expectations around this, and it would obviously be a breaking change.

DuffleOne commented 4 months ago

Hi there!

Sorry for the delay on this, we agree that referencing files that are not found should explicitly error early in the process, and now it does :)

Let us know if you have any follow up on this!

In regards to relative file paths, I do agree that it is not super explicit where the base path starts, I think we should follow Go itself in their model of the base path being where the binary is executed from. But I do encourage that discussion ^^