Skip to content

Commit 48d34af

Browse files
New CodeBuild workflow (#293)
* Use new CodeBuild workflow
1 parent e057cbf commit 48d34af

File tree

6 files changed

+79
-5
lines changed

6 files changed

+79
-5
lines changed

codebuild/samples/connect-linux.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#!/bin/bash
22

33
set -e
4+
set -o pipefail
45

56
env
67

78
pushd $CODEBUILD_SRC_DIR/samples/node/basic_connect
89

9-
ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "unit-test/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
10+
ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
1011

1112
npm install --unsafe-perm
1213

1314
echo "Connect Basic (Direct) test"
14-
node dist/index.js --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem
15+
node dist/index.js --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem --is_ci true
1516

1617
popd
1718

@@ -20,6 +21,6 @@ pushd $CODEBUILD_SRC_DIR/samples/node/websocket_connect
2021
npm install --unsafe-perm
2122

2223
echo "Connect Websocket test"
23-
node dist/index.js --endpoint $ENDPOINT --signing_region us-east-1
24+
node dist/index.js --endpoint $ENDPOINT --signing_region us-east-1 --is_ci true
2425

2526
popd
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -o pipefail
5+
6+
env
7+
8+
pushd $CODEBUILD_SRC_DIR/samples/node/custom_authorizer_connect
9+
10+
ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
11+
AUTH_NAME=$(aws secretsmanager get-secret-value --secret-id "ci/CustomAuthorizer/name" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
12+
AUTH_PASSWORD=$(aws secretsmanager get-secret-value --secret-id "ci/CustomAuthorizer/password" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
13+
14+
npm install --unsafe-perm
15+
16+
echo "Mqtt Connect with Custom Authorizer test"
17+
node dist/index.js --endpoint $ENDPOINT --custom_auth_authorizer_name $AUTH_NAME --custom_auth_password $AUTH_PASSWORD --is_ci true
18+
19+
popd
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1+
# Assumes are running using the Ubuntu Codebuild standard image
2+
# NOTE: This script assumes that the AWS CLI-V2 is pre-installed!
3+
# - AWS CLI-V2 is a requirement to run this script.
14
version: 0.2
25
phases:
36
install:
47
commands:
58
- add-apt-repository ppa:ubuntu-toolchain-r/test
69
- apt-get update -y
10+
- echo "\nBuild version data:"
11+
- echo "\nNode Version:"; node --version
12+
- echo "\nNPM Version:"; npm --version
13+
- echo "\n"
714
build:
815
commands:
916
- echo Build started on `date`
1017
- $CODEBUILD_SRC_DIR/codebuild/samples/setup-linux.sh
1118
- $CODEBUILD_SRC_DIR/codebuild/samples/connect-linux.sh
19+
- $CODEBUILD_SRC_DIR/codebuild/samples/custom-auth-linux.sh
20+
- $CODEBUILD_SRC_DIR/codebuild/samples/pubsub-linux.sh
21+
- $CODEBUILD_SRC_DIR/codebuild/samples/shadow-linux.sh
1222
post_build:
1323
commands:
1424
- echo Build completed on `date`

codebuild/samples/pubsub-linux.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -o pipefail
5+
6+
env
7+
8+
pushd $CODEBUILD_SRC_DIR/samples/node/pub_sub
9+
10+
ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
11+
12+
npm install --unsafe-perm
13+
14+
echo "PubSub test"
15+
node dist/index.js --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem --is_ci true
16+
17+
popd
18+
19+
pushd $CODEBUILD_SRC_DIR/samples/node/pub_sub_js
20+
21+
npm install --unsafe-perm
22+
23+
echo "PubSub JS test"
24+
node index.js --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem --is_ci true
25+
26+
popd

codebuild/samples/setup-linux.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
set -e
4+
set -o pipefail
45

56
env
67

@@ -10,5 +11,5 @@ cd $CODEBUILD_SRC_DIR
1011
ulimit -c unlimited
1112
npm install --unsafe-perm
1213

13-
cert=$(aws secretsmanager get-secret-value --secret-id "unit-test/certificate" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > /tmp/certificate.pem
14-
key=$(aws secretsmanager get-secret-value --secret-id "unit-test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > /tmp/privatekey.pem
14+
cert=$(aws secretsmanager get-secret-value --secret-id "ci/CodeBuild/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > /tmp/certificate.pem
15+
key=$(aws secretsmanager get-secret-value --secret-id "ci/CodeBuild/key" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > /tmp/privatekey.pem

codebuild/samples/shadow-linux.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -o pipefail
5+
6+
env
7+
8+
pushd $CODEBUILD_SRC_DIR/samples/node/shadow
9+
10+
ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
11+
12+
npm install --unsafe-perm
13+
14+
echo "Shadow test"
15+
node dist/index.js --endpoint $ENDPOINT --key /tmp/privatekey.pem --cert /tmp/certificate.pem --thing_name CI_CodeBuild_Thing --is_ci true
16+
17+
popd

0 commit comments

Comments
 (0)