Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tasks/validate-all-jobs-public): Scan correct directory, make standalone script, and use Ruby 3.1 #442

Merged
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: 0 additions & 3 deletions Gemfile

This file was deleted.

26 changes: 0 additions & 26 deletions Gemfile.lock

This file was deleted.

15 changes: 0 additions & 15 deletions tasks/validate-all-jobs-public/task

This file was deleted.

38 changes: 38 additions & 0 deletions tasks/validate-all-jobs-public/task.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env ruby

require 'yaml'

def find_yaml_files(directory)
yaml_files = Dir.glob(File.join(directory, '**', '*.yaml'))
yml_files = Dir.glob(File.join(directory, '**', '*.yml'))
yaml_files + yml_files
end

directory = ENV['RUNTIME_CI_DIR']
if directory.nil? || directory.strip.empty?
puts "Error: Please set the RUNTIME_CI_DIR environment variable to specify the directory."
end

yaml_files = find_yaml_files(directory)
puts "Found #{yaml_files.size} YAML files in #{directory}"

failure = false

yaml_files.each do |file|
puts "Checking #{file}..."
yaml_content = YAML.load_file(file, aliases: true)
next unless yaml_content.is_a?(Hash) && yaml_content.key?('jobs')
yaml_content['jobs'].each do |job|
unless job['public'] == true
puts "- #{job['name']} is not public."
failure = true
end
end
end

if failure
puts 'Error: Some jobs are not public'
exit 1
end

puts 'All jobs are public!'
6 changes: 3 additions & 3 deletions tasks/validate-all-jobs-public/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ image_resource:
type: docker-image
source:
repository: ruby
tag: 2.3-slim
tag: 3.1-slim

inputs:
- name: runtime-ci

run:
path: runtime-ci/tasks/validate-all-jobs-public/task
path: runtime-ci/tasks/validate-all-jobs-public/task.rb

params:
RUNTIME_CI_DIR: runtime-ci
RUNTIME_CI_DIR: runtime-ci/ci
14 changes: 0 additions & 14 deletions tasks/validate-all-jobs-public/validate_jobs_public.rb

This file was deleted.

Loading