mauroc / squiddio_pi

squiddio_pi
3 stars 13 forks source link

.travis.yml encrypted key - problem for PI Dev using Windows #92

Closed rgleason closed 4 years ago

rgleason commented 4 years ago

Creating the travisCI encrypted key necessary for the .travis.yml file requires a Windows developer to install Virtualbox, then install Ubuntu and travisCI, then learn how to create an encrypted key from the github personnal token that is intended for the plugin.

This is a time consuming and wasteful approach, which makes the use of .travis.yml pretty useless for Windows developers. Unless there is an easier and better way to do travis.yml key encryption, my suggestion is to drop travis if at all possible.

I know several windows developers that have not used travis because of this problem. While someone else can create the key, it is not a secure way to do that.

leamas commented 4 years ago

hm... Installation instructions for the travis tool (written in ruby) are available at https://github.com/travis-ci/travis.rb. There should be no need for a linux box for this. Have this been tried?

As I understand it, the travis cli tool is the only piece of software required to encrypt travis keys.

rgleason commented 4 years ago

Thanks, I will give it a try. (Petri helped me install ubuntu and travisci, which I had done before, but neveretheless it was still a challenge, and not of interest to Windows Devs).

I'll let you know how it goes.

rgleason commented 4 years ago

https://github.com/travis-ci/travis.rb#windows Downloaded and installed Ruby+Devkit 2.6.X (x64) Installed all 3 options, takes up 1.2gb. Then tried to follow https://github.com/travis-ci/travis.rb#installation

ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]

C:\Users\Rick>gem install travis -v 1.8.10 --no-rdoc --no-ri
ERROR:  While executing gem ... (OptionParser::InvalidOption)
    invalid option: --no-rdoc

C:\Users\Rick>travis version
'travis' is not recognized as an internal or external command,
operable program or batch file.
rgleason commented 4 years ago

This is ridiculous and IMHO puts travis at the bottom of the list for me. Install ruby 1.2 gb Then I have to install travis CI? That is not clear to me for Windows. https://github.com/travis-ci/travis.rb/issues/679

I ask why doesn't the website just have a page to allow users to encrypt as has been done by circleci and appveyor?

This is a real PITA for Windows PI maintainers.

leamas commented 4 years ago

First, this issue should really been filed against travis.rb -- the problem is that the windows installation instructions at https://github.com/travis-ci/travis.rb#installation doesn't work for you. It's certainly not a problem in the squiddio code.

Secondly, I would try dropping the options. A quick look at the gem install manpage at https://guides.rubygems.org/command-reference/#gem-install seems to indicate that instead of a --no-rdoc option there is now a separate rdoc target. Likewise, the --no-ri option is now an option to gem rdoc.

So, in short: try gem install travis. In any case: file a bug against travis.rb.

And close this issue, since its not really about the squiddio code. Of course, if it is really impossible to install and use the travis cli tool on windows there might be a need to use something else. But then you need to motivate it thoroughly and give the travis maintainers a chance to reply on the travis.rb bug.

leamas commented 4 years ago

Installing the travis gem works out of the box for me. Using latest RubyInstaller without installing the msys2 addon. Logs after RubyInstaller NSIS installation completed:

$ ruby --version
ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]
$ gem install travis 
$ travis --version
1.8.10
$ travis encrypt --help
Encrypts values for the .travis.yml.
Usage: travis encrypt [ARGS..] [OPTIONS]
[...] Lot's of options...

Ergo: There is no need for a Linux box just to encrypt the travis key.

rgleason commented 4 years ago

Alec, Yes, it does appear to work, using the ruby command prompt with admin privileges, and

$ ruby --version
$ ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]
$ gem install travis 
   Downloads and installs even more files.
$ travis --version
$ 1.8.10
$ travis encrypt --help

I will try an encryption. When you installed Ruby, what of the 3 options did you include?

Using latest RubyInstaller without installing the msys2 addon.

Now the C:/Ruby26-x64 folder is over 1 GB and 3500 files and folders. Why can't they have a web page for encryption?

rgleason commented 4 years ago

From the Ruby Command Prompt I tried

echo <my github personnal token for squiddio> | travis encrypt -r rgleason/squiddio_pi --org and the response was

Please add the following to your .travis.yml file:
secure: "<a travis encryption key that did not match my original key>"
Pro Tip: You can add it automatically by running with --add.

Is this a problem, not getting the same encryption key as before when I used travisCI with ubuntu?

rgleason commented 4 years ago

Ok, so now I'll write a page about this in the Dev Manual.

BTW Thanks.

leamas commented 4 years ago

.... and close the bug? As filed it was about requiring a Linux VM to encrypt keys. Which, as it turns out, was plain wrong, right?

leamas commented 4 years ago

I only installed Ruby, no add-ons

rgleason commented 4 years ago

New Page added to the Dev Wiki here. https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:developer_manual:plugins:plugin_installer_travis

Also linked to from this page https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:developer_manual:plugins:plugin_installer