diff --git a/Gemfile b/Gemfile deleted file mode 100644 index b0c76457f..000000000 --- a/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source 'https://rubygems.org' - -gem 'rspec' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 462e03252..000000000 --- a/Gemfile.lock +++ /dev/null @@ -1,26 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - diff-lcs (1.3) - 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-support (~> 3.8.0) - rspec-expectations (3.8.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - -PLATFORMS - ruby - -DEPENDENCIES - rspec - -BUNDLED WITH - 2.0.1 diff --git a/tasks/validate-all-jobs-public/task b/tasks/validate-all-jobs-public/task deleted file mode 100755 index ec6aa5f76..000000000 --- a/tasks/validate-all-jobs-public/task +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -set -exu - -# Inputs -RUNTIME_CI_DIR="${PWD}/${RUNTIME_CI_DIR:?"\$RUNTIME_CI_DIR not set"}" - -pushd "${RUNTIME_CI_DIR}" > /dev/null - PARSED_BUNDLE_VERSION=$(sed -n '/BUNDLED WITH/{;n;p;}' Gemfile.lock) - gem uninstall bundler - gem install bundler --version "$PARSED_BUNDLE_VERSION" - bundle install - bundle exec rspec \ - --color \ - "tasks/validate-all-jobs-public/validate_jobs_public.rb" -popd > /dev/null diff --git a/tasks/validate-all-jobs-public/task.rb b/tasks/validate-all-jobs-public/task.rb new file mode 100755 index 000000000..ac333d82d --- /dev/null +++ b/tasks/validate-all-jobs-public/task.rb @@ -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!' diff --git a/tasks/validate-all-jobs-public/task.yml b/tasks/validate-all-jobs-public/task.yml index 671cd7b8d..eac38a0c7 100644 --- a/tasks/validate-all-jobs-public/task.yml +++ b/tasks/validate-all-jobs-public/task.yml @@ -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 diff --git a/tasks/validate-all-jobs-public/validate_jobs_public.rb b/tasks/validate-all-jobs-public/validate_jobs_public.rb deleted file mode 100644 index d014557b3..000000000 --- a/tasks/validate-all-jobs-public/validate_jobs_public.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'yaml' - -Dir.glob("pipelines/*.yml").each do |f| - job_array = YAML.load_file(f)['jobs'].map{ |j| {:name => j['name'], :public => j['public']} } - job_array.each do |job| - RSpec.describe "pipeline jobs" do - context "for #{f}\##{job[:name]}" do - it "should have public: true" do - expect(job[:public]).to be_truthy - end - end - end - end -end