palantir / godel

Go tool for formatting, checking, building, distributing and publishing projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

upgrade-config fails from v1.2.0

gdearment opened this issue · comments

commented

When trying to run ./godelw upgrade-config, it fails for reasons that I would expect it to handle correctly:

➜  infra-images git:(develop) ✗ ./godelw upgrade-config
Failed to upgrade configuration:
	godel/config/dist-plugin.yml: failed to read config file: open ..../infra-images/godel/config/dist-plugin.yml: no such file or directory
	godel/config/format-plugin.yml: failed to read config file: open ..../infra-images/godel/config/format-plugin.yml: no such file or directory
	godel/config/license-plugin.yml: failed to read config file: open ..../infra-images/godel/config/license-plugin.yml: no such file or directory
	godel/config/test-plugin.yml: failed to read config file: open ..../infra-images/godel/config/test-plugin.yml: no such file or directory
	godel/config/check-plugin.yml: failed to read config file: open ..../infra-images/godel/config/check-plugin.yml: no such file or directory

Can you provide more detailed repro steps? When I run the workflow locally it seems to work:

➜  infra-images git:(develop) ./godelw version
godel version 1.2.0
➜  infra-images git:(develop) godelinit
Upgraded configuration for godel.yml
Upgraded configuration for format-plugin.yml
Upgraded configuration for test-plugin.yml
Upgraded configuration for check-plugin.yml
WARNING: The following configuration file(s) were non-empty and had no known upgraders for legacy configuration: [mockery.yml]
         If these configuration file(s) are for plugins, add the plugins to the configuration and rerun the upgrade task.
Failed to upgrade configuration:
	godel/config/dist-plugin.yml: failed to upgrade configuration: failed to unmarshal dist-plugin legacy configuration: yaml: unmarshal errors:
  line 51: field type not found in type legacy.Build
  line 142: field type not found in type legacy.Build
Error: exit status 1
➜  infra-images git:(develop) ✗ ./godelw version
godel version 2.0.0

(even though it says "error", that's because of the unknown plugin, which is fine/expected -- the other configuration is properly upgraded)

If you installed 2.0 manually for the project and are trying to upgrade the configuration, you'll need to run the upgrade-config task with the --legacy flag:

➜  infra-images git:(develop) ✗ ./godelw upgrade-config --help
Upgrade configuration

Usage:
  godel upgrade-config [flags]

Flags:
      --backup          back up files before overwriting or removing them
      --dry-run         print what the upgrade operation would do without writing changes
  -h, --help            help for upgrade-config
      --legacy          upgrade pre-2.0 legacy configuration
      --print-content   print the content of the changes to stdout in addition to writing them

This is required to upgrade pre-2.0 configuration to 2.0 configuration (every other config upgrade after that will not require this flag)

Can't repro based on my testing -- if you have further information please let me know, but closing for now.