Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/otel-collector/build.ncl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let { Attrs, BuildSpec, Local, Needs, OutputBin, Source, .. } = import "minimal.ncl" in
let { standaloneTest, Attrs, BuildSpec, Local, Needs, OutputBin, Source, .. } = import "minimal.ncl" in
let base = import "../base/build.ncl" in
let go = import "../go/build.ncl" in
let toolchain = import "../toolchain/build.ncl" in
Expand Down Expand Up @@ -56,6 +56,13 @@ let obi_version = "v0.15.2" in
otel-collector = { glob = "usr/bin/otelcol-contrib" } | OutputBin,
},

# Both run every package init(); a component whose init panics (asapauth's
# SermoDigital/jose under go 1.27, see build.sh) fails them.
tests = {
version = standaloneTest "/usr/bin/otelcol-contrib --version",
components = standaloneTest "/usr/bin/otelcol-contrib components",
},

attrs =
{
upstream_version = version,
Expand Down
15 changes: 15 additions & 0 deletions packages/otel-collector/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ grep -q 'cockroachdb/swiss' manifest.yaml && { echo "swiss already replaced/pinn
sed -i '/^replaces:/a\ - github.com/cockroachdb/swiss => github.com/cockroachdb/swiss v0.0.0-20260820225851-333444432258' manifest.yaml
grep -q 'cockroachdb/swiss => ' manifest.yaml

# go 1.27 bridge #2: drop the asapauth extension, as upstream did after 0.164.0
# (opentelemetry-collector-releases#1742, for contrib#51868). It pulls in
# github.com/SermoDigital/jose, whose crypto/none.go init() calls
# crypto.RegisterHash(crypto.Hash(0), ...). Go 1.27 rejects hash value 0
# (golang/go 5a0e0838, "crypto: disallow RegisterHash with hash value 0"), so
# with asapauth compiled in, every otelcol-contrib invocation, even --version,
# panics in package init with "crypto: RegisterHash of unknown hash function".
# Upstream's fix comments the line out, so once a release ships without it the
# grep below fails: drop this patch then.
grep -q '^ - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/asapauthextension ' manifest.yaml || {
echo "asapauthextension is no longer enabled in the manifest: drop this patch"; exit 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit · This guard writes its failure message to stdout. The sibling guard on line 79 and the OBI errors on lines 24-27 write to stderr. Add >&2 to make the build failure output consistent. The swiss guard on line 62 has the same omission.

Suggested change
echo "asapauthextension is no longer enabled in the manifest: drop this patch"; exit 1;
echo "asapauthextension is no longer enabled in the manifest: drop this patch" >&2; exit 1;

}
sed -i '/^ - gomod: github.com\/open-telemetry\/opentelemetry-collector-contrib\/extension\/asapauthextension /d' manifest.yaml
if grep -q '^ *- gomod: .*asapauthextension' manifest.yaml; then echo "asapauthextension still in manifest" >&2; exit 1; fi

$OCB --config=manifest.yaml

mkdir -p $OUTPUT_DIR/usr/bin
Expand Down
Loading