Skip to content

Commit

Permalink
Feature: add openssl path param (#149)
Browse files Browse the repository at this point in the history
* Add a new parameter to set a custom openssl version in ruby installation

* Add tests

* Fix new parameter definition

* Fix new parameter definition
  • Loading branch information
marboledacci authored Sep 26, 2024
1 parent a483aaa commit 5d0d035
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ executors:
image: << parameters.image >>

jobs:
test-openssl-installed:
docker:
- image: cimg/node:16.18.0
steps:
- run:
name: Install OpenSSL 1.1.1
command: |
wget https://openssl.org/source/openssl-1.1.1.tar.gz
tar -xzvf openssl-1.1.1.tar.gz
cd openssl-1.1.1
./config
make
sudo make install
- ruby/install:
version: 2.7.6
openssl-path: /usr/local/ssl
test-openssl-3:
docker:
- image: cimg/node:16.18.0
Expand Down Expand Up @@ -152,6 +168,11 @@ workflows:
# Make sure to include "filters: *filters" in every test job you want to run as part of your deployment.
- integration-tests:
filters: *filters
- test-openssl-installed:
filters: *filters
post-steps:
- run: |
ruby -ropenssl -e 'if OpenSSL::OPENSSL_VERSION.include?("OpenSSL 1.1.1"); puts "Version 1.1.1 detected"; else; puts "Different version detected"; exit 0; end'
- install-on-macos:
matrix:
parameters:
Expand Down
9 changes: 9 additions & 0 deletions src/commands/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ parameters:
You can also pass in a string to be evaluated.
For example, `${MY_RUBY_VERSION}` or `$(cat foo/bar/.ruby-version)`.
type: string
openssl-path:
description: >
Directory where OpenSSL is intalled.
This will overwrite the value of --with-openssl-dir in the rvm install commmand.
Set this if you need to use an OpenSSL version different to 1.0.1 (rvm default).
The version must be already installed.
type: string
default: ""
steps:
- run:
name: "Install/Verify Ruby Version Manager."
Expand All @@ -16,4 +24,5 @@ steps:
name: "Install Ruby v<< parameters.version >> via RVM"
environment:
PARAM_VERSION: << parameters.version >>
PARAM_OPENSSL_PATH: << parameters.openssl-path >>
command: << include(scripts/install-ruby.sh) >>
6 changes: 4 additions & 2 deletions src/scripts/install-ruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ if [ "$detected_platform" = "darwin" ] && [ "$RUBY_VERSION_MAJOR" -le 2 ]; then
exit 0
fi

if ! openssl version | grep -q -E '1\.[0-9]+\.[0-9]+'
then
if [ -n "$PARAM_OPENSSL_PATH" ]; then
echo "Using path $PARAM_OPENSSL_PATH for OpenSSL"
WITH_OPENSSL="--with-openssl-dir=$PARAM_OPENSSL_PATH"
elif ! openssl version | grep -q -E '1\.[0-9]+\.[0-9]+'; then
echo "Did not find supported openssl version. Installing Openssl rvm package."
rvm pkg install openssl
# location of RVM is expected to be available at RVM_HOME env var
Expand Down

0 comments on commit 5d0d035

Please sign in to comment.