Skip to content

Commit

Permalink
more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
timothysmith0609 committed Jan 16, 2025
1 parent 9c05903 commit 0793c13
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/krane/resource_deployer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def initialize(task_config:, prune_allowlist:, global_timeout:, current_sha: nil

def deploy!(resources, verify_result, prune)
if verify_result
deploy_all_resources(resources, prune: prune, verify: true)
deploy_all_resources(resources, prune: prune, verify: true, annotate_individuals: true)
failed_resources = resources.reject(&:deploy_succeeded?)
success = failed_resources.empty?
if !success && failed_resources.all?(&:deploy_timed_out?)
Expand Down Expand Up @@ -123,7 +123,8 @@ def deploy_resources(resources, prune: false, verify:, record_summary: true, ann
apply_all(applyables, prune)

if annotate_individuals
update_last_applied_annotations(individuals)
to_annotate = individuals.select { |r| pruneable_types.include?(r.type) && !r.deploy_method_override }
update_last_applied_annotations(to_annotate)
end

if verify
Expand Down Expand Up @@ -257,15 +258,14 @@ def create_resource(resource)
end

def update_last_applied_annotations(resources)
resources.select { |r| pruneable_types.include?(r.type) && !r.deploy_method_override }
.each do |resource|
resources.each do |resource|
err, status = set_last_applied_annotation(resource)
raise FatalDeploymentError, "Failed to set last applied annotation: #{err}" unless status.success?
end
end

def set_last_applied_annotation(resource)
_, err, status = kubectl.run("kubectl", "apply", "set-last-applied", "-f", resource.file_path, log_failure: false,
_, err, status = kubectl.run("apply", "set-last-applied", "--create-annotation", "-f", resource.file_path, log_failure: false,
output_is_sensitive: resource.sensitive_template_content?, use_namespace: !resource.global?)
[err, status]
end
Expand Down

0 comments on commit 0793c13

Please sign in to comment.