Replies: 2 comments
-
Sure - TLDR:
Explanation:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Many thanks, Mike. That's great!
All the best,
Steve Brown
*Steve Brown*
*Architect*
*Mobile +44 (0) 7531 129 742*
*Email ***@***.*** ***@***.***>**Web: www.estafet.com
<http://www.estafet.com/> *
*Estafet LimitedRegistered Office: 8 Printworks HouseDunstable
RoadRichmondTW9 1RR*
*Registered at: Companies House, Cardiff. Company Number: 4444147*
…On Mon, 5 Jun 2023 at 18:06, Mike Farah ***@***.***> wrote:
Sure - TLDR:
yq '(.objects[] | select(.kind == "Project") | .metadata.labels[0]) = {"label": "${PROJECT_NAME}"}' new.yaml
Explanation:
- splat the objects array to match all its children .objects[]
- filter the children, select the ones where kind == "Project" select(.kind
== "Project")
- the rest you had was right - just need brackets around the whole LHS
expression
—
Reply to this email directly, view it on GitHub
<#1688 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCO3QYMIHMHKAXG6MRHY2LXJYGZJANCNFSM6AAAAAAY23KBRE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
This email and any
files transmitted with it are confidential and solely
for the use of the intended
recipient. This message contains confidential
information and is intended only for the individual named. If you are not
the
intended recipient you are notified that disclosing, copying,
distributing or
taking any action in reliance on the contents of this
information is strictly
prohibited. Please notify the sender immediately by
e-mail if you have
received this e-mail by mistake and delete this e-mail
from your system.
Computer
viruses can be transmitted via email.
The recipient should check this email and
any attachments for the presence
of viruses. Although the company has taken reasonable
precautions to ensure
no viruses are present in this email, the company cannot
accept
responsibility for any loss or damage arising from the use of this email
or
attachments.
Any views or opinions
presented in this email are
solely those of the author and do not necessarily
represent those of the
Estafet. Employees of Estafet are expressly required not
to make defamatory
statements and not to infringe or authorize any infringement
of copyright
or any other legal right by email communications. Any such
communication is
contrary to company policy. The company will not accept any
liability in
respect of such communication, and the employee responsible will
be
personally liable for any damages or other liability arising.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have this YAML in
new.yaml
:I'd like to insert this YAML
Immediately before the
spec
in theProject
object.I can do this with the following yq query:
My question is can I do this, not using an index on
objects
, but the value of theobject.kind
field instead? If so, how?I'm using
yq (https://github.com/mikefarah/yq/) version v4.34.1
on Red Hat Enterprise Linux version 9.2Many thanks,
Steve Brown
Beta Was this translation helpful? Give feedback.
All reactions