- Notifications
You must be signed in to change notification settings - Fork 220
New CD workflow #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New CD workflow #371
Changes from 18 commits
Commits
Show all changes
21 commits Select commit Hold shift + click to select a range
759309f Initial commit for new CD workflow
TwistedTwigleg 41406a4 Bump the version to a non-existent version to test full pipeline minu…
TwistedTwigleg bfe7b6a Use the correct version again
TwistedTwigleg dcc6641 Merge branch 'main' of https://github.com/aws/aws-iot-device-sdk-pyth…
TwistedTwigleg 0b15f9a Merge branch 'main' of https://github.com/aws/aws-iot-device-sdk-pyth…
TwistedTwigleg cc92bc3 Bump to non-existent version to test pipeline
TwistedTwigleg 490b5b7 Remove old CD files, move new CD files to correct location. Test PubS…
TwistedTwigleg 7ec811a Use proper version, allow CD to release
TwistedTwigleg a176019 While testing stuff, make sure the new CD pipeline is fully disabled …
TwistedTwigleg b9bcde2 Make release using manual workflow instead of catching release event
TwistedTwigleg f90c59b Enable CD workflow again
TwistedTwigleg a5e20a9 Use the S3 version file, not the repository one, in CD
TwistedTwigleg cf35abd Merge branch 'main' into NewCDWorkflow
TwistedTwigleg 3457792 Set the pre-release tag based on whether the major version is zero or…
TwistedTwigleg 5c7fe3d Comment cleanup
TwistedTwigleg 460c576 Add AWS release role so file can be uploaded to S3 correctly
TwistedTwigleg 8a7442e CR changes: Moved script to utils, sanitize input, make sure argument…
TwistedTwigleg 1568397 Use a Python script to update the version and check type input is cor…
TwistedTwigleg 401ca13 Add comment about escaping special characters
TwistedTwigleg e30b2a2 Merge branch 'main' of https://github.com/aws/aws-iot-device-sdk-pyth…
TwistedTwigleg 36ae159 Add the version to the README. Always make a PR with a release
TwistedTwigleg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Release | ||
| | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| release_type: | ||
| type: choice | ||
| description: "Release type:" | ||
| required: true | ||
| options: | ||
| - bug fix (PATCH) | ||
| - new feature (MINOR) | ||
| release_title: | ||
| description: "The title of the release" | ||
| required: true | ||
| | ||
| jobs: | ||
| update-version: | ||
| runs-on: ubuntu-20.04 # latest | ||
| permissions: | ||
| contents: write # allow push | ||
| | ||
| steps: | ||
| - name: Checkout Sources | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
| | ||
| - name: Make new release | ||
| env: | ||
| Title: ${{ github.event.inputs.release_title }} | ||
| run: | | ||
| Title=$(echo ${Title//[\"]\\\"}) | ||
| Title=$(echo ${Title//[\']\\\'}) | ||
| Title=$(echo ${Title//[\$]}) | ||
| | ||
| ./utils/publish-release.sh "${{ github.event.inputs.release_type }}" "$Title" | ||
| | ||
| - name: configure AWS credentials (Release) | ||
| uses: aws-actions/configure-aws-credentials@v1 | ||
| with: | ||
| role-to-assume: ${{ secrets.AWS_CI_RELEASE_ROLE }} | ||
| aws-region: us-east-1 | ||
| | ||
| - name: "Create VERSION file and trigger release" | ||
| run: | | ||
| version=$(git describe --tags --abbrev=0) | ||
| version_without_v=$(echo ${version} | cut -f2 -dv) | ||
| echo "${version_without_v}" > VERSION | ||
| | ||
| zip VERSION.zip VERSION | ||
| export S3_URL=$(aws secretsmanager get-secret-value --secret-id ci/python_v2_version --query "SecretString" | cut -f2 -d\") | ||
| aws s3 cp VERSION.zip $S3_URL | ||
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Assumes are running using the Ubuntu Codebuild standard image | ||
| # Makes sure the release to test PyPi repository worked | ||
| # | ||
| # NOTE: This script assumes that the AWS CLI-V2 is pre-installed! | ||
| # - AWS CLI-V2 is a requirement to run this script. | ||
| version: 0.2 | ||
| phases: | ||
| install: | ||
| commands: | ||
| - sudo apt-get update -y | ||
| - sudo apt-get install python3 python3-pip -y | ||
| - python3 -m pip install --upgrade pip | ||
| - python3 -m pip install --upgrade setuptools | ||
| - echo "\nBuild version data:" | ||
| - echo "\nPython Version:"; python3 --version | ||
| | ||
| pre_build: | ||
| commands: | ||
| # Material for PubSub sample | ||
| - curl https://www.amazontrust.com/repository/AmazonRootCA1.pem --output /tmp/AmazonRootCA1.pem | ||
| - cert=$(aws secretsmanager get-secret-value --secret-id "ci/PubSub/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$cert" > /tmp/certificate.pem | ||
| - key=$(aws secretsmanager get-secret-value --secret-id "ci/PubSub/key" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$key" > /tmp/privatekey.pem | ||
| - ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') | ||
| build: | ||
| commands: | ||
| - echo Build started on `date` | ||
| - cd $CODEBUILD_SRC_DIR/aws-iot-device-sdk-python-v2 | ||
| - CURRENT_TAG_VERSION=$(cat $CODEBUILD_SRC_DIR/VERSION) | ||
| - python3 codebuild/cd/pip-install-with-retry.py --no-cache-dir --user awsiotsdk==$CURRENT_TAG_VERSION | ||
| # Run PubSub sample | ||
| - python3 samples/pubsub.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem --ca_file /tmp/AmazonRootCA1.pem --verbosity Trace | ||
| | ||
| post_build: | ||
| commands: | ||
| - echo Build completed on `date` | ||
| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Assumes are running using the Ubuntu Codebuild standard image | ||
| # Makes sure the release to test PyPi repository worked | ||
| # | ||
| # NOTE: This script assumes that the AWS CLI-V2 is pre-installed! | ||
| # - AWS CLI-V2 is a requirement to run this script. | ||
| version: 0.2 | ||
| phases: | ||
| install: | ||
| commands: | ||
| - sudo apt-get update -y | ||
| - sudo apt-get install python3 python3-pip -y | ||
| - python3 -m pip install --upgrade pip | ||
| - python3 -m pip install --upgrade setuptools | ||
| - echo "\nBuild version data:" | ||
| - echo "\nPython Version:"; python3 --version | ||
| | ||
| pre_build: | ||
| commands: | ||
| - curl https://www.amazontrust.com/repository/AmazonRootCA1.pem --output /tmp/AmazonRootCA1.pem | ||
| - cert=$(aws secretsmanager get-secret-value --secret-id "ci/PubSub/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$cert" > /tmp/certificate.pem | ||
| - key=$(aws secretsmanager get-secret-value --secret-id "ci/PubSub/key" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo "$key" > /tmp/privatekey.pem | ||
| - ENDPOINT=$(aws secretsmanager get-secret-value --secret-id "ci/endpoint" --query "SecretString" | cut -f2 -d":" | sed -e 's/[\\\"\}]//g') | ||
| build: | ||
| commands: | ||
| - echo Build started on `date` | ||
| - cd $CODEBUILD_SRC_DIR/aws-iot-device-sdk-python-v2 | ||
| - CURRENT_TAG_VERSION=$(cat $CODEBUILD_SRC_DIR/VERSION) | ||
| # this is here because typing isn't in test-pypi, so pull it from prod instead | ||
| - python3 -m pip install typing | ||
| - python3 codebuild/cd/pip-install-with-retry.py -i https://testpypi.python.org/simple --user awsiotsdk==$CURRENT_TAG_VERSION | ||
| # Run PubSub sample | ||
| - python3 samples/pubsub.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem --ca_file /tmp/AmazonRootCA1.pem --verbosity Trace | ||
| | ||
| post_build: | ||
| commands: | ||
| - echo Build completed on `date` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env bash | ||
| | ||
| VERSION_FILE_PATH=$1 | ||
| if [ ! readlink -e "$VERSION_FILE_PATH" ]; then | ||
| echo "No VERSION file found! Cannot make release!" | ||
| exit 1 | ||
| else | ||
| echo "VERSION file found..." | ||
| fi | ||
| VERSION=$(cat $VERSION_FILE_PATH) | ||
| | ||
| # Make sure the version variable is populated | ||
| if [ -z "${VERSION}" ]; then | ||
| echo "VERSION file is empty!" | ||
| exit 1 | ||
| else | ||
| echo "VERSION file contains: ${VERSION}" | ||
| fi | ||
| | ||
| # Make sure the version follows the correct format: major.minor.patch | ||
| LENGTH_CHECK="${VERSION//[^.]}" | ||
| if [ ${#LENGTH_CHECK} != 2 ]; then | ||
| echo "VERSION file contains invalid version (not in format major.minor.patch)" | ||
| exit 1 | ||
| fi | ||
| # Use RegX to ensure it only contains numbers and periods | ||
| REGX_CHECK='^([0-9]+\.){0,2}(\*|[0-9]+)$' | ||
| if [[ $VERSION =~ $REGX_CHECK ]]; then | ||
| echo "VERSION file contains valid version" | ||
| else | ||
| echo "VERSION file contains invalid version (RegX validator failed)" | ||
| exit 1 | ||
| fi | ||
| | ||
| # Does PyPi have the version? If so, do not allow it! | ||
| if python3 -m pip install --no-cache-dir -vvv awsiotsdk==$VERSION; then | ||
| echo "$VERSION is already in pypi, cut a new tag if you want to upload another version." | ||
| exit 1 | ||
| fi | ||
| | ||
| echo "$VERSION currently does not exist in pypi, allowing pipeline to continue." | ||
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Assumes are running using the Ubuntu Codebuild standard image | ||
| # Makes sure the version in CD has not already been released. | ||
| # Will fail the build and stop the pipeline if the version has already been released. | ||
| # | ||
| # NOTE: This script assumes that the AWS CLI-V2 is pre-installed! | ||
| # - AWS CLI-V2 is a requirement to run this script. | ||
| version: 0.2 | ||
| phases: | ||
| install: | ||
| commands: | ||
| - sudo apt-get update -y | ||
| - sudo apt-get install python3 python3-pip -y | ||
| - pip3 install --upgrade setuptools | ||
| - echo "\nBuild version data:" | ||
| - echo "\nPython Version:"; python3 --version | ||
| build: | ||
| commands: | ||
| - cd $CODEBUILD_SRC_DIR/aws-iot-device-sdk-python-v2 | ||
| - bash ./codebuild/cd/test-version-exists.sh $CODEBUILD_SRC_DIR/VERSION |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.