Skip to content

Commit

Permalink
fix(action): copy metadata on create-job action (argoproj#14232) (arg…
Browse files Browse the repository at this point in the history
…oproj#14233)

Signed-off-by: Michael Crenshaw <[email protected]>
  • Loading branch information
crenshaw-dev authored and xiaowu.zhu committed Aug 9, 2023
1 parent 4405310 commit 40f1177
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ job = {}
job.apiVersion = "batch/v1"
job.kind = "Job"

job.metadata = {}
job.metadata = deepCopy(obj.spec.jobTemplate.metadata)
if job.metadata == nil then
job.metadata = {}
end
job.metadata.name = obj.metadata.name .. "-" ..os.date("!%Y%m%d%H%M")
job.metadata.namespace = obj.metadata.namespace

Expand All @@ -47,6 +50,7 @@ job.metadata.ownerReferences[1] = ownerRef
job.spec = {}
job.spec.suspend = false
job.spec.template = {}
job.spec.template.metadata = deepCopy(obj.spec.jobTemplate.spec.template.metadata)
job.spec.template.spec = deepCopy(obj.spec.jobTemplate.spec.template.spec)

impactedResource = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@ metadata:
spec:
schedule: "* * * * *"
jobTemplate:
metadata:
labels:
my: label
annotations:
my: annotation
spec:
template:
metadata:
labels:
pod: label
annotations:
pod: annotation
spec:
containers:
- name: hello
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@
metadata:
name: hello-00000000000
namespace: test-ns
labels:
my: label
annotations:
my: annotation
spec:
template:
metadata:
labels:
pod: label
annotations:
pod: annotation
spec:
containers:
- name: hello
Expand Down

0 comments on commit 40f1177

Please sign in to comment.