forked from open-telemetry/opentelemetry-lambda
-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (127 loc) · 6.07 KB
/
publish-nodejs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Publish Node.js
on:
workflow_dispatch:
inputs:
environment:
description: 'Actually publish or just test?'
type: environment
required: true
default: test
jobs:
package:
runs-on: ubuntu-22.04
if: ${{ github.ref == 'refs/heads/coralogix-nodejs-autoinstrumentation' || inputs.environment == 'test' }}
environment: ${{ inputs.environment }}
env:
OPENTELEMETRY_JS_CONTRIB_PATH: ${{ github.workspace }}/opentelemetry-js-contrib
OPENTELEMETRY_JS_PATH: ${{ github.workspace }}/opentelemetry-js
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
path: ${{ env.OPENTELEMETRY_JS_CONTRIB_PATH }}
repository: coralogix/opentelemetry-js-contrib
ref: refs/heads/test-sqs-link
ssh-key: ${{ secrets.OPENTELEMETRY_CI_GITHUB_KEY }}
- uses: actions/checkout@v3
with:
path: ${{ env.OPENTELEMETRY_JS_PATH }}
repository: coralogix/opentelemetry-js
ref: refs/heads/coralogix-autoinstrumentation
ssh-key: ${{ secrets.OPENTELEMETRY_CI_GITHUB_KEY }}
- name: Generate version files in opentelemetry-js-contrib
working-directory: ${{ env.OPENTELEMETRY_JS_CONTRIB_PATH }}
run: lerna run version:update
- name: Build opentelemetry-instrumentation-aws-lambda
working-directory: ${{ env.OPENTELEMETRY_JS_CONTRIB_PATH }}/plugins/node/opentelemetry-instrumentation-aws-lambda
run: npm install --ignore-scripts && npm pack --ignore-scripts
- name: Build opentelemetry-instrumentation-mongodb
working-directory: ${{ env.OPENTELEMETRY_JS_CONTRIB_PATH }}/plugins/node/opentelemetry-instrumentation-mongodb
run: npm install --ignore-scripts && npm pack --ignore-scripts
- name: Build opentelemetry-instrumentation-aws-sdk
working-directory: ${{ env.OPENTELEMETRY_JS_CONTRIB_PATH }}/plugins/node/opentelemetry-instrumentation-aws-sdk
run: npm install --ignore-scripts && npm pack --ignore-scripts
- name: Prepare opentelemetry-instrumentation
working-directory: ${{ env.OPENTELEMETRY_JS_PATH }}
run: npm install
- name: Build opentelemetry-instrumentation
working-directory: ${{ env.OPENTELEMETRY_JS_PATH }}/experimental/packages/opentelemetry-instrumentation
run: npm install && npm run compile && npm pack
- name: Build opentelemetry-sdk-trace-base
working-directory: ${{ env.OPENTELEMETRY_JS_PATH }}/packages/opentelemetry-sdk-trace-base
run: npm install && npm run compile && npm pack
- name: Install forked opentelemetry-js-contrib libraries
working-directory: ./nodejs/packages/layer
run: >
npm install
${OPENTELEMETRY_JS_CONTRIB_PATH}/plugins/node/opentelemetry-instrumentation-aws-lambda/coralogix-instrumentation-aws-lambda-*.tgz
${OPENTELEMETRY_JS_CONTRIB_PATH}/plugins/node/opentelemetry-instrumentation-mongodb/opentelemetry-instrumentation-mongodb-*.tgz
${OPENTELEMETRY_JS_CONTRIB_PATH}/plugins/node/opentelemetry-instrumentation-aws-sdk/coralogix-instrumentation-aws-sdk-*.tgz
${OPENTELEMETRY_JS_PATH}/experimental/packages/opentelemetry-instrumentation/opentelemetry-instrumentation-*.tgz
${OPENTELEMETRY_JS_PATH}/packages/opentelemetry-sdk-trace-base/opentelemetry-sdk-trace-base-*.tgz
- name: Install copyfiles and bestzip # used by `npm run compile`
run: npm install -g copyfiles bestzip
- name: Build layer
working-directory: ./nodejs/packages/layer
run: npm run compile
- name: Check layer size
env:
FILE_PATH: ./nodejs/packages/layer/build/layer.zip
MAX_SIZE: 8388608 # 8MB
run: ./ci-scripts/check_size.sh
- uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ vars.SIGNER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SIGNER_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.SIGNER_AWS_DEFAULT_REGION }}
- name: Upload package to S3
run: aws s3 cp ./nodejs/packages/layer/build/layer.zip s3://${{ vars.SIGNER_BUCKET }}/to-be-signed/nodejs-layer.zip
- name: Get S3 version of the uploaded file
run: |
LATEST_VERSION=$(aws s3api list-object-versions --bucket ${{ vars.SIGNER_BUCKET }} --prefix to-be-signed/nodejs-layer.zip --query 'Versions[?IsLatest].[VersionId]' --output text)
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
- name: Sign the package
uses: clowdhaus/[email protected]
with:
aws-region: ${{ vars.SIGNER_AWS_DEFAULT_REGION }}
source-s3-bucket: ${{ vars.SIGNER_BUCKET }}
source-s3-key: to-be-signed/nodejs-layer.zip
source-s3-version: ${{ env.LATEST_VERSION }}
destination-s3-bucket: ${{ vars.SIGNER_BUCKET }}
destination-s3-prefix: signed/
profile-name: ${{ vars.SIGNER_PROFILE_NAME }}
max-wait-time: 60
rename-signed-object: true
- name: Download the signed package from S3
run: aws s3 cp s3://${{ vars.SIGNER_BUCKET }}/signed/nodejs-layer.zip ./layer.zip
- name: Upload package
uses: actions/upload-artifact@v3
with:
name: layer.zip
path: ./layer.zip
if-no-files-found: error
retention-days: 1
publish-layer:
runs-on: ubuntu-22.04
if: ${{ github.ref == 'refs/heads/coralogix-nodejs-autoinstrumentation' || inputs.environment == 'test' }}
needs: [package]
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v3
- uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ vars.LAYER_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.LAYER_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.LAYER_AWS_DEFAULT_REGION }}
- name: create target dir
run: mkdir -p target
- name: Download layer.zip
uses: actions/download-artifact@v3
with:
name: layer.zip
path: target
- name: Publish layer
env:
LAYER_NAME: "coralogix-opentelemetry-nodejs-wrapper"
COMPATIBLE_RUNTIMES: "nodejs14.x nodejs16.x nodejs18.x"
run: ./ci-scripts/publish_${{ inputs.environment }}.sh