Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tasks/cf-deployment-release-notes-template/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--pattern *_spec.rb
--format documentation

12 changes: 5 additions & 7 deletions tasks/cf-deployment-release-notes-template/Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
source 'https://rubygems.org'

gem 'hashdiff'
gem 'rspec'
gem 'webmock'
gem 'hashdiff', '0.3.8'
gem 'rspec', '~> 3.8.0'
gem 'webmock', '3.5.1'
gem 'crack', '0.4.3'
gem 'rexml', '3.4.4'

group :development do
gem 'guard'
gem 'guard-rspec', require: false
end
61 changes: 14 additions & 47 deletions tasks/cf-deployment-release-notes-template/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,42 @@ GEM
specs:
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
coderay (1.1.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.3)
ffi (1.10.0)
formatador (0.2.5)
guard (2.15.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
diff-lcs (1.6.2)
hashdiff (0.3.8)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
lumberjack (1.0.13)
method_source (0.9.2)
nenv (0.3.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (7.0.5)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rexml (3.4.4)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
rspec-expectations (3.8.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
rspec-mocks (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
ruby_dep (1.5.0)
rspec-support (3.8.3)
safe_yaml (1.0.5)
shellany (0.0.1)
thor (1.4.0)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff

PLATFORMS
arm64-darwin-23
ruby
x86_64-linux

DEPENDENCIES
guard
guard-rspec
hashdiff
rspec
webmock
crack (= 0.4.3)
hashdiff (= 0.3.8)
rexml (= 3.4.4)
rspec (~> 3.8.0)
webmock (= 3.5.1)

BUNDLED WITH
2.0.1
2.4.19
30 changes: 30 additions & 0 deletions tasks/cf-deployment-release-notes-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# cf-deployment-release-notes-template

This task generates the cf-deployment release notes template.

## Run tests locally

### Prerequisites

- Ruby 3.2+
- Bundler installed

### From repository root

```bash
cd tasks/cf-deployment-release-notes-template
bundle install
bundle exec rspec
```

### From task directory (already there)

```bash
bundle install
bundle exec rspec
```

Notes:
- The local `.rspec` config is set to run `*_spec.rb` files in this directory.
- If dependencies changed, re-run `bundle install` before running tests.

9 changes: 7 additions & 2 deletions tasks/cf-deployment-release-notes-template/release_changes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ def load_from_files(filename, opsfile: false)
main_releases_list = collect_releases_and_stemcells(main_branch, opsfile: opsfile)

release_updates = ReleaseUpdates.new
change_set = HashDiff.diff(main_releases_list, release_candidate_releases_list)
hashdiff = if Object.const_defined?(:HashDiff)
Object.const_get(:HashDiff)
else
Object.const_get(:Hashdiff)
end
change_set = hashdiff.diff(main_releases_list, release_candidate_releases_list)
change_set.each do |change|
release_updates.load_change(change)
end
Expand All @@ -33,7 +38,7 @@ def load_yaml_file(input_name, filename)
return nil unless File.exist? filepath

file_text = File.read(filepath)
YAML.load(file_text) || nil
YAML.load(file_text, aliases: true) || nil
end

def collect_releases_and_stemcells(manifest, opsfile: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

after(:all) do
Dir.chdir(@current_work_dir)
FileUtils.rm_rf(@tmp_work_dir) if File.exists?(@tmp_work_dir)
FileUtils.rm_rf(@tmp_work_dir) if File.exist?(@tmp_work_dir)
end

let(:ru) { ReleaseUpdates.new }
Expand Down Expand Up @@ -363,7 +363,7 @@
end

context 'when the operation is "-"' do
let (:op) { '-' }
let(:op) { '-' }
it 'saves the version as old_version' do
updates.load_change(change)
expect(updates.get_update_by_name(name).old_version).to eq version
Expand Down
6 changes: 2 additions & 4 deletions tasks/cf-deployment-release-notes-template/task
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ set -exu
SCRIPT_DIR=runtime-ci/tasks/cf-deployment-release-notes-template

pushd $SCRIPT_DIR
PARSED_BUNDLE_VERSION=$(sed -n '/BUNDLED WITH/{;n;p;}' Gemfile.lock)
gem uninstall bundler
gem install bundler --version "$PARSED_BUNDLE_VERSION"
bundle install --without development
bundle config set --local without development
bundle install
popd

BUNDLE_GEMFILE=$SCRIPT_DIR/Gemfile \
Expand Down
2 changes: 1 addition & 1 deletion tasks/cf-deployment-release-notes-template/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ image_resource:
type: registry-image
source:
repository: ruby
tag: 2.6-slim
tag: 3.2-slim

inputs:
- name: runtime-ci
Expand Down