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

update build/release process and add static binary builds #22

Merged
merged 4 commits into from
Jan 19, 2022
Merged

update build/release process and add static binary builds #22

merged 4 commits into from
Jan 19, 2022

Conversation

rosskirkpat
Copy link
Contributor

@rosskirkpat rosskirkpat commented Oct 26, 2021

  • rework/add build scripts that enable statically linked builds of the flannel-cni plugin binary on linux (all arches) and windows (amd64 only)
  • add verification of static builds for linux and windows
  • update the go build logic to fail if GOOS is not linux or windows
  • update makefile and gh actions to use simplified builds and steps
  • automate releases via GH actions
  • add a Dockerfile that will build all of the binaries in a reproducible manner for dev/debug purposes
  • retain all of the prior image build/publish steps

@rosskirkpat
Copy link
Contributor Author

I have the flannel cni plugin building as a statically linked binary now on linux/amd64.

make build_linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 scripts/build_flannel.sh
Building flannel for linux in amd64

dist/flannel-amd64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=mLVLxfqNj4YGYi6HA8Lk/H0AAocC3f3VLIaxfEPEL/Ac0Mx1i37e5OypcAa18d/T1eyQiZ_PX8H71iCUcte, not stripped
verified static links for dist/flannel-amd64

@rosskirkpat rosskirkpat changed the title [WIP] static builds for the flannel cni-plugin binary static builds for the linux/amd64 flannel cni-plugin binary Oct 27, 2021
Copy link
Collaborator

@manuelbuil manuelbuil left a comment

Choose a reason for hiding this comment

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

Thanks Ross! We currently have a mismatch in how we are building the "raw" binaries and how we are building the binaries being distributed inside images (target: dist/flannel-$(ARCH)). Could you modify that target too so that they use the script build_flannel.sh please? That way we will have both statically built

pkg/version/version.go Outdated Show resolved Hide resolved
scripts/build_flannel.sh Outdated Show resolved Hide resolved
scripts/build_flannel.sh Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@rosskirkpat rosskirkpat changed the title static builds for the linux/amd64 flannel cni-plugin binary [WIP] static builds for the linux/amd64 flannel cni-plugin binary Nov 10, 2021
Copy link
Collaborator

@manuelbuil manuelbuil left a comment

Choose a reason for hiding this comment

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

Could you adapt .github/workflows/release.yml and .github/workflows/buildTests.yml to the new Makefile please?

Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
pkg/version/version.go Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
@manuelbuil
Copy link
Collaborator

Please separate this into two different PRs.

  • One building things statically including:
switch to statically linked builds of the flannel-cni plugin binary on linux and windows
add verification of static builds for linux and windows
update the go build logic to fail if GOOS is not linux or windows
update makefile and gh actions to use simplified builds and steps
  • One removing all the Docker files:
remove all build and publish steps for images with the exception of the new Dockerfile for building all of the images in a reproducible manner

The second PR requires changes in how flannel is consumed and we will need to bring it up in the bi-weekly meeting

@rosskirkpat rosskirkpat changed the title [WIP] static builds for the linux/amd64 flannel cni-plugin binary update build/release process and add static binary builds Dec 22, 2021
@rosskirkpat
Copy link
Contributor Author

@Oats87 @luthermonson @manuelbuil @rajatchopra This is ready for review.

.github/workflows/release.yml Show resolved Hide resolved
.github/workflows/release.yml Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
@manuelbuil
Copy link
Collaborator

Another comment I forgot: I guess we don't need the package version anymore. Could you remove it?

scripts/release.sh Outdated Show resolved Hide resolved
@luthermonson
Copy link
Contributor

@rosskirkpat will drop the version stuff and update the src_dir stuff per @manuelbuil 's request and we will merge this.

Copy link
Contributor

@rajatchopra rajatchopra left a comment

Choose a reason for hiding this comment

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

/lgtm

@manuelbuil
Copy link
Collaborator

@rosskirkpat will drop the version stuff and update the src_dir stuff per @manuelbuil 's request and we will merge this.

And rebasing. There are apparently conflicts :)

@rosskirkpat
Copy link
Contributor Author

@rosskirkpat will drop the version stuff and update the src_dir stuff per @manuelbuil 's request and we will merge this.

And rebasing. There are apparently conflicts :)

After a rebase, there are no conflicts and I also resolved the remaining feedback.

rosskirkpat and others added 4 commits January 18, 2022 21:19
switch to statically linked builds of the flannel-cni plugin binary on linux and windows
add verification of static builds for linux and windows
update the go build logic to fail if GOOS is not linux or windows
Copy link
Collaborator

@manuelbuil manuelbuil left a comment

Choose a reason for hiding this comment

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

Thanks Ross!

@manuelbuil manuelbuil merged commit eb6d8c3 into flannel-io:main Jan 19, 2022
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.

4 participants