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

Only download porter runtime when porter changes #20

Merged
merged 2 commits into from
Jan 12, 2023

Conversation

carolynvs
Copy link
Member

This fixes the EnsurePorter helper so that the porter-runtime binary isn't constantly re-downloaded on a mac/win dev machine. I was trying to download only when the version was out of date but that can't be reliably checked on all platforms since the runtime binary is always linux. So the version check was failing every time (and causing a download).

I've updated the EnsurePorter logic so that we download the runtime binary when:

  • It's missing
  • We downloaded the client

This way repeated builds won't re-download anything, but if the change the desired client version that will force the runtime to download too.

I was checking if the porter-runtime version matched the desired version and completely forgot that check will _only_ pass on linux. So on most local dev machines, win/mac, it was always downloading the runtime each build because the version check failed. You can't check the version when the architecture is a mismatch...

I've updated the EnsurePorter logic so that we download the runtime binary when:
* It's missing
* We downloaded the client

This way repeated builds won't re-download anything, but if the change the desired client version that will force the runtime to download too.

Signed-off-by: Carolyn Van Slyck <[email protected]>

// when the runtime binary already exists, leave it
t.Run("runtime binary only downloaded when client is stale", func(t *testing.T) {
tmp, err := os.MkdirTemp("", "magefiles")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - we can use t.TempDir here to have it being automatically cleaned up

Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs
Copy link
Member Author

@VinozzZ Fixed, please take a look

@carolynvs carolynvs merged commit 44f56b6 into getporter:main Jan 12, 2023
@carolynvs carolynvs deleted the fix-porter-runtime-check branch January 12, 2023 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants