You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The build command's --single-target flag appears to be executing multiple steps of the build process for targets other than the single specified target.
$ goreleaser build --clean --snapshot --single-target --config .goreleaser.yaml
• starting build...
• loading path=.goreleaser.yaml
• building only for darwin/amd64 reason=single target is enabled
• skipping validate...
• loading environment variables
• getting and validating git state
• git state commit=2fc2588030d0e71e491cf9527164a49e86209f01 branch=chore/build-syft-for-cli-tests current_tag=v0.93.0 previous_tag=v0.92.0 dirty=false
• pipe skipped reason=disabled during snapshot mode
• parsing tag
• setting defaults
• DEPRECATED: brews.tap should not be used anymore, check https://goreleaser.com/deprecations#brewstap for more info
• snapshotting
• building snapshot... version=0.93.0-SNAPSHOT-2fc25880
• checking distribution directory
• cleaning dist
• loading go mod information
• build prerequisites
• writing effective config file
• writing config=dist/config.yaml
• building binaries
• building binary=dist/windows-build_darwin_amd64_v1/syft
• building binary=dist/linux-build_darwin_amd64_v1/syft
• building binary=dist/darwin-build_darwin_amd64_v1/syft
• running hook hook=.tmp/quill sign-and-notarize "/syft/dist/darwin-build_darwin_amd64_v1/syft" --dry-run=true --ad-hoc=true -vv
• took: 3s
• storing release metadata
• writing file=dist/artifacts.json
• writing file=dist/metadata.json
• you are using deprecated options, check the output above for details
• build succeeded after 3s
• thanks for using goreleaser!
You can see that the flag identified the correct platform/architecture to use ("building only for darwin/amd64 reason=single target is enabled") but then the building binaries section indicates it's building 3 binaries, 2 of which are for incorrect platforms. It also executed the hook which is specified only for darwin builds (which was correct, in this case).
BUT after this runs, it turns out it only actually built the darwin binary, but it put it in all 3 of those locations, and for some reason it was built twice (note the md5 hashes):
So these are all darwin/amd64 binaries, but they are in directories for linux and windows, albeit with darwin as a part of the matrix. I would expect only the dist/darwin-build_darwin_amd64_v1/syft to be created. Another oddity is that of the 3 binaries, 2 are identical and the expected one is not.
The same problem occurs on Linux, as can be seen in this workflow output. You'll also see that the output indicates it's attempting to build a similar set of 3 artifacts and attempts to run the darwin hook (presumably because the darwin target seems to be running), even though it indicates "building only for linux/amd64 reason=single target is enabled". I'm assuming the darwin hook then fails because instead of having a macho binary, it's a linux ELF binary that's a duplicate of the linux build.
Am I misunderstanding what the --single-target flag is supposed to do? I think the expected behavior here is that only the build configuration that matches the GOOS and GOARCH specified should run.
What happened?
The
build
command's--single-target
flag appears to be executing multiple steps of the build process for targets other than the single specified target.Using this goreleaser config, run:
You can see that the flag identified the correct platform/architecture to use ("building only for darwin/amd64 reason=single target is enabled") but then the
building binaries
section indicates it's building 3 binaries, 2 of which are for incorrect platforms. It also executed the hook which is specified only for darwin builds (which was correct, in this case).BUT after this runs, it turns out it only actually built the darwin binary, but it put it in all 3 of those locations, and for some reason it was built twice (note the md5 hashes):
So these are all darwin/amd64 binaries, but they are in directories for linux and windows, albeit with
darwin
as a part of the matrix. I would expect only thedist/darwin-build_darwin_amd64_v1/syft
to be created. Another oddity is that of the 3 binaries, 2 are identical and the expected one is not.The same problem occurs on Linux, as can be seen in this workflow output. You'll also see that the output indicates it's attempting to build a similar set of 3 artifacts and attempts to run the darwin hook (presumably because the darwin target seems to be running), even though it indicates "building only for linux/amd64 reason=single target is enabled". I'm assuming the darwin hook then fails because instead of having a macho binary, it's a linux ELF binary that's a duplicate of the linux build.
Am I misunderstanding what the
--single-target
flag is supposed to do? I think the expected behavior here is that only the build configuration that matches the GOOS and GOARCH specified should run.How can we reproduce this?
goreleaser version
GitVersion: 1.21.2 GitCommit: 26fed97a0defe4e73e3094cb903225d5445e5f0d GitTreeState: false BuildDate: 2023-09-26T11:20:15Z BuiltBy: goreleaser GoVersion: go1.21.1 Compiler: gc ModuleSum: h1:dgYtIS7aZlQuRMUMLCjDCOs4lWss85Oh60RDSO0rbWU= Platform: darwin/amd64
GoReleaser Check
Search
Supporter
Code of Conduct
Additional context
No response
The text was updated successfully, but these errors were encountered: