Skip to content

Commit

Permalink
Upgrade RVM Ruby galaxy to version 2.2.0
Browse files Browse the repository at this point in the history
Now we don't have to overwrite the GPG servers anymore, since the ones
we were using are the default ones in the new version.

I've considered using a git submodule instead of downloading the
release, but decided against it because using git submodules would
require an extra step in order to run the installer (running the command
`git submodule update --init`).
  • Loading branch information
javierm committed Jul 3, 2023
1 parent 4a95fc6 commit 412d269
Show file tree
Hide file tree
Showing 22 changed files with 353 additions and 138 deletions.
1 change: 1 addition & 0 deletions galaxy/rvm.ruby/.github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @rvm/ansible
37 changes: 37 additions & 0 deletions galaxy/rvm.ruby/.github/mergeable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: 2
mergeable:
- when: pull_request.*
name: "triage"
validate:
- do: label
and:
- no_empty:
enabled: true
- must_exclude:
regex: duplicate|feedback|invalid|wont|progress
- do: assignee
min:
count: 1
- do: description
no_empty:
enabled: true
message: Description should not be empty. Provide details with **what** was changed, **why** it was changed, and **how** it was changed.
- do: dependent
changed:
file: '*'
files: ['CHANGELOG.md']
message: Missing CHANGELOG entry
fail:
- do: assign
assignees: [ '@author' ]

# Stale PR
- when: schedule.repository
validate:
- do: stale
days: 20
type: pull_request, issues
pass:
- do: comment
payload:
body: There was no activity for 20 days. Is this still relevant?
59 changes: 59 additions & 0 deletions galaxy/rvm.ruby/.github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI
on:
push:
pull_request:
# Run monthly as a canary for issues such as package installation failure.
# Note: scheduled workflows are disabled automatically after 60 days of
# repository inactivity.
# https://docs.github.com/en/actions/managing-workflow-runs/disabling-and-enabling-a-workflow
schedule:
- cron: '46 3 20 * *'

jobs:
tests:
strategy:
fail-fast: false
matrix:
playbook:
- user.yml
- root.yml
platform:
- centos
- debian
- ubuntu

runs-on: ubuntu-latest

defaults:
run:
working-directory: tests

steps:
- uses: actions/checkout@v3

# Docker Image Caching: Step 1
# Pull the latest image to build, and avoid caching pull-only images.
# (docker pull is faster than caching in most cases.)
- run: docker-compose pull

# Docker Image Caching: Step 2
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: satackey/[email protected]
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true

# Docker Image Caching: Step 3
- name: Launch containers
run: ls -1 ./dockerfiles/ | fgrep ${{ matrix.platform }} | xargs docker-compose up --build -d

- name: Run The Tests
run: ansible-playbook ${{ matrix.playbook }} -l ${{ matrix.platform }}

- name: Shut down containers
run: docker-compose down

# Docker Image Caching: Step 4
# Finally a post-run action of satackey/action-docker-layer-caching,
# which is the process of saving the cache, will be executed automatically.
40 changes: 0 additions & 40 deletions galaxy/rvm.ruby/.travis.yml

This file was deleted.

40 changes: 36 additions & 4 deletions galaxy/rvm.ruby/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,53 @@

### NEXT

* ...
...


