(PUP-8305) Git testing should consume the runtime package#52
Conversation
|
@joshcooper @jhelwig this is the current rough first draft of what I've been working on. Currently this works for debian8, fedora 27, solaris 11, solaris 10, windows 2012r2, osx 10.12, osx 10.13. and sles 12. I definitely want to iron out some of the logic here, since it's redundant and quite ugly. |
|
windows2012r2_ja failed though, I haven't looked into it yet |
|
|
||
| runtime_url = "#{dev_builds_url}/puppet-runtime/#{runtime_tag}/artifacts/" | ||
| runtime_prefix = "agent-runtime-#{branch}-#{runtime_tag}." | ||
| runtime_suffix = ".tar.gz" |
There was a problem hiding this comment.
I want to use artifactory to give us this information rather than constructing it here, but I haven't figured out the best way to do that yet
$ jfrog rt s generic__local/*agent-runtime*master*201806220*windows*.tar.gz
[Info] Searching artifacts...
[Info] Found 2 artifacts.
[
{
"path": "generic__local/development/puppet-runtime/201806220/windows-x64/agent-runtime-master-201806220.windows-2012r2-x64.tar.gz",
"props": {
"": ""
}
},
{
"path": "generic__local/development/puppet-runtime/201806220/windows-x86/agent-runtime-master-201806220.windows-2012r2-x86.tar.gz",
"props": {
"": ""
}
}
]
9847b4d to
4d50b2a
Compare
| :solaris_11 => /solaris-11/, | ||
| :windows => /windows/, | ||
| :eos => /^eos-/, | ||
| :sles => /sles/, |
There was a problem hiding this comment.
not sure if we still need this since I fixed up how defaults are loaded with voxpupuli/beaker#1532
There was a problem hiding this comment.
Can confirm, we need this
There was a problem hiding this comment.
494737f to
28fe7d3
Compare
28fe7d3 to
f516887
Compare
| # @param [Host] host A single host to construct pathing for | ||
| def construct_puppet_path(host) | ||
| path = (%w(puppetbindir facterbindir hierabindir)).compact.reject(&:empty?) | ||
| path = (%w(puppetbindir facterbindir hierabindir privatebindir)).compact.reject(&:empty?) |
There was a problem hiding this comment.
we might not need this, but I have to double check
There was a problem hiding this comment.
I think we do need this
| on host, 'pkgadd -d http://get.opencsw.org/now -a /root/shutupsolaris -n all' | ||
| on host, '/opt/csw/bin/pkgutil -U all' | ||
| on host, '/opt/csw/bin/pkgutil -y -i pkgutil' | ||
| on host, '/opt/csw/bin/pkgutil -y -i coreutils' |
There was a problem hiding this comment.
we may not need pkgutil or coreutils for solaris
| when /windows/ | ||
| arch = host[:ruby_arch] || 'x86' | ||
| step "#{host} Selected architecture #{arch}" | ||
| step "Install puppet-runtime" do |
There was a problem hiding this comment.
this whole section is gross and probably should get cleaned up
There was a problem hiding this comment.
I'd love to use artifactory to fetch the runtime package, but I think we should save that for the next iteration
There was a problem hiding this comment.
Ticket opened to follow up on this, so it's not going to happen as a part of this PR
| # note that this WILL NOT impact Beaker runs though | ||
| puppet_bundler_install_dir = on(host, "cd #{puppet_dir} && cmd.exe /c bundle show puppet").stdout.chomp | ||
| when /el-7/ | ||
| create_remote_file(host, "#{puppet_dir}/Gemfile", gemfile_contents + "gem 'json'\n") |
There was a problem hiding this comment.
I couldn't find any detail around why we needed to add the json gem for el7, so I removed it, and nothing broke...
There was a problem hiding this comment.
👍 The ruby package provided by the distro oddly didn't have json, so we had to add it back in. But now that we're using the runtime, we don't have to worry about that nonsense.
| create_remote_file(host, "#{puppet_dir}/Gemfile", gemfile_contents) | ||
| on host, "cd #{puppet_dir} && bundle install --system --binstubs #{host['puppetbindir']} --shebang #{host['puppetbindir']}/ruby" | ||
| puppet_bundler_install_dir = on(host, "cd #{puppet_dir} && bundle show puppet").stdout.chomp | ||
| on host, "cd #{puppet_dir} && #{bundle_command(host)} install --system --binstubs #{host['puppetbindir']} --shebang #{host['puppetbindir']}/ruby" |
There was a problem hiding this comment.
I'm not convinced we need to branch here for Solaris, but I haven't gotten around to testing that theory out yet
There was a problem hiding this comment.
can confirm, do not need
f516887 to
6267254
Compare
|
This failure is very strange, but I'm happy with the work at this point if anyone wants to start reviewing it. |
|
@melissa git failures pop up on occasion for us after force pushes, but tend to resolve themselves one or two builds later. Re-kicking this now. Jenkins, test this please |
|
|
||
| # override incorrect FOSS (git) defaults from Beaker with AIO applicable ones | ||
| # | ||
| # Remove after PUP-4867 breaks distmoduledir and sitemoduledir into individual |
There was a problem hiding this comment.
Guessing the comment about PUP-4867 and the related code became irrelevant due to other refactoring?
There was a problem hiding this comment.
previously we were using the moduledirs defined in the foss defaults file, but we're not anymore with https://github.com/puppetlabs/beaker-puppet/pull/52/files#diff-7e0996ffe23c8cf4e3bc5558f32f7aa8L24
This will load the aio defaults, so we don't need to keep overwriting them here. I'm actually not sure how PUP-4867 relates to this, other than they both deal with the moduledir.... but by changing which defaults are loaded for git testing, we no longer have to override distmoduledir or sitemoduledir
| `git clone --depth 1 git@github.com:puppetlabs/puppet-runtime.git #{runtime_dir}` | ||
| runtime_tag = nil | ||
| Dir.chdir runtime_dir do | ||
| runtime_tag = `git describe --abbrev=0`.chomp |
There was a problem hiding this comment.
Might want to use --first-parent here. There's been some discussion about merge-ups from older branches causing issues with git-describe, where describe will pick up the "older" branch because it happens "first" in the history (Eg: Getting a 5.5.x related tag on the master branch).
--first-parent
Follow only the first parent commit upon seeing a merge commit. This is
useful when you wish to not match tags on branches merged in the
history of the target commit.
There was a problem hiding this comment.
--first-parent doesn't really get me what I want here. I'm looking for the last tag on the branch
[0] Melissa@bubba:~/beaker-puppet:(maint/master/git-based-acceptance)$ git describe
0.16.0-2-g078284b
[0] Melissa@bubba:~/beaker-puppet:(maint/master/git-based-acceptance)$ git describe --first-parent
0.16.0-2-g078284b
[0] Melissa@bubba:~/beaker-puppet:(maint/master/git-based-acceptance)$ git describe --abbrev=0
0.16.0
So I want 0.16.0 here, without the -2-g078284b
There was a problem hiding this comment.
I think you want both --abbrev and --first-parent.
There was a problem hiding this comment.
ooooh, yeah, that makes more sense. Updated!
| # we assume that an invocation with `puppet()` will have it's first argument | ||
| # a face or sub command | ||
| if @options[:type] == 'git' | ||
| if @options && @options[:type] == 'git' |
There was a problem hiding this comment.
We can drop this commit if we don't install the runtime package on the master node
| end | ||
|
|
||
| def ruby_command(host, type = 'aio') | ||
| get_command('ruby', host, type) |
There was a problem hiding this comment.
This will cause us to execute cmd /c ruby on windows which I guess works. Normally we only need to wrap cmd for puppet batch files due to the way that environment.bat sets up the PATH.
There was a problem hiding this comment.
We were doing this for bundler in some cases, and gem, so I figured it wouldn't be a bad idea to add it for consistency with these different commands? Do you think it'd be better to change it back?
| when /(\A|-)pe(\Z|-)/ | ||
| 'pe' | ||
| when /(\A|-)aio(\Z|-)/ | ||
| when /(\A|-)(git)|(aio)(\Z|-)/ |
There was a problem hiding this comment.
I think we can avoid doing this and conflating git/aio by calling these methods directly:
add_aio_defaults_on(hosts)
add_puppet_paths_on(hosts)| cmd = "bundle exec puppet #{args.shift}" | ||
| else | ||
| cmd = "puppet #{args.shift}" | ||
| end |
There was a problem hiding this comment.
So long as we don't install the runtime on the master we can skip this (as there won't be confusion about which puppet to run). Also the puppet-agent package won't clobber the untarred runtime.
There was a problem hiding this comment.
Should we not install the runtime on a host that's defined as both a master and an agent?
|
It looks like things were broken. I'm picking this up at intervals between other work, and it's been a while since I've touched it. It'd like to take another close look at this before it moves forward, but it's only blocked on getting my attention, not other work |
This commit includes a lot of changes that enable git-based acceptance testing. First and foremost, we're satisfying runtime dependencies with the new puppet-runtime tarball. This provides a host of third party packages, namely ruby. Once this is in place, we can remove quite a bit of unnecessary logic that was previously required when using system-provided packages (or hand built packages). This also changes which defaults are loaded for git-based testing. Previously, we used the foss defaults. We need to switch to using the same modern paths that are set with the aio defaults.
Apparently there are some potential issues with `git describe` where it will potentially pick up the "older" branch because it happens "first" in the history (i.e., from a merge-up). This will ensure we stay on the branch we have checked out.
|
last comment still current |
|
I picked this up again recently, so it's currently in progress. |
gotta support both puppet 5.5.x and puppet 6 :(
f659649 to
f3f80e1
Compare
|
last comment still current |
No description provided.