### Configure Packaging Script with compile.env Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Source compile.env in your packaging script to access helpers like bosh_bundle for installing gems and bosh_generate_runtime_env for creating environment files. ```bash #!/bin/bash -eu # packages/my-ruby-app/packaging # Source the Ruby compile environment source /var/vcap/packages/ruby-3.4/bosh/compile.env # Copy your application files cp -r ./my-app/. "${BOSH_INSTALL_TARGET}/" cd "${BOSH_INSTALL_TARGET}" # Install gems using the bosh_bundle helper # This runs bundle install with BOSH-appropriate settings: # - path: ${BOSH_INSTALL_TARGET}/gem_home # - bin: ${BOSH_INSTALL_TARGET}/bin # - without: development test bosh_bundle # Or use bosh_bundle_local for vendored gems # bosh_bundle_local # Generate runtime.env for job scripts bosh_generate_runtime_env # The generated runtime.env will contain: # export PATH=${BOSH_INSTALL_TARGET}/bin:$PATH # export GEM_HOME=${BOSH_INSTALL_TARGET}/gem_home/ruby/3.4.9 # export BUNDLE_GEMFILE=${BOSH_INSTALL_TARGET}/Gemfile ``` -------------------------------- ### Example Ruby Version Configuration Source: https://github.com/cloudfoundry/bosh-package-ruby-release/blob/main/README.md This YAML configuration defines a new Ruby version (3.3) along with its corresponding RubyGems and libyaml versions, and the stemcell to test against. Ensure component versions are compatible. ```yaml - version: "3.3" rubygems: "3.5" libyaml: "0.2" stemcell: ubuntu-noble ``` -------------------------------- ### Use Ruby Package at Runtime Source: https://github.com/cloudfoundry/bosh-package-ruby-release/blob/main/README.md Source the runtime environment script from the vendored Ruby package and your job's package to ensure the Ruby environment is correctly set up for runtime execution. This allows you to run commands like `bundle exec`. ```bash #!/bin/bash -eu source /var/vcap/packages//bosh/runtime.env source /var/vcap/packages/your-package/bosh/runtime.env bundle exec ... ``` -------------------------------- ### Use Ruby Package for Compilation Source: https://github.com/cloudfoundry/bosh-package-ruby-release/blob/main/README.md Source the compile environment script from the vendored Ruby package to use its functions like `bosh_bundle` and `bosh_generate_runtime_env` in your packaging scripts. Ensure the `` is correct. ```bash #!/bin/bash -eu source /var/vcap/packages//bosh/compile.env ... bosh_bundle bosh_generate_runtime_env ``` -------------------------------- ### BOSH Errand Execution Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Commands to deploy the test manifest and execute the Ruby verification errand. ```bash # Deploy and run the test errand bosh -d ruby-test deploy manifests/test.yml \ -v stemcell=ubuntu-noble # Run the errand to test Ruby installation bosh -d ruby-test run-errand ruby-3.4-test # Expected output: # Testing runtime compatibility # test # Testing compile compatibility # found correct rubygems version 3.6.9 ``` -------------------------------- ### Configure Job Script with runtime.env Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Source runtime.env in your BOSH job control scripts to ensure the correct Ruby environment variables are set before executing application processes. ```bash #!/bin/bash -eu # jobs/my-job/templates/ctl.erb JOB_DIR=/var/vcap/jobs/my-job RUN_DIR=/var/vcap/sys/run/my-job LOG_DIR=/var/vcap/sys/log/my-job PIDFILE=${RUN_DIR}/my-job.pid # Source Ruby runtime environment source /var/vcap/packages/ruby-3.4/bosh/runtime.env # Source your application's runtime environment source /var/vcap/packages/my-ruby-app/bosh/runtime.env case $1 in start) mkdir -p "${RUN_DIR}" "${LOG_DIR}" chown -R vcap:vcap "${RUN_DIR}" "${LOG_DIR}" # Run your Ruby application with bundle exec bundle exec puma \ --pidfile "${PIDFILE}" \ --dir /var/vcap/packages/my-ruby-app \ --port 9292 \ >> "${LOG_DIR}/my-job.stdout.log" \ 2>> "${LOG_DIR}/my-job.stderr.log" & ;; stop) kill -9 $(cat "${PIDFILE}") rm -f "${PIDFILE}" ;; *) echo "Usage: ctl {start|stop}" ;; esac ``` -------------------------------- ### Ruby Version Configuration Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Defines supported Ruby, RubyGems, and libyaml versions for the release. ```yaml # ci/versions.yml #@data/values --- rubies: - version: "3.3" rubygems: "3.5" libyaml: "0.2" stemcell: ubuntu-noble - version: "3.4" rubygems: "3.6" libyaml: "0.2" stemcell: ubuntu-noble - version: "4.0" rubygems: "4.0" libyaml: "0.2" stemcell: ubuntu-noble # Add new Ruby version: - version: "3.5" rubygems: "3.7" libyaml: "0.2" stemcell: ubuntu-noble rubygems: - version: "3.5" - version: "3.6" - version: "4.0" # Add corresponding RubyGems version: - version: "3.7" libyamls: - version: "0.2" ``` -------------------------------- ### Vendor Ruby Package into BOSH Release Source: https://github.com/cloudfoundry/bosh-package-ruby-release/blob/main/README.md Use this command to vendor a specific Ruby package into your BOSH release. Ensure you replace `` with the desired version and provide the correct path to the cloned ruby-release repository. ```bash git clone https://github.com/cloudfoundry/bosh-package-ruby-release cd ~/workspace/your-release bosh vendor-package ~/workspace/bosh-package-ruby-release ``` -------------------------------- ### BOSH Deployment Manifest for Testing Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Manifest used to deploy and verify the Ruby package via errands. ```yaml # manifests/test.yml --- name: ruby-test releases: - name: ruby-release version: latest stemcells: - alias: default os: ubuntu-noble version: latest update: canaries: 2 max_in_flight: 1 canary_watch_time: 5000-60000 update_watch_time: 5000-60000 instance_groups: - name: ruby-server azs: [z1] lifecycle: errand instances: 1 jobs: - name: ruby-3.4-test release: ruby-release properties: {} vm_type: default stemcell: default networks: - name: default ``` -------------------------------- ### Vendor Ruby Package into BOSH Release Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Use the bosh vendor-package command to import a specific Ruby version into your local BOSH release workspace. ```bash # Clone the ruby-release repository git clone https://github.com/cloudfoundry/bosh-package-ruby-release cd ~/workspace/bosh-package-ruby-release # Navigate to your BOSH release cd ~/workspace/your-release # Vendor in Ruby 3.4 package bosh vendor-package ruby-3.4 ~/workspace/bosh-package-ruby-release # Verify the package was added ls packages/ # Output: ruby-3.4 your-other-packages... cat packages/ruby-3.4/spec # --- ``` -------------------------------- ### BOSH Package and Job Specifications Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Defines package dependencies and job templates for Ruby applications. ```yaml # packages/my-ruby-app/spec --- name: my-ruby-app dependencies: - ruby-3.4 # Vendored Ruby package files: - my-app/**/* - my-app/.bundle/config ``` ```yaml # jobs/my-job/spec --- name: my-job templates: ctl.erb: bin/ctl config.yml.erb: config/config.yml packages: - ruby-3.4 - my-ruby-app properties: my_job.port: description: "Port to listen on" default: 9292 ``` -------------------------------- ### CI Pipeline Reconfiguration Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Commands to reconfigure the CI pipeline after updating version definitions. ```bash # After modifying versions.yml, reconfigure the CI pipeline cd ci ./configure.sh # The pipeline will automatically: # 1. Download Ruby source tarball # 2. Download RubyGems tarball # 3. Create compile.env and runtime.env scripts # 4. Build and test the package # 5. Create a new release ``` -------------------------------- ### Concourse Pipeline for Ruby Package Bumping Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Configures a Concourse job to automatically bump Ruby package versions in a BOSH release. ```yaml # ci/pipelines/my-release.yml resources: - name: my-bosh-release type: git source: uri: git@github.com:my-org/my-bosh-release.git branch: main private_key: ((github-private-key)) - name: ruby-release type: git source: uri: https://github.com/cloudfoundry/bosh-package-ruby-release.git branch: main jobs: - name: bump-ruby plan: - in_parallel: - get: my-bosh-release - get: ruby-release trigger: true - task: bump-ruby-package file: ruby-release/ci/tasks/shared/bump-ruby-package.yml input_mapping: bosh-release: my-bosh-release params: GIT_USER_EMAIL: ci-bot@example.com GIT_USER_NAME: CI Bot PACKAGE: ruby-3.4 PACKAGE_PREFIX: "" # Optional: prefix for package name PRIVATE_YML: | --- blobstore: provider: s3 options: bucket_name: my-release-blobs access_key_id: ((aws-access-key)) secret_access_key: ((aws-secret-key)) RUBY_VERSION_PATH: .ruby-version # Optional: update .ruby-version file - put: my-bosh-release params: repository: bosh-release ``` -------------------------------- ### Concourse Task for Gem Updates Source: https://context7.com/cloudfoundry/bosh-package-ruby-release/llms.txt Uses the bump-gems task to update Gemfiles and optionally vendor dependencies. ```yaml # ci/pipelines/my-release.yml jobs: - name: bump-gems plan: - in_parallel: - get: my-bosh-release - get: ruby-release - task: bump-gems file: ruby-release/ci/tasks/shared/bump-gems.yml input_mapping: input-repo: my-bosh-release params: GEM_DIRS: "src/my-app src/another-app" # Space-separated list of dirs with Gemfile GIT_USER_EMAIL: ci-bot@example.com GIT_USER_NAME: CI Bot PACKAGE: ruby-3.4 UPDATE_BUNDLER_VERSION: false # Set true to also update bundler VENDOR: true # Set true to run bundle cache VENDOR_PATH: vendor/cache # Path for cached gems - put: my-bosh-release params: repository: output-repo ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.