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

feat: Windows release #110

Merged
merged 2 commits into from
Apr 1, 2021
Merged

feat: Windows release #110

merged 2 commits into from
Apr 1, 2021

Conversation

ghost
Copy link

@ghost ghost commented Feb 26, 2021

Closes #108

@ghost ghost changed the title feat: Windows release WIP: feat: Windows release Feb 26, 2021
@ghost ghost linked an issue Feb 26, 2021 that may be closed by this pull request
@stepanstipl stepanstipl added the feature New feature or request label Feb 28, 2021
@stepanstipl
Copy link
Contributor

Nice 👍 , seems the cross-compile works, and as it already works for mac/linux fine, I would kind of hope that it will work for Win too, would be nice to test though - did you manage to?

And I think it will need corresponding - name: Upload Release Asset - Windows step added to .github/workflows/main.yaml to actually upload the windows binary.

@ghost
Copy link
Author

ghost commented Mar 1, 2021

@stepanstipl yeah will add just wanted to see if cross compile worked

@ghost ghost force-pushed the feature/windowsRelease branch from 854fdac to 8f4c2a6 Compare March 1, 2021 09:14
@ghost ghost changed the title WIP: feat: Windows release feat: Windows release Mar 1, 2021
@ghost
Copy link
Author

ghost commented Mar 1, 2021

@stepanstipl added and removed WIP

@ghost ghost requested a review from stepanstipl March 1, 2021 09:14
@ghost ghost mentioned this pull request Mar 1, 2021
@ghost ghost self-assigned this Mar 1, 2021
@ghost ghost force-pushed the feature/windowsRelease branch from 8f4c2a6 to 770719b Compare March 1, 2021 09:45
@stepanstipl
Copy link
Contributor

Cool 👍 I think this looks good, I would just like to do a test on a real windows machine to confirm it actually works before merging this (seen various issues with CGO and dns and stuff historically around K8s go-client - saying that I believe it should not be a problem anymore).

@ghost
Copy link
Author

ghost commented Mar 2, 2021

@stepanstipl agreed I don't have a windows machine

@ghost ghost force-pushed the feature/windowsRelease branch 2 times, most recently from 18738df to a4a5100 Compare March 2, 2021 09:10
@ghost ghost mentioned this pull request Mar 4, 2021
@gerardgorrion
Copy link

Hi all, there're some update of this feature? shows "Merging is blocked". Thanks!

@ghost
Copy link
Author

ghost commented Mar 11, 2021

@gerardgorrion apologies, we have been busy. Have you had a chance to try the binary from this build?

@stepanstipl
Copy link
Contributor

I did a quick test on Win and found 2 issues:

  1. I think the binary has to have .exe extension, otherwise I was not able to convince the system to recognize it as executable (funnily enough once it has the .exe, you can invoke it both by kubent-windows-amd64 and kubent-windows-amd64.exe names... both will execute the .exe binary)
    -> we should name the download artefact that way.

  2. The coloured output is messed up - probably we should disable it for windows, I assume it won't recognize the same terminal control characters. Happy to handle this in a separate issue, as it's not affecting core functionality, just looks ugly ↓

Otherwise hooray 🎉 - seems to work and collect resources!

Screenshot 2021-03-11 at 12 34 01

@ghost ghost force-pushed the feature/windowsRelease branch 2 times, most recently from b2f928a to 7c65572 Compare March 12, 2021 11:27
@ghost
Copy link
Author

ghost commented Mar 12, 2021

Ok, this is now a .exe

@ghost ghost force-pushed the feature/windowsRelease branch 4 times, most recently from 2145dc6 to c38644b Compare March 12, 2021 16:10
@ghost
Copy link
Author

ghost commented Mar 16, 2021

@stepanstipl this one is all done now just awaiting your review

@ghost ghost force-pushed the feature/windowsRelease branch from d6a35a7 to cc73a54 Compare March 16, 2021 16:51
@stepanstipl
Copy link
Contributor

