Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4322: Fix render not fully overwriting output files. #4323

Merged
merged 1 commit into from
Jun 17, 2020
Merged

#4322: Fix render not fully overwriting output files. #4323

merged 1 commit into from
Jun 17, 2020

Conversation

alewis001
Copy link
Contributor

If the output file already existed, it was not being truncated to the
new output. If the existing content was larger than the new output, the
remainder of the existing output was left in the file corrupting the
contents.

Fixes: #4322

Description

The changes are:

  • Change the os.OpenFile call to os.Create in util.go
  • Change kustomise.go to be consistent with the other deployers and use the outputRenderedManifests function of util.go

If the output file already existed, it was not being truncated to the
new output. If the existing content was larger than the new output, the
remainder of the existing output was left in the file corrupting the
contents.
@codecov
Copy link

codecov bot commented Jun 15, 2020

Codecov Report

Merging #4323 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4323      +/-   ##
==========================================
+ Coverage   71.76%   71.81%   +0.05%     
==========================================
  Files         324      324              
  Lines       12477    12468       -9     
==========================================
  Hits         8954     8954              
+ Misses       2954     2947       -7     
+ Partials      569      567       -2     
Impacted Files Coverage Δ
pkg/skaffold/deploy/kustomize.go 77.57% <100.00%> (+2.86%) ⬆️
pkg/skaffold/deploy/util.go 63.88% <100.00%> (ø)
...affold/kubernetes/portforward/kubectl_forwarder.go 63.41% <0.00%> (+2.43%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b0c0629...564f7ed. Read the comment docs.

@gsquared94 gsquared94 added the kokoro:run runs the kokoro jobs on a PR label Jun 15, 2020
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Jun 15, 2020
Copy link
Member

@briandealwis briandealwis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Could you please fix up the situation identified below?

@briandealwis briandealwis merged commit 6f2e834 into GoogleContainerTools:master Jun 17, 2020
@alewis001 alewis001 deleted the fix-4322 branch June 17, 2020 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Render does not fully overwrite output file if it already exists
5 participants