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

Add common jib sync code for processing syncmap #3489

Merged
merged 5 commits into from
Jan 21, 2020
Merged

Conversation

loosebazooka
Copy link
Member

@loosebazooka loosebazooka commented Jan 9, 2020

Introduces code to initialize sync caches, update them and check
for differences when watched files change

It does not allow actually configuring sync yet. It just sets up the necessary underlying code to make calls out to jib and process the diffs

Converted this into two separate PRs

This one now just calls out to jib to get the syncmap and coverts json to a usable object.

@codecov
Copy link

codecov bot commented Jan 9, 2020

Codecov Report

Merging #3489 into master will decrease coverage by 0.02%.
The diff coverage is 61.53%.

Impacted Files Coverage Δ
pkg/skaffold/build/jib/sync.go 61.53% <61.53%> (ø)

@loosebazooka loosebazooka force-pushed the jib-sync-parts-2 branch 2 times, most recently from 0daea14 to df50544 Compare January 13, 2020 17:54
@loosebazooka loosebazooka changed the title Add common jib sync code for auto mode Add common jib sync code for processing syncmap Jan 13, 2020
Copy link
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

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

Nits but otherwise LGTM

Dest string `json:"dest"`
}

func getSyncMapFromSystem(cmd *exec.Cmd) (*SyncMap, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: why FromSystem?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just getSyncMap? in the end we are under jib anyways

Copy link
Member Author

Choose a reason for hiding this comment

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

there is actually another getSyncMap in this series of PRs, I guess since I split them out, this naming is a little weird.

Copy link
Contributor

Choose a reason for hiding this comment

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

What does the other getSyncMap do?

Copy link
Member Author

Choose a reason for hiding this comment

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

It checks if gradle/maven and then collects the right cmd and then calls out to this.

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha

pkg/skaffold/build/jib/sync.go Show resolved Hide resolved
pkg/skaffold/build/jib/sync_test.go Outdated Show resolved Hide resolved
return nil, errors.New("failed to get Jib Sync data")
}

line := bytes.Replace(matches[1], []byte(`\`), []byte(`\\`), -1)
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this for? Windows support? Also don't see it covered in testcases unless I'm missing something.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good questions, this is copied from another jib-json section, I'll verify what it's doing.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@chanseokoh great minds...

It's not going to be easy to cover this with integration tests as we don't have Windows integration tests just yet. We could (and should:)) take the output of jib on a Windows env and paste it in our testcases, similarly how we put unix outputs in there.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah working on that, might need to restructure a few things to actually allow it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I dug into this some more. I think it's an artifact from previous jib outputs, it just happened to work because multiple back slashes are ignored. I think the reality is that we don't need to do this, I have a new commit that removes it, will push tomorrow.

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

pkg/skaffold/build/jib/sync.go Outdated Show resolved Hide resolved
Converts json output from jib maven/gradle command to a syncmap
that can be processed within skaffold
@balopat balopat merged commit 29a6f60 into master Jan 21, 2020
@briandealwis briandealwis deleted the jib-sync-parts-2 branch April 14, 2020 15:59
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.

4 participants