Skip to content

Commit

Permalink
fix(action): copy metadata on create-job action (#14232) (#14233)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev committed Jul 11, 2023
1 parent 0564249 commit faaa302
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 faaa302

Please sign in to comment.