I'm afraid this didn't quite work:

$ GOOS=windows GOARCH=amd64 gmake all
...
$ cd release-artifacts
$ tar -xvzf kubent-dev-windows-amd64.tar.gz
x kubent
$ ls
kubent                          kubent-dev-windows-amd64.tar.gz

Seems like the binary in the archive is still called just kubent.

@ghost
Copy link
Author

ghost commented Mar 30, 2021

@stepanstipl my bad it looks like it just packing the wrong one, will fix.

ls bin
kubent-linux-amd64  kubent-windows-amd64.exe  packed

@ghost ghost force-pushed the feature/windowsRelease branch from cc73a54 to a5fac10 Compare March 30, 2021 16:06
@ghost
Copy link
Author

ghost commented Mar 30, 2021

@stepanstipl this has been fixed:

$ GOOS=windows GOARCH=amd64 make all
$ tar -xvzf release-artifacts/kubent-dev-windows-amd64.tar.gz
kubent.exe

@ghost
Copy link
Author

ghost commented Mar 30, 2021

I had to add another nasty if statement tho

@ghost ghost force-pushed the feature/windowsRelease branch from a5fac10 to 81c13b6 Compare March 30, 2021 16:11
Copy link
Contributor

@stepanstipl stepanstipl left a comment

Choose a reason for hiding this comment

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

Good stuff, some suggestions:

I would suggest introducing a new variable to avoid 3x repeated if condition (and use make logic):

ifeq (windows,$(GOOS))
  BIN_RELEASE_SUFFIX ?= .exe
endif
BIN_RELEASE_SUFFIX ?=

I think it's a bit cleaner. Then we can just change the name in the transform arg:

$(TAR) -cvz --transform 's,$(PACKED_DIR)/$(*)-$(BIN_ARCH),$(*)$(BIN_RELEASE_SUFFIX),gi' -f "$@" "$<"

This has the benefit/disadvantage - depending how you look at it, as compared to the current implementation, of the binary name being consistent, and only appending the .exe when we build the archive. WDYT?

.github/workflows/main.yaml Outdated Show resolved Hide resolved
.github/workflows/main.yaml Show resolved Hide resolved
.github/workflows/main.yaml Outdated Show resolved Hide resolved
@ghost ghost force-pushed the feature/windowsRelease branch from 81c13b6 to e2f00a2 Compare April 1, 2021 08:16
@ghost ghost force-pushed the feature/windowsRelease branch 7 times, most recently from 0939318 to a9261d2 Compare April 1, 2021 10:58
Copy link
Contributor

@stepanstipl stepanstipl left a comment

Choose a reason for hiding this comment

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

Some minor bits to clean up, but I think it looks good and it's pretty much there! 🎉

Super nice that you used the matrix functionality also for uploading the artefacts! 👍 👍

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
.github/workflows/main.yaml Outdated Show resolved Hide resolved
.github/workflows/main.yaml Outdated Show resolved Hide resolved
.github/workflows/main.yaml Outdated Show resolved Hide resolved
@ghost ghost force-pushed the feature/windowsRelease branch 5 times, most recently from 6817b2d to 6cc459e Compare April 1, 2021 15:25
Signed-off-by: david-doit-intl <david@doit-intl.com>
@ghost ghost force-pushed the feature/windowsRelease branch from 6cc459e to f67adc6 Compare April 1, 2021 15:27
Copy link
Contributor

@stepanstipl stepanstipl left a comment

Choose a reason for hiding this comment

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

Looks GOOD!

@stepanstipl stepanstipl merged commit a011986 into master Apr 1, 2021
@stepanstipl stepanstipl deleted the feature/windowsRelease branch April 1, 2021 15:45
@stepanstipl stepanstipl added this to the 0.4.0 milestone Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using Kube-no-trouble in windows OS
2 participants