Skip to content

Commit 82f3443

Browse files
committed
feat: [DEVOPS-2394] auto-clone cx-contrib fork + pin SHA
- publish-sandbox.sh: auto-clone coralogix/opentelemetry-js-contrib to .build-cache/ on first run; checkout pinned SHA. Removes the manual sibling-clone setup step. OPENTELEMETRY_JS_CONTRIB_PATH override still honored for local dev against a different checkout. - Pin cx-contrib in the publish workflow to the same SHA for reproducibility. - .gitignore: .build-cache/, build-sandbox/ Verified: fresh clone + unset OPENTELEMETRY_JS_CONTRIB_PATH → script clones, builds, publishes sandbox-arm64 v2 successfully.
1 parent c319363 commit 82f3443

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

.github/workflows/publish-extend-otel-layer.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ jobs:
4545
OPENTELEMETRY_JS_CONTRIB_PATH: ${{ github.workspace }}/opentelemetry-js-contrib
4646
steps:
4747
- uses: actions/checkout@v4
48+
# Pinned SHA — bump when upstream cx-contrib lands a fix/feature we want.
49+
# Keep in sync with CX_CONTRIB_SHA in ci-scripts/publish-sandbox.sh.
4850
- uses: actions/checkout@v4
49-
with: { repository: coralogix/opentelemetry-js-contrib, ref: coralogix-autoinstrumentation, path: opentelemetry-js-contrib }
51+
with: { repository: coralogix/opentelemetry-js-contrib, ref: 3a9691a699ddd06c3644eec70bf4b50cc4217ba3, path: opentelemetry-js-contrib }
5052
- uses: actions/setup-node@v4
5153
with:
5254
node-version: 22

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ collector/VERSION
2626
opentelemetry-js/
2727
opentelemetry-js-contrib-cx/
2828
import-in-the-middle/
29+
.build-cache/
30+
build-sandbox/
2931

3032
.envrc
3133
mise.toml

ci-scripts/publish-sandbox.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,40 @@
22
# Publishes extend-nodejs-wrapper-and-exporter-{arch} to engservicessandbox us-east-1 as a PRIVATE layer.
33
# Prereqs:
44
# - AWS_PROFILE set to engservicessandbox (or SSO-logged-in) w/ lambda:PublishLayerVersion
5-
# - coralogix/opentelemetry-js-contrib cloned as sibling at ../opentelemetry-js-contrib (coralogix-autoinstrumentation branch)
65
# - Run from repo root
6+
#
7+
# The coralogix/opentelemetry-js-contrib fork is auto-cloned to .build-cache/ on first run.
8+
# To override the clone path (e.g. for local dev against a different checkout), set
9+
# OPENTELEMETRY_JS_CONTRIB_PATH before invoking this script.
710

811
set -euo pipefail
912

1013
ARCH="${1:-arm64}"
1114
REGION="us-east-1"
1215
LAYER_NAME="extend-nodejs-wrapper-and-exporter-sandbox-${ARCH}"
1316

17+
# Pinned to a specific commit on coralogix-autoinstrumentation for reproducible builds.
18+
# Bump when upstream cx-contrib lands a fix/feature we want.
19+
CX_CONTRIB_REPO="https://github.com/coralogix/opentelemetry-js-contrib.git"
20+
CX_CONTRIB_SHA="3a9691a699ddd06c3644eec70bf4b50cc4217ba3"
21+
CX_CONTRIB_CACHE="${OPENTELEMETRY_JS_CONTRIB_PATH:-.build-cache/opentelemetry-js-contrib}"
22+
1423
case "$ARCH" in
1524
amd64) AWS_ARCH="x86_64" ;;
1625
arm64) AWS_ARCH="arm64" ;;
1726
*) echo "unsupported arch: $ARCH"; exit 1 ;;
1827
esac
1928

29+
echo "==> resolving cx-contrib fork at $CX_CONTRIB_SHA"
30+
if [ ! -d "$CX_CONTRIB_CACHE/.git" ]; then
31+
mkdir -p "$(dirname "$CX_CONTRIB_CACHE")"
32+
git clone --filter=blob:none "$CX_CONTRIB_REPO" "$CX_CONTRIB_CACHE"
33+
fi
34+
git -C "$CX_CONTRIB_CACHE" fetch --quiet origin "$CX_CONTRIB_SHA" 2>/dev/null || git -C "$CX_CONTRIB_CACHE" fetch --quiet origin
35+
git -C "$CX_CONTRIB_CACHE" checkout --quiet "$CX_CONTRIB_SHA"
36+
export OPENTELEMETRY_JS_CONTRIB_PATH
37+
OPENTELEMETRY_JS_CONTRIB_PATH="$(cd "$CX_CONTRIB_CACHE" && pwd)"
38+
2039
echo "==> building collector ($ARCH)"
2140
make -C collector package-extend GOARCH="$ARCH"
2241

0 commit comments

Comments
 (0)