Skip to content

GoReleaser config and multi-platform image builds - #1052

Merged
aelsabbahy merged 10 commits into
goss-org:masterfrom
kgaughan:goreleaser
Jul 5, 2026
Merged

aelsabbahy merged 10 commits into
goss-org:masterfrom
kgaughan:goreleaser

Conversation

@kgaughan

@kgaughan kgaughan commented Apr 12, 2026 •

Copy link
Copy Markdown
Collaborator
Checklist
  • make test-all (UNIX) passes. CI will also test this
  • unit and/or integration tests are included (if applicable)
  • documentation is changed or added (if applicable)

Description of change

Using GoReleaser simplifies the build process substantially, as it handles almost all the logic that needed to be in the makefile and the pipelines themselves.

As my repo is a fork and I've specified ghcr.io/goss-org/goss as the image name, GoReleaser is (naturally) unable to push the final image, leading to the following expected behaviour:

ERROR: failed to push ghcr.io/goss-org/goss:latest: failed to authorize: failed to fetch anonymous token:
unexpected status from GET request to https://ghcr.io/token?scope=repository%3Agoss-org%2Fgoss%3Apull%2Cpush&service=ghcr.io: 403 Forbidden

However, the 'GITHUB_TOKEN' secret should allow this to work on the main repo. This does at least show that it's able get through the multiplatform image build without issue.

Owing to how GoReleaser works, I added something so that generating the .sha256 files for the {d,dc,k}goss scripts wouldn't cause GoReleaser to treat the repo as dirty. It also encourages building archives rather than attaching uncompressed binaries to releases.

Incidentally, this means that the goss images are now built with SBOMs. It's straightforward to extend the configuration to also build packages and generate SBOMs for the release artifacts too.

I believe this should mean the Travis CI pipelines can go away.

I'd also note that the pipeline described by docker-goss.yaml is broken owing to aquasecurity/trivy-action's 0.24.0 tag no longer exists (likely due to the issues with and attacks on Trivy over the past few months). This new pipeline can do everything as far as release builds go, so I think that could be trimmed down to just a simple build of the master image on pushes to the master branch.

Incidental changes:

@kgaughan
kgaughan requested a review from aelsabbahy as a code owner April 12, 2026 12:10
@kgaughan kgaughan mentioned this pull request Apr 12, 2026
@kgaughan

kgaughan commented May 8, 2026

Copy link
Copy Markdown
Collaborator Author

That Ubuntu integration test wasn't failing previously. I'm going to dig into it, but I'll have to wait until the weekend.

@kgaughan

kgaughan commented May 8, 2026

Copy link
Copy Markdown
Collaborator Author

The issues look to be mostly down to changes in test services and new OS releases that bumped some version numbers. There are a few dummy services (http in, for example) that look to either not be starting to not accessible.

@kgaughan

Copy link
Copy Markdown
Collaborator Author

I investigated this while on the train yesterday. The issue appear to be because dnstest.io, which the integration tests rely on, is now parked.

A sensible alternative would be to spin up something like dnsmasq internally and have it act as the resolver for the tests. dnsmasq can serve authoritative zones, and goss's dns test module supports the specification of a server to query, so specifying server: 127.0.0.1:8053 should work. GH Actions supports service containers, though if necessary it wouldn't be the end of the world to spin up dnsmasq in the background if necessary. I'll create an issue for this.

@kgaughan

Copy link
Copy Markdown
Collaborator Author

My integration tests fixes work, and I've opened a pull request for them: #1061.

kgaughan added 2 commits June 8, 2026 22:19
Using GoReleaser simplifies the build process substantially, as it
handles almost all the logic that needed to be in the makefile and the
pipelines themselves.

The one things that's missing from all this is a PAT to allow GoReleaser
to push to ghcr.io. That means it fails here (which is expected):

```
ERROR: failed to push ghcr.io/goss-org/goss:latest: failed to authorize: failed to fetch anonymous token: unexpected status from GET request to https://ghcr.io/token?scope=repository%3Agoss-org%2Fgoss%3Apull%2Cpush&service=ghcr.io: 403 Forbidden
```

Adding a PAT called 'GITHUB_TOKEN' as a secret would allow this to work
on the main repo.

Owing to how GoReleaser works, I added something so that generating the
.sha256 files for the {d,dc,k}goss scripts wouldn't cause GoReleaser to
treat the repo as dirty. It also encourages building archives rather
than attaching uncompressed binaries to releases.

Incidentally, this means that the goss images are now built with SBOMs.
It's straightforward to extend the configuration to also build packages
and generate SBOMs for the release artifacts too.

I believe this should mean the Travis CI pipelines can go away.

I'd also note that the pipeline described by docker-goss.yaml is broken
owing to aquasecurity/trivy-action's 0.24.0 tag no longer exists (likely
due to the issues with and attacks on Trivy over the past few months).
This new pipeline can do everything as far as release builds go, so I
think that could be trimmed down to just a simple build of the master
image on pushes to the master branch.
@kgaughan

Copy link
Copy Markdown
Collaborator Author

Looks like the previous merge commit only failed because of unfortunate timing.

@aelsabbahy

Copy link
Copy Markdown
Member

Can you add a small note in the readme or in a new markdown file that explains how to run/test this without forking the repo and using GitHub?

I assume it can be run with goreleaser locally for testing, right?

@kgaughan

Copy link
Copy Markdown
Collaborator Author

Sure!

Yeah, it can be run locally. All the configuration is in .goreleaser.yaml to allow a full build of all targets.

I'll update the documentation to make sure it covers this.

@kgaughan

Copy link
Copy Markdown
Collaborator Author

It's probably best to merge #1068 before this, as there'll be a tweak needed to install.sh to decompress the binaries.

@kgaughan

Copy link
Copy Markdown
Collaborator Author

@aelsabbahy I've pushed up an example of how to built it with goreleaser.

kgaughan added 2 commits June 20, 2026 20:58
Additionally, this adjust the architectures to fit the goreleaser
naming, which is closer to that of uname.
@aelsabbahy
aelsabbahy merged commit 2388dfd into goss-org:master Jul 5, 2026
9 checks passed
@kgaughan
kgaughan deleted the goreleaser branch July 5, 2026 18:12
aelsabbahy pushed a commit that referenced this pull request Jul 11, 2026
After #1052 was merged, I noticed some build failures with
docker-goss.yaml. It turned out to have a few problems, some prexisting,
and mostly caused by that PR, as I hadn't anticipated some of that
pipeline's behaviours.

It had logic for building the release image, but really shouldn't still
have. I ought to have removed that as part of the #1052. I've trimmed it
back to be just enough to handle pushing the image for Trivy to scan,
which necessitated creating a dockerfile specifically for Trivy so it
could be solved quickly.

I'm in two minds when it comes to this pipeline. I think the weekly run
of the most recent release image with `trivy-schedule.yaml` is probably
enough, but I can see the value that also comes from scanning the HEAD
of the master branch.

This should make sure that merges to master no longer fail.

Incidental changes:

 * It now only builds `linux/amd64`, though if this is an issue, I can
   partially revert it. This ought to be enough for Trivy though. In
   testing, I found `docker buildx` would hang during the image build,
   which is why I made the change.

 * Bump the version of Alpine: Trivy started flagging issues with the
   base image, so I figure there's no harm in getting both updated.
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.

s390x not working with install.sh (https://goss.rocks/install) Support for linux/ppc64le architecture

2 participants

⌂ 换网址