docker-ci-tool-stack
docker-ci-tool-stack copied to clipboard
I get frozen array errors from ruby code
[ec2-user@ip-10-105-0-181 docker-ci-tool-stack]$ docker-compose up Building nexus Step 1/19 : FROM centos:centos7 centos7: Pulling from library/centos 256b176beaff: Already exists Digest: sha256:6f6d986d425aeabdc3a02cb61c02abb2e78e57357e92417d6d58332856024faf Status: Downloaded newer image for centos:centos7 ---> 5182e96772bf Step 2/19 : MAINTAINER Sonatype [email protected] ---> Running in 15b4eb644374 Removing intermediate container 15b4eb644374 ---> 3db538f548fb Step 3/19 : LABEL vendor=Sonatype com.sonatype.license="Apache License, Version 2.0" com.sonatype.name="Nexus Repository Manager base image" ---> Running in 1ae89bd74a45 Removing intermediate container 1ae89bd74a45 ---> d695dcf58a7b Step 4/19 : ARG NEXUS_VERSION=3.6.1-02 ---> Running in 326236c96a13 Removing intermediate container 326236c96a13 ---> efb7e4dd73a3 Step 5/19 : ARG NEXUS_DOWNLOAD_URL=https://download.sonatype.com/nexus/3/nexus-${NEXUS_VERSION}-unix.tar.gz ---> Running in 6778f4f3551b Removing intermediate container 6778f4f3551b ---> 00b9be63631b Step 6/19 : ARG NEXUS_DOWNLOAD_SHA256_HASH=4a658996cf29ca2d4f9c8b3d3cff11bfc358d88f03495812d7814268f0b1259b ---> Running in 2b6fe4bb83ca Removing intermediate container 2b6fe4bb83ca ---> 6e6a5c23ad09 Step 7/19 : ENV JAVA_HOME=/opt/java JAVA_VERSION_MAJOR=8 JAVA_VERSION_MINOR=152 JAVA_VERSION_BUILD=16 JAVA_DOWNLOAD_HASH=aa0333dd3019491ca4f6ddbe78cdb6d0 ---> Running in 86c2a0162a40 Removing intermediate container 86c2a0162a40 ---> 4caeed5aa01d Step 8/19 : ENV JAVA_URL=http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-b${JAVA_VERSION_BUILD}/${JAVA_DOWNLOAD_HASH}/server-jre-${JAVA_VERSION_MAJOR}u${JAVA_VERSION_MINOR}-linux-x64.tar.gz JAVA_DOWNLOAD_SHA256_HASH=e8a341ce566f32c3d06f6d0f0eeea9a0f434f538d22af949ae58bc86f2eeaae4 ---> Running in 8f2812492717 Removing intermediate container 8f2812492717 ---> b877fd78ebe3 Step 9/19 : ENV SONATYPE_DIR=/opt/sonatype ---> Running in ef8eef9e7d62 Removing intermediate container ef8eef9e7d62 ---> 57e809c58f72 Step 10/19 : ENV NEXUS_HOME=${SONATYPE_DIR}/nexus NEXUS_DATA=/nexus-data NEXUS_CONTEXT='' SONATYPE_WORK=${SONATYPE_DIR}/sonatype-work ---> Running in 249e8a77c5f0 Removing intermediate container 249e8a77c5f0 ---> 36d7ebd8cb3c Step 11/19 : ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION="release-0.5.20171115-163526.03915d6" ---> Running in 0f0f18927c36 Removing intermediate container 0f0f18927c36 ---> 5394c43a6f89 Step 12/19 : ARG NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL="https://github.com/sonatype/chef-nexus-repository-manager/releases/download/${NEXUS_REPOSITORY_MANAGER_COOKBOOK_VERSION}/chef-nexus-repository-manager.tar.gz" ---> Running in 724df5024b01 Removing intermediate container 724df5024b01 ---> 9ef222271a3f Step 13/19 : ADD solo.json.erb /var/chef/solo.json.erb ---> 7a9f4fa3229d Step 14/19 : RUN curl -L https://www.getchef.com/chef/install.sh | bash && /opt/chef/embedded/bin/erb /var/chef/solo.json.erb > /var/chef/solo.json && chef-solo --recipe-url ${NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL} --json-attributes /var/chef/solo.json && rpm -qa chef | xargs rpm -e && rpm --rebuilddb && rm -rf /etc/chef && rm -rf /opt/chefdk && rm -rf /var/cache/yum && rm -rf /var/chef ---> Running in 90c4545bb0f0 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 23082 100 23082 0 0 125k 0 --:--:-- --:--:-- --:--:-- 125k el 7 x86_64 Getting information for chef stable for el... downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=&p=el&pv=7&m=x86_64 to file /tmp/install.sh.6/metadata.txt trying curl... sha1 3229e44c1136741be7df65d1441732bae55a2a02 sha256 1807c453c5a16fd2cb0941f98847a0031c3812ccb9e3a628b2f8fba8335f485c url https://packages.chef.io/files/stable/chef/14.3.37/el/7/chef-14.3.37-1.el7.x86_64.rpm version 14.3.37 downloaded metadata file looks valid... downloading https://packages.chef.io/files/stable/chef/14.3.37/el/7/chef-14.3.37-1.el7.x86_64.rpm to file /tmp/install.sh.6/chef-14.3.37-1.el7.x86_64.rpm trying curl... Comparing checksum with sha256sum...
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
You are installing an omnibus package without a version pin. If you are installing on production servers via an automated process this is DANGEROUS and you will be upgraded without warning on new releases, even to new major releases. Letting the version float is only appropriate in desktop, test, development or CI/CD environments.
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
Installing chef installing with rpm... warning: /tmp/install.sh.6/chef-14.3.37-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY Preparing... ######################################## Updating / installing... chef-14.3.37-1.el7 ######################################## Thank you for installing Chef! [2018-08-09T22:14:02+00:00] WARN: No config file found or specified on command line, using command line options. [2018-08-09T22:14:02+00:00] WARN: No cookbooks directory found at or above current directory. Assuming /var/chef. [2018-08-09T22:14:02+00:00] WARN: ***************************************** [2018-08-09T22:14:02+00:00] WARN: Did not find config file: /etc/chef/client.rb, using command line options. [2018-08-09T22:14:02+00:00] WARN: ***************************************** Starting Chef Client, version 14.3.37 [2018-08-09T22:14:03+00:00] WARN: Plugin Network: unable to detect ipaddress resolving cookbooks for run list: ["nexus_repository_manager::docker"] Synchronizing Cookbooks:
- nexus_repository_manager (0.1.0)
- java (1.50.0)
- tar (2.1.1)
- limits (1.0.0)
- poise-python (1.6.0)
- s3_file (2.8.5)
- apt (6.1.4)
- windows (3.4.0)
- homebrew (4.2.0)
- poise (2.8.1)
- poise-languages (2.1.1)
- ohai (5.2.0)
- poise-archive (1.5.0) Installing Cookbook Gems: Compiling Cookbooks...
================================================================================ Recipe Compile Error in /etc/chef/local-mode-cache/cache/cookbooks/poise-python/libraries/default.rb
FrozenError
can't modify frozen Array
Cookbook Trace:
/etc/chef/local-mode-cache/cache/cookbooks/poise/files/halite_gem/poise/helpers/subresources/container.rb:220:in included' /etc/chef/local-mode-cache/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in
include'
/etc/chef/local-mode-cache/cache/cookbooks/poise/files/halite_gem/poise/resource.rb:51:in poise_subresource_container' /etc/chef/local-mode-cache/cache/cookbooks/poise/files/halite_gem/poise.rb:93:in
block in Poise'
/etc/chef/local-mode-cache/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:34:in include' /etc/chef/local-mode-cache/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:34:in
class:Resource'
/etc/chef/local-mode-cache/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:33:in <module:PythonRuntime>' /etc/chef/local-mode-cache/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:25:in
module:Resources'
/etc/chef/local-mode-cache/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:22:in <module:PoisePython>' /etc/chef/local-mode-cache/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime.rb:21:in
<top (required)>'
/etc/chef/local-mode-cache/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources.rb:19:in <top (required)>' /etc/chef/local-mode-cache/cache/cookbooks/poise-python/files/halite_gem/poise_python/cheftie.rb:17:in
<top (required)>'
/etc/chef/local-mode-cache/cache/cookbooks/poise-python/libraries/default.rb:19:in `<top (required)>'
Relevant File Content:
/etc/chef/local-mode-cache/cache/cookbooks/poise/files/halite_gem/poise/helpers/subresources/container.rb:
213: @container_default 214: end 215: end 216: 217: def included(klass) 218: super 219: klass.extend(ClassMethods) 220>> klass.const_get(:HIDDEN_IVARS) << :@subcontexts 221: klass.const_get(:FORBIDDEN_IVARS) << :@subcontexts 222: end 223: end 224: 225: extend ClassMethods 226: end 227: end 228: end 229: end
Additional information:
Ruby objects are often frozen to prevent further modifications
when they would negatively impact the process (e.g. values inside
Ruby's ENV class) or to prevent polluting other objects when default
values are passed by reference to many instances of an object (e.g.
the empty Array as a Chef resource default, passed by reference
to every instance of the resource).
Chef uses Object#freeze to ensure the default values of properties
inside Chef resources are not modified, so that when a new instance
of a Chef resource is created, and Object#dup copies values by
reference, the new resource is not receiving a default value that
has been by a previous instance of that resource.
Instead of modifying an object that contains a default value for all
instances of a Chef resource, create a new object and assign it to
the resource's parameter, e.g.:
fruit_basket = resource(:fruit_basket, 'default')
# BAD: modifies 'contents' object for all new fruit_basket instances
fruit_basket.contents << 'apple'
# GOOD: allocates new array only owned by this fruit_basket instance
fruit_basket.contents %w(apple)
System Info:
chef_version=14.3.37 platform=centos platform_version=7.5.1804 ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] program_name=/usr/bin/chef-solo executable=/opt/chef/bin/chef-solo
Running handlers: [2018-08-09T22:14:04+00:00] ERROR: Running exception handlers Running handlers complete [2018-08-09T22:14:04+00:00] ERROR: Exception handlers complete Chef Client failed. 0 resources updated in 01 seconds [2018-08-09T22:14:04+00:00] FATAL: Stacktrace dumped to /etc/chef/local-mode-cache/cache/chef-stacktrace.out [2018-08-09T22:14:04+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report [2018-08-09T22:14:04+00:00] FATAL: FrozenError: can't modify frozen Array ERROR: Service 'nexus' failed to build: The command '/bin/sh -c curl -L https://www.getchef.com/chef/install.sh | bash && /opt/chef/embedded/bin/erb /var/chef/solo.json.erb > /var/chef/solo.json && chef-solo --recipe-url ${NEXUS_REPOSITORY_MANAGER_COOKBOOK_URL} --json-attributes /var/chef/solo.json && rpm -qa chef | xargs rpm -e && rpm --rebuilddb && rm -rf /etc/chef && rm -rf /opt/chefdk && rm -rf /var/cache/yum && rm -rf /var/chef' returned a non-zero code: 1 [ec2-user@ip-10-105-0-181 docker-ci-tool-stack]$ ^C [ec2-user@ip-10-105-0-181 docker-ci-tool-stack]$
Any guidance will be appreciated
am also getting the Same error
I got the same error, caused by the chef version. The RUN command in the Dockerfile should be changed from: RUN curl -L https://www.getchef.com/chef/install.sh | bash \ to RUN curl -L https://www.getchef.com/chef/install.sh | bash -s -- -v 14.0 \
I got this to run correcting the hashes and links for java, but probably better to relink docker-nexus3, since this has been updated to use openjdk. And both issues were the docker-nexus3 subproject, not this project. I will try this next to remove the link and clone the subproject from master. I run this on Minishift BTW. Update: Remove the subproject docker-nexus3 and clone from the original source. This now works running on Minishift. When trying Minishift, just install using the instructions, then start a Minishift cluster. I used 40GB disk and 8GB memory in the start command. Then run eval $(minishift docker-env), and docker-compose up.<-- This added docker stuff to my minishift cluster, but not quite right. Not controlled by openshift. Guess i need to read the fine manuals (RTFM).