-
Notifications
You must be signed in to change notification settings - Fork 361
Updating Ruby Package in CAPI Release
A ruby package spec file contains metadata providing which version of ruby, rubygems, and other supportive libraries. The packaging scripts specifies un-compressing these dependencies and installing them on our instances. (Q: Where does bosh get the ruby source code from?)
Steps to update ruby package (metadata for the ruby run for capi jobs)
- Get the most up-to-date version of bosh ruby-release:
git clone https://github.com/cloudfoundry/bosh-package-ruby-release
- Navigate to
capi-release
:
cd ~/workspace/capi-release
touch config/private.yml
- Populate the new
private.yml
with the blobstore credentials found in the ARI GCP project - Run the
vendor-package
command to create 2 new directories that point to the updated ruby package (replaceruby-3.3
with your desired version)
bosh vendor-package ruby-3.3 ~/workspace/bosh-package-ruby-release/
# It creates .final_builds/packages/ruby-3.3/ and packages/ruby-3.3/
- Delete the old ruby package
rm -rf packages/ruby-3.2/
- Go to
capi-release/packages
. Search recursively and replace each instance ofruby-3.2
withruby-3.3
- Go into the
capi-release/jobs
directory. Search recursively and replace each instance ofruby-3.2
withruby-3.3
- The resulting git diff should be similar to https://github.com/cloudfoundry/capi-release/pull/237/files
- Commit and create a PR for
capi-release
- In
capi-release/src/cloud_controller_ng/.ruby-version
update to your new version (e.g. bump3.2
to3.3
. - Commit and create a pull request for
cloud_controller_ng
- Target a bosh-lite. run
deploy_only_new_capi
. This creates and uploadscapi-release
, and does a bosh deploy. - Validate that it works:
bosh ssh api
/var/vcap/packaging/ruby/bin/ruby -v
# Should see "ruby NEW-VERSION"
- Also run CATs
Update this file: https://github.com/cloudfoundry/capi-workspace/blob/ebf062d2037b3fc788993aa49d03026bddc2e84f/install-scripts/ruby.sh#L6
If you updated bundler, rebundle (bundle update --bundler
) with the new version in the following repos/directories:
- https://github.com/cloudfoundry/cloud_controller_ng
- https://github.com/cloudfoundry/cloud_controller_ng/tree/main/docs/v3
- https://github.com/cloudfoundry/capi-release/tree/develop/spec
- https://github.com/cloudfoundry/capi-release/blob/develop/packages/cloud_controller_ng/packaging
These Dockerfiles are all in the same repository. Create one PR to update the following:
-
capi-runtime-ci
- this Dockerfile is used for creating the capi-release tarball in the https://ci.cake.capi.land/teams/main/pipelines/capi/jobs/create-capi-release job
- capi-migration-compatibility
-
capi-ruby-units
- This Dockerfile is used for running unit tests in Concourse
- It's best to test out changes to this Dockerfile manually. There can be several gotchas as the container needs to run bundle, mysql, and postgres. See detailed instructions on how to test changes to this Dockerfile here.
After merging in your PR, be sure to watch the https://ci.cake.capi.land/teams/main/pipelines/docker-images pipeline for failures.
Updating ruby in the ruby-units Dockerfile may cause additional failures, as different linux releases may install different versions of dependencies in the following apt-get install
command. In particular, look out for upgrades in MariaDB (mysql) and Postgres.
To update your Dockerfile, follow these steps:
cd ~/workspace/capi-dockerfiles/capi-ruby-units
- Open
Dockerfile
. check the official ruby docker images for an appropriate base image, and replaced the existing one (e.g. replaceFROM ruby:2.5-stretch
withFROM ruby:2.7-buster
). - Update any other steps as necessary (e.g. replace
RUN gem install bundler -v 1.17.3
withRUN gem install bundler -v 2.2.4
) - run
docker build .
to see if the docker image builds successfully - Test the resulting dockerfile. To do so, run the image in interactive mode:
docker run -it <image_name> /bin/bash
- clone CCNG:
git clone https://github.com/cloudfoundry/cloud_controller_ng.git
cd cloud_controller_ng
- start mysql:
service mysql start
- run unit tests for MySql:
DB=mysql ./bin/bundle exec rake spec
- start postgres:
service postgresql start
- run unit tests for PostgreSql:
DB=postgres ./bin/bundle exec rake spec
If both unit tests for mysql and postgres pass, then you may be ready to push the updated Dockerfile. However, beware that the pipeline actually runs this script: https://github.com/cloudfoundry/capi-ci/blob/d358203acbd0e5be4a5ce6ecb61e2c9115118dc2/ci/test-unit/run_cc_unit_tests. You may see failures depending on any differences from the above commands do to what this script runs.
-
Pipelines
-
Contributing
- Tips and Tricks
- Cloud Controller API v3 Style Guide
- Playbooks
- Development configuration
- Testing
-
Architectural Details
-
CC Resources
- Apps
- Audit Events
- Deployments
- Labels
- Services
- Sidecars
-
Dependencies
-
Troubleshooting
- Ruby Console Script to Find Fields that Cannot Be Decrypted
- Logging database queries in unit tests
- Inspecting blobstore cc resources and cc packages(webdav)
- How to Use USR1 Trap for Diagnostics
- How to Perf: Finding and Fixing Bottlenecks
- How to get access to mysql database
- How To Get a Ruby Heap Dumps & GC Stats from CC
- How to curl v4 internal endpoints with mtls
- How to access Bosh Director console and restore an outdated Cloud Config
- Analyzing Cloud Controller's NGINX logs using the toplogs script
-
k8s
-
Archive