I need some help to implement the keyword “needs” in my yml file, I want to make the dependency between jobs.
For example, I want that one job by schedules checks the device “Connected or not to PC” then if connected the second job runs. I read that with the keyword “needs” it is possible to do.
I’d say that variable resolution doesn’t work in array elements for needs, this likely needs a static job string name. Would qualify for a feature request though, mind creating one?
Hi. Thanks for the answer. "this likely needs a static job string name" - U mean rename jobs, for example from " jobDetect:$UIDID_IPHONE_7_WHITE" to " jobDetect$UIDID_IPHONE_7_WHITE".
I was under the impression that one could use variables to create dynamic job names. You are using this in a way that jobDetect:$UIDID_IPHONE_7_WHITE translates to something like this in your job list: jobDetect:123456789.
Wondering if that’s your intention with the $... notation, or if I am missing some feature here.
Actually the lexer/parser for the config supports that in the background, but does not automatically do that for job names this time.
The config validation already defines a name either as string, or as symbol which makes me thing that this could be generated automatically.
lib/gitlab/ci/config (master=) $ vim entry/job.rb
validations do
validates :config, type: Hash
validates :config, allowed_keys: ALLOWED_KEYS
validates :config, required_keys: REQUIRED_BY_NEEDS, if: :has_needs?
validates :config, presence: true
validates :script, presence: true
validates :name, presence: true
validates :name, type: Symbol
def name
@metadata[:name]
end
I’m still wondering why your pipeline fails. I’ve built one myself and it doesn’t fail.