Skip to content

Commit 7ca810e

Browse files
authored
Update alpha build naming and add metric name for legacy linux builds (#335)
1 parent 8e74540 commit 7ca810e

File tree

5 files changed

+27
-14
lines changed

5 files changed

+27
-14
lines changed

.github/workflows/alpha-release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ jobs:
3232
id: version-and-tag
3333
run: |
3434
PKG_VERSION=$(jq -r .version package.json)
35-
DATE=$(date +%Y%m%d%H%M)
36-
TAG="v${PKG_VERSION}-${DATE}-alpha"
35+
REF="${{ inputs.ref || 'main' }}"
36+
37+
if [[ "$REF" == "main" ]]; then
38+
TAG="v${PKG_VERSION}-alpha"
39+
else
40+
SAFE_REF=$(echo "$REF" | sed 's/[^a-zA-Z0-9]/-/g')
41+
TAG="v${PKG_VERSION}-${SAFE_REF}-alpha"
42+
fi
3743
3844
git tag "$TAG"
3945
git push origin "$TAG"

.github/workflows/beta-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ jobs:
2828
run: |
2929
PKG_VERSION=$(jq -r .version package.json)
3030
31-
FULL_TAG="v${PKG_VERSION}-beta"
32-
git tag "$FULL_TAG"
33-
git push origin "$FULL_TAG"
31+
TAG="v${PKG_VERSION}-beta"
32+
git tag "$TAG"
33+
git push origin "$TAG"
3434
echo "Created tag from branch=$(git rev-parse --abbrev-ref HEAD), commit=$(git rev-parse HEAD), tag=$(git describe --tags --exact-match)"
3535
36-
echo "tag=$FULL_TAG" >> $GITHUB_OUTPUT
36+
echo "tag=$TAG" >> $GITHUB_OUTPUT
3737
3838
call-release:
3939
needs: [create-beta-tag]

.github/workflows/release.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ jobs:
4747
if [[ "$TAG" == "v$VERSION" ]]; then
4848
echo "tag=$TAG" >> $GITHUB_OUTPUT
4949
echo "is-prerelease=false" >> $GITHUB_OUTPUT
50-
elif [[ "$TAG" =~ ^v$VERSION-[0-9]{12}-alpha$ ]]; then
50+
elif [[ "$TAG" =~ ^v$VERSION-.*-alpha$ ]]; then
51+
echo "tag=$TAG" >> $GITHUB_OUTPUT
52+
echo "is-prerelease=true" >> $GITHUB_OUTPUT
53+
elif [[ "$TAG" == "v$VERSION-alpha" ]]; then
5154
echo "tag=$TAG" >> $GITHUB_OUTPUT
5255
echo "is-prerelease=true" >> $GITHUB_OUTPUT
5356
elif [[ "$TAG" =~ ^v$VERSION-beta$ ]]; then
5457
echo "tag=$TAG" >> $GITHUB_OUTPUT
5558
echo "is-prerelease=true" >> $GITHUB_OUTPUT
5659
else
57-
echo "Error: Tag ($TAG) must be v$VERSION, v$VERSION-yyyymmddhhmm-alpha, or v$VERSION-beta"
60+
echo "Error: Tag ($TAG) must be v$VERSION, v$VERSION-alpha, v$VERSION-<branch>-alpha, or v$VERSION-beta"
5861
exit 1
5962
fi
6063
@@ -145,11 +148,11 @@ jobs:
145148
146149
TAG="${{ needs.version-and-tag.outputs.tag }}"
147150
if [[ "$TAG" =~ -alpha$ ]]; then
148-
npm run bundle:alpha -- --env rebuild=true
151+
npm run bundle:alpha -- --env rebuild=true --env buildTarget=legacy
149152
elif [[ "$TAG" =~ -beta$ ]]; then
150-
npm run bundle:beta -- --env rebuild=true
153+
npm run bundle:beta -- --env rebuild=true --env buildTarget=legacy
151154
else
152-
npm run bundle:prod -- --env rebuild=true
155+
npm run bundle:prod -- --env rebuild=true --env buildTarget=legacy
153156
fi
154157
155158
if [ -z "$(find . -name "*.node" -print -quit)" ]; then

src/telemetry/OTELInstrumentation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ export function otelSdk(clientId: string, client?: ClientInfo) {
2828
exportIntervalMillis: ExportIntervalSeconds * 1000,
2929
});
3030

31+
const buildTarget = process.env.BUILD_TARGET ? `-${process.env.BUILD_TARGET}` : '';
32+
3133
const sdk = new NodeSDK({
3234
resource: resourceFromAttributes({
3335
['service']: `${ExtensionId}-${ExtensionVersion}`,
3436
['service.env']: `${process.env.NODE_ENV}-${process.env.AWS_ENV}`,
3537
['client.id']: clientId,
3638
['client.type']: `${client?.name ?? 'Unknown'}-${client?.version ?? 'Unknown'}`,
3739
['machine.type']: `${type()}-${platform()}-${arch()}-${machine()}-${release()}`,
38-
['process.type']: `${process.platform}-${process.arch}`,
40+
['process.type']: `${process.platform}${buildTarget}-${process.arch}`,
3941
['process.version']: `node=${process.versions.node} v8=${process.versions.v8} uv=${process.versions.uv} modules=${process.versions.modules}`,
4042
}),
4143
resourceDetectors: [],

webpack.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function generateExternals() {
5757

5858
const EXTERNALS = generateExternals();
5959

60-
function createPlugins(isDevelopment, outputPath, mode, env, rebuild = false) {
60+
function createPlugins(isDevelopment, outputPath, mode, env, rebuild = false, buildTarget = '') {
6161
const plugins = [];
6262

6363
plugins.push(
@@ -222,6 +222,7 @@ function createPlugins(isDevelopment, outputPath, mode, env, rebuild = false) {
222222
new webpack.DefinePlugin({
223223
'process.env.NODE_ENV': JSON.stringify(mode),
224224
'process.env.AWS_ENV': JSON.stringify(env),
225+
'process.env.BUILD_TARGET': JSON.stringify(buildTarget),
225226
}),
226227
);
227228

@@ -276,6 +277,7 @@ module.exports = (env = {}) => {
276277
const mode = env.mode;
277278
let awsEnv = env.env;
278279
const rebuild = env.rebuild === 'true' || env.rebuild === true;
280+
const buildTarget = env.buildTarget || '';
279281

280282
// Validate mode
281283
const validModes = ['development', 'production'];
@@ -329,6 +331,6 @@ module.exports = (env = {}) => {
329331
chunks: 'all',
330332
},
331333
},
332-
plugins: createPlugins(isDevelopment, outputPath, mode, awsEnv, rebuild),
334+
plugins: createPlugins(isDevelopment, outputPath, mode, awsEnv, rebuild, buildTarget),
333335
};
334336
};

0 commit comments

Comments
 (0)