You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CentOS 7.4, vsphere VMs. Basically 3 VMs built from same 7.4 template, one runs Automate software, other two are "build nodes". The build nodes then use ark to download/"install" (it's go, can you really "install" it?) the terraform package, and build VMs as described by the build cookbook.
Scenario:
Download "package" to consistent location when used in Automate context. Or at very minimum, don't download package on EVERY phase when installed from "default" cookbook.
I can see a scenario where in say the deploy phase we need to install phase specific tools as a non root user. Install pyenv, specific version of python, and some modules for the dbuild user, then execute some commands as dbuild against the build using ...::shell::out
Or, as non root user, install inspec, run inspec against specific nodes. You might want to install "newest" inspec on each run. (or whatever the newest is available from your repo)
Steps to Reproduce:
This is my .delivery/build_cookbook/recipes/default.rb
terraform binary downloaded to /var/cache/chef regardless of phase of automate (or not downloaded every phase of automate if called from default.rb). Terraform unpacked to /usr/local/terraform-#{version} and linked to /usr/local/terraform
Actual Result:
Package is downloaded to cache directory for each phase of the Automate pipeline process:
/var/opt/delivery/workspace/<automate server name>/<automate org name>/<workflow org name>/<cookbook name>/<target? branch>/<stage>/<phase>/cache/terraform-0.11.0.zip
/var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/verify/lint/cache/terraform-0.11.0.zip
This is the output of the Chef run from various automate phases:
##############################################
Acceptance
* ark[terraform] action install
* directory[/usr/local/terraform-0.11.0] action create (up to date)
* remote_file[/var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/acceptance/provision/cache/terraform-0.11.0.zip] action create
- create new file /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/acceptance/provision/cache/terraform-0.11.0.zip
- update content in file /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/acceptance/provision/cache/terraform-0.11.0.zip from none to 402b43
(file sizes exceed 10000000 bytes, diff output suppressed)
* execute[unpack /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/acceptance/provision/cache/terraform-0.11.0.zip] action nothing (skipped due to action :nothing)
* execute[set owner on /usr/local/terraform-0.11.0] action nothing (skipped due to action :nothing)
* link[/usr/local/bin/terraform] action create (up to date)
* link[/usr/local/terraform] action create (up to date)
* template[/etc/profile.d/terraform.sh] action create (skipped due to only_if)
* ruby_block[adding '/usr/local/terraform-0.11.0/bin' to chef-client ENV['PATH']] action run (skipped due to only_if)
* execute[unpack /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/acceptance/provision/cache/terraform-0.11.0.zip] action run
- execute unzip -q -o /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/acceptance/provision/cache/terraform-0.11.0.zip -d /usr/local/terraform-0.11.0
* execute[set owner on /usr/local/terraform-0.11.0] action run
- execute chown -R root:0 /usr/local/terraform-0.11.0
##############################################
build lint
* ark[terraform] action install
* directory[/usr/local/terraform-0.11.0] action create (up to date)
* remote_file[/var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/lint/cache/terraform-0.11.0.zip] action create
- create new file /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/lint/cache/terraform-0.11.0.zip
- update content in file /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/lint/cache/terraform-0.11.0.zip from none to 402b43
(file sizes exceed 10000000 bytes, diff output suppressed)
* execute[unpack /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/lint/cache/terraform-0.11.0.zip] action nothing (skipped due to action :nothing)
* execute[set owner on /usr/local/terraform-0.11.0] action nothing (skipped due to action :nothing)
* link[/usr/local/bin/terraform] action create (up to date)
* link[/usr/local/terraform] action create (up to date)
* template[/etc/profile.d/terraform.sh] action create (skipped due to only_if)
* ruby_block[adding '/usr/local/terraform-0.11.0/bin' to chef-client ENV['PATH']] action run (skipped due to only_if)
* execute[unpack /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/lint/cache/terraform-0.11.0.zip] action run
- execute unzip -q -o /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/lint/cache/terraform-0.11.0.zip -d /usr/local/terraform-0.11.0
* execute[set owner on /usr/local/terraform-0.11.0] action run
- execute chown -R root:0 /usr/local/terraform-0.11.0
################################################
build create
* ark[terraform] action install
* directory[/usr/local/terraform-0.11.0] action create (up to date)
* remote_file[/var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/quality/cache/terraform-0.11.0.zip] action create
- create new file /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/quality/cache/terraform-0.11.0.zip
- update content in file /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/quality/cache/terraform-0.11.0.zip from none to 402b43
(file sizes exceed 10000000 bytes, diff output suppressed)
* execute[unpack /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/quality/cache/terraform-0.11.0.zip] action nothing (skipped due to action :nothing)
* execute[set owner on /usr/local/terraform-0.11.0] action nothing (skipped due to action :nothing)
* link[/usr/local/bin/terraform] action create (up to date)
* link[/usr/local/terraform] action create (up to date)
* template[/etc/profile.d/terraform.sh] action create (skipped due to only_if)
* ruby_block[adding '/usr/local/terraform-0.11.0/bin' to chef-client ENV['PATH']] action run (skipped due to only_if)
* execute[unpack /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/quality/cache/terraform-0.11.0.zip] action run
- execute unzip -q -o /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/build/quality/cache/terraform-0.11.0.zip -d /usr/local/terraform-0.11.0
* execute[set owner on /usr/local/terraform-0.11.0] action run
- execute chown -R root:0 /usr/local/terraform-0.11.0
####################################################
verify lint
* ark[terraform] action install
* directory[/usr/local/terraform-0.11.0] action create (up to date)
* remote_file[/var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/verify/lint/cache/terraform-0.11.0.zip] action create
- create new file /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/verify/lint/cache/terraform-0.11.0.zip
- update content in file /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/verify/lint/cache/terraform-0.11.0.zip from none to 402b43
(file sizes exceed 10000000 bytes, diff output suppressed)
* execute[unpack /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/verify/lint/cache/terraform-0.11.0.zip] action nothing (skipped due to action :nothing)
* execute[set owner on /usr/local/terraform-0.11.0] action nothing (skipped due to action :nothing)
* link[/usr/local/bin/terraform] action create (up to date)
* link[/usr/local/terraform] action create (up to date)
* template[/etc/profile.d/terraform.sh] action create (skipped due to only_if)
* ruby_block[adding '/usr/local/terraform-0.11.0/bin' to chef-client ENV['PATH']] action run (skipped due to only_if)
* execute[unpack /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/verify/lint/cache/terraform-0.11.0.zip] action run
- execute unzip -q -o /var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/verify/lint/cache/terraform-0.11.0.zip -d /usr/local/terraform-0.11.0
* execute[set owner on /usr/local/terraform-0.11.0] action run
- execute chown -R root:0 /usr/local/terraform-0.11.0
Ruminations
ohai seems to return multiple cache dirs when run from an Automate context. Ark appears to pick the first one.
allowing the user to specify the download/cache dir seems to be the easiest...? I feel like there's pitfalls which is why Chef::Config[:cache_dir] was used in the first place?
maybe I'm overthinking it and there's an attribute that says "if this /usr/local/foo link exists don't download anything". I specifically just stopped writing this and re read the README and didn't see a way documented... admittedly haven't dug through the code to see if that exists.
I'm running a scaled down environment, but just one cookbook run through using this build cookbook,
OK OK, it was one cookbook, but I ran it through a few times... still, this is just one of the build nodes... the other build nodes look similar, but each of the .zip s is wasted bandwidth, disk space, etc...
what do they say? Four hardest things in computer programming, caching, naming things, and off by one errors?
Anyway, I think I see how to add a "path" option to the ark provider.... I'd be willing to do a PR if you don't think you'd go against the ethos of the Ark cookbook. Otherwise, if that's misguided, what would be a good way to solve the problem?
This could also totally just be a function of Automate... so solving it here in Ark is a band-aid fix for a broken bone... I'm ok with that. But would like to pursue fixing a fundamental issue with automate if so discovered.
We had issues with the Terraform cookbook. This stanza is essentially all we need (we don't use public URL, my tf_url is actually https://my.internal.repo/terraform/current.zip, but the above was written as steps to reproduce)
Thanks for reading all my ramblings!
Q
The text was updated successfully, but these errors were encountered:
Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.
Closing due to inactivity. If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.
Cookbook version
Ark: 3.1.0
Chef-client version
13.4.19
Platform Details
CentOS 7.4, vsphere VMs. Basically 3 VMs built from same 7.4 template, one runs Automate software, other two are "build nodes". The build nodes then use ark to download/"install" (it's go, can you really "install" it?) the terraform package, and build VMs as described by the build cookbook.
Scenario:
Download "package" to consistent location when used in Automate context. Or at very minimum, don't download package on EVERY phase when installed from "default" cookbook.
I can see a scenario where in say the deploy phase we need to install phase specific tools as a non root user. Install pyenv, specific version of python, and some modules for the
dbuild
user, then execute some commands as dbuild against the build using...::shell::out
Or, as non root user, install inspec, run inspec against specific nodes. You might want to install "newest" inspec on each run. (or whatever the newest is available from your repo)
Steps to Reproduce:
This is my
.delivery/build_cookbook/recipes/default.rb
run any phase of automate. If you run Verify, and have just one build node, you'll have terraform downloaded 3 times.
/var/opt/delivery/workspace/automate-server.com/myorg/workflow-org/my_cookbook/master/verify/{unit,lint,syntax}/cache/terraform-0.11.0.zip
(just to be clear that's:
Expected Result:
terraform
binary downloaded to/var/cache/chef
regardless of phase of automate (or not downloaded every phase of automate if called from default.rb). Terraform unpacked to/usr/local/terraform-#{version}
and linked to/usr/local/terraform
Actual Result:
Package is downloaded to cache directory for each phase of the Automate pipeline process:
This is the output of the Chef run from various automate phases:
Ruminations
ohai seems to return multiple cache dirs when run from an Automate context. Ark appears to pick the first one.
allowing the user to specify the download/cache dir seems to be the easiest...? I feel like there's pitfalls which is why
Chef::Config[:cache_dir]
was used in the first place?maybe I'm overthinking it and there's an attribute that says "if this
/usr/local/foo
link exists don't download anything". I specifically just stopped writing this and re read the README and didn't see a way documented... admittedly haven't dug through the code to see if that exists.I'm running a scaled down environment, but just one cookbook run through using this build cookbook,
OK OK, it was one cookbook, but I ran it through a few times... still, this is just one of the build nodes... the other build nodes look similar, but each of the
.zip
s is wasted bandwidth, disk space, etc...what do they say? Four hardest things in computer programming, caching, naming things, and off by one errors?
Anyway, I think I see how to add a "path" option to the ark provider.... I'd be willing to do a PR if you don't think you'd go against the ethos of the Ark cookbook. Otherwise, if that's misguided, what would be a good way to solve the problem?
This could also totally just be a function of Automate... so solving it here in Ark is a band-aid fix for a broken bone... I'm ok with that. But would like to pursue fixing a fundamental issue with automate if so discovered.
We had issues with the Terraform cookbook. This stanza is essentially all we need (we don't use public URL, my
tf_url
is actuallyhttps://my.internal.repo/terraform/current.zip
, but the above was written as steps to reproduce)Thanks for reading all my ramblings!
The text was updated successfully, but these errors were encountered: