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 more Ubuntu versions and Debian support #439

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

cpuguy83
Copy link
Member

Individual commits detail each change.
Basically:

  1. Added some best-effort support to support older go verisons that may not support the GOMODCACHE env var
  2. Sets $PATH in the deb build scripts to what's in the worker image to improve reproducibility
  3. Add support for non-standard Ubuntu/Debian go packages from backports that do not install go into $PATH
  4. Add Ubuntu versions
  5. Add Debian versions

website/docs/targets.md Outdated Show resolved Hide resolved
@cpuguy83 cpuguy83 force-pushed the MOAR_UBUNTU branch 2 times, most recently from 8c20ad9 to d5b0051 Compare November 26, 2024 18:55
This is just shifting some bits raound to make more sense for adding
other Ubuntu versions.

Signed-off-by: Brian Goff <[email protected]>
Older versions of Go that supported go modules didn't neccessarily
support the `GOMODCACHE` env var.
This change works around this limitation by linking our fetched go
modules into the configured `$GOPATH` when this is the case.

Additionally updates the gomod generator to not rely on `$GOMODCACHE`.

Signed-off-by: Brian Goff <[email protected]>
This prepares the deb packaging to allow worker images to update $PATH
and make sure that is passed along to the build scripts so that the
source package is more likely to be reproducible.

This will be useful for supporting non-standard go packages in Ubuntu
such as `golang-<ver>` which do not add the go bins anywhere in the
standard $PATH.

Signed-off-by: Brian Goff <[email protected]>
Sometimes the `golang` package is just very old, but there may be other
packages available like `golang-<ver>`, however those do not typically
install the `go` binary such that it would be available in $PATH.

This autoamtically looks up go and sets $PATH to include go in that
path, but only when there is a `golang-<ver>` package in the dependency
list.

Signed-off-by: Brian Goff <[email protected]>
The package is not available on all debian distros but is instead listed
as a `Provides` from the `debhelper` package.

The debhelper-compat build dep is still part of the generated debian
control file so the compat level is still ensured.

This is required to support distros that do not have an explicit package
called `debhelper-compat` and instead only lists it in the `Provides`
section of the `debhelper` package.

Signed-off-by: Brian Goff <[email protected]>
Adds 18.04, 20.04, and 24.04 (in addition to 22.04 which was already
there).

For tests, given that Ubuntu <= 20.04 have a "golang" package that is
too old to run the tests, I added a way to override the package name
used in the test.

Another minor modification due to Bionic not supporting
`execute_after_dh_fixperms`.

Signed-off-by: Brian Goff <[email protected]>
This adds Debian Bullseye and Bookworm support.
The only real change needed here was to update the distro config to
allow us to enable the `bullseye-backports` repo so the tests can
install a more recent version of go (and as such pass the test).

Signed-off-by: Brian Goff <[email protected]>
This makes the build a bit more friendly to building outside of DALEC
where we don't mess with *their* $PATH except by adding the paths we
need instead of replacing the whole thing.

Signed-off-by: Brian Goff <[email protected]>
// PrependPath is a list of paths to be prepended to the $PATH var in build
// scripts.
PrependPath []string
// APpendPath is a list of paths to be appended to the $PATH var in build
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// APpendPath is a list of paths to be appended to the $PATH var in build
// AppendPath is a list of paths to be appended to the $PATH var in build

@@ -77,6 +77,13 @@ func buildScript(spec *dalec.Spec) string {
fmt.Fprintln(b, "set -e")

if spec.HasGomods() {
// Older go versions did not have support for the `GOMODCACHE` var
// This is a hack to try and make the build work by linking the go modules
// we've already fetched into to module dir under $GOPATH
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment mentioning that ${GOPATH}/pkg/mod is the default module dir?

windowscross/container (default) Builds binaries and installs them into a Windows base image
windowscross/worker Builds the base worker image responsible for building the rpm
windowscross/zip Builds binaries combined into a zip file
$ docker buildx build --call targets --build-arg ghcr.io/azure/dalec/frontend:latest - <<< "null"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$ docker buildx build --call targets --build-arg ghcr.io/azure/dalec/frontend:latest - <<< "null"
$ docker buildx build --call targets --build-arg BUILDKIT_SYNTAX=ghcr.io/azure/dalec/frontend:latest - <<< "null"

Copy link
Contributor

Choose a reason for hiding this comment

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

Was this a typo? This is the only way I was able to get that command to work

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.

3 participants