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

Upgrade packages, change tag/target syntax (#23) #27

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

Conversation

TravisCardwell
Copy link
Collaborator

This PR makes the changes discussed in #23. Please see the commit messages of the two commits for details.

When building an image, the Alpine package index is updated in order to
install various dependencies.  The versions installed depend on the
state of the package index at that time.  One therefore does not
necessarily get the same packages when building `ghc-musl` images at
different times; images are not reproducible in this way.  This commit
adds a command to upgrade any already-installed packages after the
package index is updated.  This ensures that the latest packages are
used, and that the already-installed packages are consistent with the
versions of newly added packages.
Previously, each image was tagged like the following:

* `ghc-musl:v24-ghc924`

With this commit, each image is now tagged like the following:

* `ghc-musl:ghc9.2.4-alpine3.16.1-20220730`
* `ghc-musl:ghc9.2.4-alpine3.16.1`
* `ghc-musl:ghc9.2.4`

This allows users to specify image names according to their needs.  An
image tagged with the GHC version, Alpine version, and (UTC) build date
never changes.  An image tagged with just the GHC version and Alpine
version may be updated to include minor/security package releases, but
the fixed Alpine version means that major upgrades should not break
builds.  An image tagged with just the GHC version may be updated to
include new package releases, both major and minor.

The Earthly targets are renamed to match the new tags.  For example,
previous target `ghc924` is now named `ghc9.2.4`.

Note that updating the GHC-only tag should be done with caution, so that
it always points to an image using the latest (supported) Alpine
version.  To facilitate this, the `image` target has a `TAG_GHC`
argument that defaults to `0` so that the GHC-only tag is not saved by
default.  This argument should be set to `1` only when updating the
image using the latest (supported) Alpine version.  The following
command is an example of using this argument when building locally:

```
$ earthly --allow-privileged --build-arg TAG_GHC=1 +ghc9.2.4
```

The `ALPINE_VERSION` variable is still set to the latest (supported)
Alpine version, *not* set to `latest`.  Users who would like to use the
`latest` image are still able to do so by specifying it in a build
argument.
Copy link
Owner

@utdemir utdemir left a comment

Choose a reason for hiding this comment

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

Thanks for coming up with a sensible scheme!

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