Skip to content

Commit 7d63262

Browse files
Added CD pipeline scripts. (#18)
* Added CD pipeline scripts.
1 parent 36bd752 commit 7d63262

File tree

7 files changed

+135
-1
lines changed

7 files changed

+135
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 0.2
2+
# this image assumes Ubuntu 14.04 base image
3+
phases:
4+
install:
5+
commands:
6+
- sudo apt-get update -y
7+
- sudo apt-get install python3 python3-pip -y
8+
- python3 -m pip install --user --upgrade pip
9+
- python3 -m pip install --user --upgrade twine setuptools wheel boto3 PyOpenSSL six
10+
pre_build:
11+
commands:
12+
- pypirc=$(aws secretsmanager get-secret-value --secret-id "prod/aws-crt-python/.pypirc" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$pypirc" > ~/.pypirc
13+
build:
14+
commands:
15+
- echo Build started on `date`
16+
- cd aws-iot-device-sdk-python-v2
17+
- python3 setup.py sdist bdist_wheel --universal
18+
- python3 -m twine upload -r pypi dist/*
19+
post_build:
20+
commands:
21+
- echo Build completed on `date`
22+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 0.2
2+
# this image assumes Ubuntu 14.04 base image
3+
phases:
4+
install:
5+
commands:
6+
- sudo apt-get update -y
7+
- sudo apt-get install python3 python3-pip -y
8+
- python3 -m pip install --user --upgrade pip
9+
- python3 -m pip install --user --upgrade twine setuptools wheel boto3 PyOpenSSL six
10+
pre_build:
11+
commands:
12+
- pypirc=$(aws secretsmanager get-secret-value --secret-id "alpha/aws-crt-python/.pypirc" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$pypirc" > ~/.pypirc
13+
build:
14+
commands:
15+
- echo Build started on `date`
16+
- cd aws-iot-device-sdk-python-v2
17+
- python3 setup.py sdist bdist_wheel --universal
18+
- python3 -m twine upload -r testpypi dist/*
19+
post_build:
20+
commands:
21+
- echo Build completed on `date`
22+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 0.2
2+
# this image assumes Ubuntu 14.04 base image
3+
phases:
4+
install:
5+
commands:
6+
- sudo apt-get update -y
7+
- sudo apt-get install python3 python3-pip -y
8+
- python3 -m pip install --upgrade pip
9+
- python3 -m pip install --upgrade setuptools
10+
11+
pre_build:
12+
commands:
13+
- curl https://www.amazontrust.com/repository/AmazonRootCA1.pem --output /tmp/AmazonRootCA1.pem
14+
- cert=$(aws secretsmanager get-secret-value --secret-id "unit-test/certificate" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$cert" > /tmp/certificate.pem
15+
- key=$(aws secretsmanager get-secret-value --secret-id "unit-test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$key" > /tmp/privatekey.pem
16+
- ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "unit-test/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
17+
build:
18+
commands:
19+
- echo Build started on `date`
20+
- cd aws-iot-device-sdk-python-v2
21+
- CURRENT_TAG_VERSION=$(git describe --abbrev=0)
22+
- python3 -m pip install --user awsiot==$CURRENT_TAG_VERSION
23+
- python3 samples/basic_discovery.py --region us-east-1 --cert /tmp/certificate.pem --key /tmp/privatekey.pem --ca_file /tmp/AmazonRootCA1.pem --thing_name aws-sdk-crt-unit-test --print_discover_resp_only -v Trace
24+
25+
post_build:
26+
commands:
27+
- echo Build completed on `date`
28+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 0.2
2+
# this image assumes Ubuntu 14.04 base image
3+
phases:
4+
install:
5+
commands:
6+
- sudo apt-get update -y
7+
- sudo apt-get install python3 python3-pip -y
8+
- python3 -m pip install --upgrade pip
9+
- python3 -m pip install --upgrade setuptools
10+
11+
pre_build:
12+
commands:
13+
- curl https://www.amazontrust.com/repository/AmazonRootCA1.pem --output /tmp/AmazonRootCA1.pem
14+
- cert=$(aws secretsmanager get-secret-value --secret-id "unit-test/certificate" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$cert" > /tmp/certificate.pem
15+
- key=$(aws secretsmanager get-secret-value --secret-id "unit-test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$key" > /tmp/privatekey.pem
16+
- ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "unit-test/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g')
17+
build:
18+
commands:
19+
- echo Build started on `date`
20+
- cd aws-iot-device-sdk-python-v2
21+
- CURRENT_TAG_VERSION=$(git describe --abbrev=0)
22+
- python3 -m pip install -i https://testpypi.python.org/simple --user awsiot==$CURRENT_TAG_VERSION
23+
- python3 samples/basic_discovery.py --region us-east-1 --cert /tmp/certificate.pem --key /tmp/privatekey.pem --ca_file /tmp/AmazonRootCA1.pem --thing_name aws-sdk-crt-unit-test --print_discover_resp_only -v Trace
24+
25+
post_build:
26+
commands:
27+
- echo Build completed on `date`
28+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
#force a failure if there's no tag
4+
git describe --abbrev=0
5+
#now get the tag
6+
CURRENT_TAG_VERSION=$(git describe --abbrev=0)
7+
if pip install -vvv awsiot==$CURRENT_TAG_VERSION; then
8+
echo "$CURRENT_TAG_VERSION is already in pypi, cut a new tag if you want to upload another version."
9+
exit 1
10+
fi
11+
12+
echo "$CURRENT_TAG_VERSION currently does not exist in pypi, allowing pipeline to continue."
13+
exit 0
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 0.2
2+
#this build spec assumes the ubuntu 14.04 trusty image
3+
#this build run simply verifies we haven't published something at this tag yet.
4+
#if we have we fail the build and stop the pipeline, if we haven't we allow the pipeline to run.
5+
phases:
6+
install:
7+
commands:
8+
- sudo apt-get update -y
9+
- sudo apt-get install python3 python3-pip -y
10+
- pip3 install --upgrade setuptools
11+
pre_build:
12+
commands:
13+
build:
14+
commands:
15+
- echo Build started on `date`
16+
- cd aws-iot-device-sdk-python-v2
17+
- bash ./continuous-delivery/test_version_exists
18+
post_build:
19+
commands:
20+
- echo Build completed on `date`
21+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setup(
1919
name='awsiot',
20-
version='2.2',
20+
version='0.2.2',
2121
description='AWS IoT SDK based on the AWS Common Runtime',
2222
author='AWS SDK Common Runtime Team',
2323
url='https://github.com/awslabs/aws-iot-device-sdk-python-v2',

0 commit comments

Comments
 (0)