### 2.2.0
2022-03-26 · [Changes](https://github.com/rvm/rvm1-ansible/compare/v2.1.2...v2.2.0)

#### New features

* Report when Ruby is removed and don't ignore when version listing fails (#212)
* Add option to disable binary symlink (#94)

#### Bug fixes

* Fix RHEL 7 & 8 based distros to work around /tmp execution issues (#155)
* Fix bare variables in conditionals (deprecation warnings with Ansible 2.8+) (#204)
* Fix boolean values when checking array (#207)
* Fix regression forbidding installation of rubies (#209, fixed via #207)
* Fix conditional logic for detecting and removing versions of Ruby (#212)
* Report when Ruby is removed and don't ignore when version listing fails (#212)
* Refactor rubies install and remove tasks, allow rvm to handle idempotency around this (#219)
* Update key server URLs and decommission of sks-keyservers.net (#232)

#### Changes

* Migrate CI to GitHub Actions (#235)
* Extend test matrix with: (#215)
* CentOS 8, Debian 10, Ubuntu 18.04 and 20.04
* Ruby 2.6.6 and 2.7.1
* Modify some test assertions to better abstract RVM behaviour from its internal implementation ("blackbox" testing) (#205)
* Fix and enhance Travis CI setup (#205)
* Install more recent versions of Ruby, to be compatible with latest Bundler version
* Validate system-wide setup (root.yml)
* Parallelize the tests to speed up the builds

### 2.1.2
2018-12-28
2018-12-28 · [Changes](https://github.com/rvm/rvm1-ansible/compare/v2.1.1...v2.1.2)

* Fallback to alternative GPG key servers (#192)
* Remove keys.gnupg.net in favour of pool.sks-keyservers.net (#192)

### 2.1.1
2018-12-18
2018-12-18 · [Changes](https://github.com/rvm/rvm1-ansible/compare/v2.1.0...v2.1.1)

* Fix RVM verification process after changing `command` to `shell`

### 2.1.0
2018-12-18
2018-12-18 · [Changes](https://github.com/rvm/rvm1-ansible/compare/v2.0.1...v2.1.0)

* Support centos6 and centos7
* Reduce the verbosity
Expand Down
25 changes: 18 additions & 7 deletions galaxy/rvm.ruby/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![Build Status](https://travis-ci.org/rvm/rvm1-ansible.svg?branch=master)](https://travis-ci.org/rvm/rvm1-ansible)
[![Build Status](https://github.com/rvm/rvm1-ansible/actions/workflows/tests.yml/badge.svg)](https://github.com/rvm/rvm1-ansible/actions/workflows/tests.yml)
[![OpenCollective](https://opencollective.com/rvm/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/rvm/sponsors/badge.svg)](#sponsors)
[![Ansible Role](https://img.shields.io/badge/role-rvm_io-red.svg)](https://galaxy.ansible.com/rvm/ruby)
[![Ansible Role](https://img.shields.io/badge/role-rvm_io-red)](https://galaxy.ansible.com/rvm/ruby)
[![Ansible Role Downloads](https://img.shields.io/ansible/role/d/30318)](https://galaxy.ansible.com/rvm/ruby)

## What is rvm1-ansible?

Expand Down Expand Up @@ -75,10 +76,13 @@ rvm1_rvm_check_for_updates: True
rvm1_gpg_keys: '409B6B1796C275462A1703113804BB82D39DC0E3'

# The GPG key server
rvm1_gpg_key_server: 'hkp://pool.sks-keyservers.net'
rvm1_gpg_key_server: 'hkp://keys.openpgp.org'

# autolib mode, see https://rvm.io/rvm/autolibs
rvm1_autolib_mode: 3

# Symlink binaries to system path
rvm1_symlink: true
```
## Example playbooks
Expand Down Expand Up @@ -143,12 +147,14 @@ rvm1_install_flags: '--auto-dotfiles --user-install'
rvm1_install_path: '/home/someuser/.rvm'
```

#### A quick note about `rvm1_user`
#### Quick notes about `rvm1_user`

In some cases you may want the rvm folder and its files to be owned by a specific
user instead of root. Simply set `rvm1_user: 'foo'` and when ruby gets installed
it will ensure that `foo` owns the rvm directory.

This would use Ansible's `become` under the hood. In case of failures (e.g. `Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user`), check https://docs.ansible.com/ansible/latest/user_guide/become.html for details and possible solutions.

## Upgrading and removing old versions of ruby

A common work flow for upgrading your ruby version would be:
Expand All @@ -163,9 +169,14 @@ Just add `--extra-vars 'rvm1_delete_ruby=ruby-2.1.0'` to the end of your play bo

## Requirements

- Tested on CentOS 6 and 7
- Tested on Debian 8 and 9
- Tested on Ubuntu 14.04 and 16.04
Potentially, any Linux/Unix system supported by Ansible and satisfying the [RVM prerequisites](https://rvm.io/rvm/prerequisites) should work.

Compatibility with Linux distributions based on Debian, Ubuntu or Redhat families is actively tested.

The continuous integration setup of this project currently covers following platforms:
- CentOS 6, 7 and 8
- Debian 8, 9 and 10
- Ubuntu 14.04, 16.04, 18.04 and 20.04

## Ansible galaxy

Expand Down
9 changes: 6 additions & 3 deletions galaxy/rvm.ruby/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Install 1 or more versions of ruby
# The last ruby listed will be set as the default ruby
rvm1_rubies:
- "ruby-2.3.1"
- 'ruby-2.3.1'

# Install bundler
rvm1_bundler_install: True
Expand Down Expand Up @@ -41,14 +41,14 @@ rvm1_rvm_check_for_updates: True
rvm1_gpg_keys: '409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB'

# The GPG key server
rvm1_gpg_key_server: 'hkp://pool.sks-keyservers.net'
rvm1_gpg_key_server: 'hkp://keys.openpgp.org'

# The GPG alternative key servers
rvm1_gpg_key_servers:
- '{{ rvm1_gpg_key_server }}'
- hkp://ipv4.pool.sks-keyservers.net
- hkp://pgp.mit.edu
- hkp://keyserver.pgp.com
- hkp://keyserver.ubuntu.com

# autolib mode, see https://rvm.io/rvm/autolibs
rvm1_autolib_mode: 3
Expand All @@ -58,3 +58,6 @@ root_user: 'root'

# Name of GID 0 group -- BSD systems typically use wheel instead of root
root_group: '{{ root_user }}'

# Symlink binaries to system path
rvm1_symlink: true
1 change: 0 additions & 1 deletion galaxy/rvm.ruby/meta/.galaxy_install_info

This file was deleted.

32 changes: 11 additions & 21 deletions galaxy/rvm.ruby/tasks/rubies.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
---

- name: Detect if rubies are installed
command: '{{ rvm1_rvm }} {{ item }} do true'
- name: Detect rubies
command: '{{ rvm1_rvm }} list strings'
register: rvm_list_strings
changed_when: False
failed_when: False
register: detect_rubies
with_items: '{{ rvm1_rubies }}'
when: rvm1_rubies

- name: Install rubies
command: '{{ rvm1_rvm }} install {{ item.item }} {{ rvm1_ruby_install_flags }}'
when: rvm1_rubies and item.rc|default(0) != 0
with_items: '{{ detect_rubies.results }}'
command: '{{ rvm1_rvm }} install {{ item }} {{ rvm1_ruby_install_flags }}'
loop: '{{ rvm1_rubies | difference(rvm_list_strings.stdout_lines) }}'

- name: Detect default ruby version
command: '{{ rvm1_rvm }} alias list default'
Expand Down Expand Up @@ -49,7 +45,7 @@
dest: '{{ rvm1_symlink_to }}/{{ item }}'
owner: '{{ root_user }}'
group: '{{ root_group }}'
when: not '--user-install' in rvm1_install_flags
when: not '--user-install' in rvm1_install_flags and rvm1_symlink
with_items: '{{ rvm1_symlink_binaries }}'

- name: Symlink bundler binaries on the system path
Expand All @@ -59,17 +55,11 @@
dest: '{{ rvm1_symlink_to }}/{{ item }}'
owner: '{{ root_user }}'
group: '{{ root_group }}'
when: not '--user-install' in rvm1_install_flags and rvm1_bundler_install
when: not '--user-install' in rvm1_install_flags and rvm1_bundler_install and rvm1_symlink
with_items: '{{ rvm1_symlink_bundler_binaries }}'

- name: Detect if ruby version can be deleted
command: '{{ rvm1_rvm }} {{ rvm1_delete_ruby }} do true'
changed_when: False
failed_when: False
register: detect_delete_ruby
when: rvm1_delete_ruby

- name: Delete ruby version
- name: Delete ruby if relevant
command: '{{ rvm1_rvm }} remove {{ rvm1_delete_ruby }}'
changed_when: False
when: rvm1_delete_ruby and detect_delete_ruby.rc == 0
register: rvm_delete_command
changed_when: "'#removing' in rvm_delete_command.stdout"
when: rvm1_delete_ruby is defined and rvm1_delete_ruby
2 changes: 1 addition & 1 deletion galaxy/rvm.ruby/tasks/rvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

- name: Install rvm
shell: >
{{ rvm1_temp_download_path }}/rvm-installer.sh {{ rvm1_rvm_version }}
/usr/bin/env bash {{ rvm1_temp_download_path }}/rvm-installer.sh {{ rvm1_rvm_version }}
--path {{ rvm1_install_path }} {{ rvm1_install_flags }}
when: not rvm_binary.stat.exists

Expand Down
Loading

0 comments on commit 412d269

Please sign in to comment.