Closed radu-matei closed 6 years ago
This might be due to the recent change merged into master: #658. Can you try rebasing off master, recompile Draft, rm -rf ~/.draft
and re-run draft init
?
I'm off master, up to date.
Same thing with draft init
:
$ draft init
Installing default plugins...
Error: error unmarshaling JSON: json: cannot unmarshal string into Go struct field Metadata.
hooks of type plugin.Hooks
Oh! It might be due to CI not being hooked up once we moved over to https://github.com/draftcreate/draft-pack-repo, so the latest changes merged into draft-pack-repo might not have been published yet. Lemme see if I can reproduce.
If that's the case then once @michelleN's done hooking up CI, this should be fixed.
oh hrm, it's actually because draft init
installs 0.3.1 no matter if you use the canary release of draft or not.
><> cat ~/.draft/cache/plugins/https-github.com-Azure-draft-pack-repo/plugin.yaml
name: "pack-repo"
version: "0.3.1"
usage: "The Draft pack repository plugin"
description: "The Draft pack repository plugin"
command: "$DRAFT_PLUGIN_DIR/bin/pack-repo"
hooks:
install: "$DRAFT_PLUGIN_DIR/scripts/get.sh"
I forgot we changed that in #490. In that case, we'll need to cut a new release of draft-pack-repo with powershell support then bump https://github.com/Azure/draft/blob/779c70aee94704aba978136b7a7a88c9881f8a21/pkg/plugin/builtins.go#L12 to 0.4.0.
Thanks for looking into this, @bacongobbler!
quick workaround until we've released 0.4.0:
><> draft init
Installing default plugins...
Error: error unmarshaling JSON: json: cannot unmarshal string into Go struct field Metadata.hooks of type plugin.Hooks
><> rm -rf ~/.draft/cache/plugins/https-github.com-Azure-draft-pack-repo
><> rm -rf ~/.draft/plugins/draft-pack-repo
><> git clone https://github.com/Azure/draft-pack-repo $GOPATH/src/github.com/Azure/draft-pack-repo
><> cd draft-pack-repo
><> make bootstrap
><> make
><> vim plugin.yaml # remove the install hooks
><> cd ..
><> draft plugin install ./draft-pack-repo
v0.4.0 has been released! Please rebase off master and it should start working again. If not let's re-open this. Thanks!
Didn't have time to investigate what's happening, but here's the output:
$ draft init
Installing default plugins...
Downloading https://azuredraft.blob.core.windows.net/draft/pack-repo-0.4.0-darwin-amd64.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 215 100 215 0 0 370 0 --:--:-- --:--:-- --:--:-- 370
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.
!!! Failed to install draft-pack-repo
!!! For support, go to https://github.com/draftcreate/draft-pack-repo.
Error: plugin install hook for "pack-repo" exited with error
Seems like circleci for draft-pack-repo isn't uploading tags. For now I've manually uploaded the release assets up to blob storage, but I'll open a ticket in draft-pack-repo to automate this process. I'll update this ticket once the assets have been uploaded.
Done.
Is this really fixed?
I'm having the same issue on 0.15.0:
draft version
failed to load plugins: error unmarshaling JSON: json: cannot unmarshal string into Go struct field Metadata.hooks of type plugin.Hooks&version.Version{SemVer:"v0.15.0", GitCommit:"9d73889a1318a435d126bc5df846610d30cfbe7f", GitTreeState:"clean"}
@sabbour - did you upgrade Draft from a previous version?
If you have anything important, you could back-up ~/.draft
, remove that directory and draft up
again.
The issue appears because of older config files whose structure changed in newer versions.
Try deleting ~/.draft
and let us know what happens.
@radu-matei I deleted draft using brew uninstall --force draft
and then installed it again and still faced the issue.
It got fixed when I followed the workaround above https://github.com/Azure/draft/issues/682#issuecomment-383211295
Can we have a look at this?
Yeah, I'm not sure if brew uninstall
deletes the ~/.draft
directory
brew uninstall
does not or cannot delete anything under $HOME so that has to be cleaned up manually
How to reproduce:
draft version