sgnl05 / sgnl05-sssd

Puppet module for SSSD
https://forge.puppet.com/sgnl05/sssd
GNU General Public License v3.0
17 stars 76 forks source link

Make travis auto deploy to the forge #14

Closed edestecd closed 7 years ago

edestecd commented 8 years ago

It would be nice to have travis ci auto deploy new versions to the forge, whenever we create a new tag. I have seen a few modules around that do this. It seems like travis has some fairly easy setup for this.

sgnl05 commented 8 years ago

Yes, that would be nice. I'll look into it, unless you have nice recipe.. ;)

sgnl05 commented 8 years ago

This commit from another module looks interesting: https://github.com/unibet/puppet-forge_server/commit/096b1d31bc8decca309cd8ea72fc3932f02ea77c

Not sure tho how Forge username and password is hashed.

edestecd commented 8 years ago

Yea I saw it in a unibet module as well: https://github.com/unibet/puppet-vagrant You probably set up the key on the travis site with environment vars etc... However, puppetforge is not listed here: https://docs.travis-ci.com/user/deployment/

I've seen this before. I suspect it is the underlying mechanism that travis uses. https://github.com/travis-ci/dpl#puppet-forge

I wonder if puppetforge just hasn't made it to the documentation yet.

edestecd commented 8 years ago

We can probably just follow along with one of the other providers that uses a username/pass... https://docs.travis-ci.com/user/deployment/appfog

Encrypting the pass is done with the travis tool, available as a gem: https://blog.travis-ci.com/2013-01-14-new-client/

sgnl05 commented 7 years ago

I've made a branch named autodeploy with the changes I think is necessary (based on https://github.com/voxpupuli/puppet-zabbix/blob/master/.travis.yml). If it looks right to you, can you please merge it and test a deploy next time we have something to release?

edestecd commented 7 years ago

What does this option do? https://github.com/voxpupuli/puppet-zabbix/blob/master/.travis.yml#L42

That is the only thing that does not make sense to me...

edestecd commented 7 years ago

Its a branch here for travis deploy: https://github.com/travis-ci/dpl/commits/ha-bug-puppet-forge

But it looks like that has been merged into master and tagged for release already, so we probably do not need it any longer.

edestecd commented 7 years ago

I have concerns about the matrix. I'm honestly still trying to understand the new matrix format. I think this is in an include: https://github.com/voxpupuli/puppet-zabbix/blob/master/.travis.yml#L29

However ours is in an exclude. Our travis matrix is now different in format that puppet-zabbix, from the last merge.

ghoneycutt commented 7 years ago

@edestecd The new matrix tests every supported version combination of ruby and puppet and the excludes are for none incompatibilities. This method actually tests all the platforms that we say are supported as opposed the zabbix example that tests only a few cases.

edestecd commented 7 years ago

@ghoneycutt yup it seems more complete to me. I wasn't trying to imply it was better or worse, just that we can't exactly copy the zabbix example for auto deploy, since that matrix is different. Do you know of an auto deploy (to the forge) example that uses this matrix format? That would be most helpful ;)

edestecd commented 7 years ago

Perhaps just moving this: https://github.com/sgnl05/sgnl05-sssd/pull/28/files#diff-354f30a63fb0907d4ad57269548329e3R72

To the above matrix: https://github.com/sgnl05/sgnl05-sssd/blob/3317f195071f14b665efef0cb472a0f9e0b6ad73/.travis.yml#L10

Would do the trick. But it seems like this may run more than once on each ruby, so we probably still need to exclude ruby 1.9.3 and 2.1.0 in the exclude.

sgnl05 commented 7 years ago

I updated .travis.yml with what you suggested @edestecd

I also did a search for any .travis.yml file on github that uses matrix exclude and puppetlabs as provider for deploy. Among many, these two came up: https://github.com/hercules-team/augeasproviders_sysctl/blob/master/.travis.yml https://github.com/maestrodev/puppet-perforce/blob/master/.travis.yml

If both examples above work, then I believe ours will work too.

sgnl05 commented 7 years ago

It tried to deploy multiple times, but I think I got it right this time after adding some excludes.

edestecd commented 7 years ago

I like this: https://github.com/hercules-team/augeasproviders_sysctl/blob/master/.travis.yml#L95

Doing the two excludes is effectively the same, but more verbose...

edestecd commented 7 years ago

Very cool, I think we can merge now?

sgnl05 commented 7 years ago

I tried adding "rvm: 1.9.3" through https://github.com/sgnl05/sgnl05-sssd/pull/28/commits/4d800d1870f41a95137439786dd9711713bc0082, but it had no effect..

edestecd commented 7 years ago

Hmm, maybe they are doing something else then... As long as it works ;) Thanks for the effort. I'll be doing this to my other modules soon and now I have a great example!

sgnl05 commented 7 years ago

Ah, I figured out the "rvm:"-thing. I expected it to work the same way as an exclude would. If you look at https://travis-ci.org/hercules-team/augeasproviders_sysctl/builds/171974370, you'll see build jobs with "FORGE_PUBLISH=true" for all Ruby versions. However, deploy is only triggered on the job with version 1.9.3. The other two get this message: "Skipping a deployment with the puppetforge provider because this is not on the required runtime".

sgnl05 commented 7 years ago

So using exclude gives us less useless build jobs. ;)

edestecd commented 7 years ago

OK I see, it does the build, but bails. I agree, that seems less useful.

edestecd commented 7 years ago

Did this work for the last release? Can we close this issue?

sgnl05 commented 7 years ago

We implemented this after the last release. So we'll have to test it on the upcoming release.

sgnl05 commented 7 years ago

Worked! https://travis-ci.org/sgnl05/sgnl05-sssd/jobs/194817099