File tree Expand file tree Collapse file tree 5 files changed +35
-8
lines changed
spec/lib/bk/compat/snapshots/examples/circleci Expand file tree Collapse file tree 5 files changed +35
-8
lines changed Original file line number Diff line number Diff line change 1+ version : ' 2.1'
2+ setup : true
3+ orbs :
4+ path-filtering : circleci/path-filtering@0.1.7
5+ workflows :
6+ generate-config :
7+ jobs :
8+ - path-filtering/filter :
9+ base-revision : main
10+ config-path : .circleci/continue_config.yml
11+ mapping : |
12+ src/.* build-code true
13+ doc/.* build-docs true
14+ src/tests/.* string-parameter "value"
Original file line number Diff line number Diff line change @@ -35,10 +35,12 @@ def load_orb(key, _config)
3535 def self . matches? ( text )
3636 # sorting is important
3737 config = YAML . safe_load ( text , aliases : true )
38- mandatory_keys = %w[ jobs version workflows ] . freeze
38+ mandatory_keys = %w[ version workflows ] . freeze
39+ has_mandatory = ( mandatory_keys & config . keys == mandatory_keys )
40+ at_least_one_of = %w[ jobs orbs ] . any? { |k | config . include? ( k ) }
3941
4042 return false if config . is_a? ( String )
41- return true if mandatory_keys & config . keys == mandatory_keys
43+ return true if has_mandatory && at_least_one_of
4244
4345 # legacy format support
4446 config . fetch ( 'version' , 2.1 ) == 2 && config [ 'jobs' ] . include? ( 'build' )
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33require_relative 'orbs/docker'
4+ require_relative '../../models/steps/circleci'
45
56module BK
67 module Compat
@@ -15,10 +16,13 @@ def matcher?(orb, _conf)
1516 orb . start_with? ( "#{ @prefix } /" )
1617 end
1718
18- def translator ( action , _config )
19- [
20- "# #{ action } is part of orb #{ @prefix } which is not supported and should be translated by hand"
21- ]
19+ def translator ( action , config )
20+ BK ::Compat ::CircleCIStep . new (
21+ key : config [ 'name' ] || action ,
22+ commands : [
23+ "# #{ action } is part of orb #{ @prefix } which is not supported and should be translated by hand"
24+ ]
25+ )
2226 end
2327 end
2428 end
Original file line number Diff line number Diff line change @@ -31,9 +31,10 @@ def process_workflow_job(job)
3131 BK ::Compat ::BlockStep . new ( key : key , depends_on : config . fetch ( 'requires' , [ ] ) )
3232 elsif @commands_by_key . include? ( key )
3333 process_job ( key , config )
34+ elsif key . include? ( '/' ) # orb jobs will not be defined in commands_by_key
35+ @translator . translate_step ( key , config )
3436 else
35- raise BK ::Compat ::Error ::ConfigurationError ,
36- "Job '#{ key } ' is not defined"
37+ raise BK ::Compat ::Error ::ConfigurationError , "Job '#{ key } ' is not defined"
3738 end
3839 end
3940
Original file line number Diff line number Diff line change 1+ -- -
2+ steps :
3+ - commands :
4+ - " # path-filtering/filter is part of orb path-filtering which is not supported
5+ and should be translated by hand "
6+ key: path-filtering/filter
You can’t perform that action at this time.
0 commit comments