Skip to content
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

feat!: remove aws cli #47

Merged
merged 5 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: 2.1
orbs:
sam: circleci/aws-sam-serverless@dev:<<pipeline.git.revision>>
orb-tools: circleci/orb-tools@11.1
aws-cli: circleci/aws-cli@3.1.3
filters: &filters
tags:
only: /.*/
Expand All @@ -12,6 +13,7 @@ jobs:
image: ubuntu-2004:202101-01
steps:
- checkout
- aws-cli/setup
- sam/install:
version: 1.57.0
- sam/local-start-api:
Expand All @@ -25,6 +27,8 @@ workflows:
context: [CPE_ORBS_AWS]
filters: *filters
- sam/deploy:
pre-steps:
- aws-cli/setup
capabilities: CAPABILITY_IAM, CAPABILITY_NAMED_IAM
name: deploy-job-test-app
template: "./sample_test/sam-app/template.yaml"
Expand All @@ -33,6 +37,8 @@ workflows:
context: [CPE_ORBS_AWS]
filters: *filters
- sam/deploy:
pre-steps:
- aws-cli/setup
capabilities: CAPABILITY_IAM, CAPABILITY_NAMED_IAM
name: deploy-job-test-container
template: "./sample_test/sam-container/template.yaml"
Expand Down
7 changes: 1 addition & 6 deletions src/@orb.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
version: 2.1

description: >
"Build, Test, and Deploy your AWS serverless applications on CircleCI utilizing the AWS Serverless Application Model.
Learn More: https://aws.amazon.com/serverless/sam/
Repo: https://github.com/CircleCI-Public/aws-serverless-orb"

orbs:
aws-cli: circleci/aws-cli@3.1.3
Build, Test, and Deploy your AWS serverless applications on CircleCI utilizing the AWS Serverless Application Model.

display:
home_url: https://aws.amazon.com/serverless/sam/
Expand Down
2 changes: 1 addition & 1 deletion src/commands/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ parameters:
default: ""
no-fail-on-empty-changeset:
type: boolean
description: Specify if deploy command hould return a zero exit code if there are no changes to be made to the stack.
description: Specify if deploy command should return a zero exit code if there are no changes to be made to the stack.
default: true
image-repositories:
type: string
Expand Down
38 changes: 1 addition & 37 deletions src/commands/install.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
description: >
Install and configure the AWS CLI and the SAM CLI in one command. Must have IAM credentials set via environment variables.
Install the AWS SAM CLI.
parameters:
version:
description: 'SAM CLI version to be installed.'
Expand All @@ -9,36 +9,6 @@ parameters:
description: 'If set, this version of Python will be installed and set with pyenv globally. ex: "3.7.0" This is only for the local environment and will not have any effect if use-container is enabled.'
type: string
default: ""
profile-name:
description: Profile name to be configured.
type: string
default: default
aws-access-key-id:
description: |
AWS access key id for IAM role. Set this to the name of
the environment variable you will use to hold this
value, i.e. AWS_ACCESS_KEY.
type: env_var_name
default: AWS_ACCESS_KEY_ID
aws-secret-access-key:
description: |
AWS secret key for IAM role. Set this to the name of
the environment variable you will use to hold this
value, i.e. $AWS_SECRET_ACCESS_KEY.
type: env_var_name
default: AWS_SECRET_ACCESS_KEY
aws-region:
description: |
Env var of AWS region to operate in
(defaults to AWS_DEFAULT_REGION)
type: env_var_name
default: AWS_DEFAULT_REGION
configure-default-region:
description: >
Some AWS actions don't require a region; set this to false if you do not
want to store a default region in ~/.aws/config
type: boolean
default: true
steps:
- when:
condition: << parameters.python_version >>
Expand All @@ -54,12 +24,6 @@ steps:
command: |
pyenv versions
pyenv global << parameters.python_version >>
- aws-cli/setup:
profile-name: << parameters.profile-name >>
aws-access-key-id: << parameters.aws-access-key-id >>
aws-secret-access-key: << parameters.aws-secret-access-key >>
aws-region: << parameters.aws-region >>
configure-default-region: << parameters.configure-default-region >>
- run:
name: Install SAM CLI
environment:
Expand Down
7 changes: 6 additions & 1 deletion src/examples/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ description: >
usage:
version: 2.1
orbs:
sam: circleci/aws-sam-serverless@3.0
sam: circleci/aws-sam-serverless@4.0
aws-cli: circleci/aws-cli@3.1
jobs:
test_my_api:
docker:
Expand All @@ -14,6 +15,8 @@ usage:
test_and_deploy:
jobs:
- sam/deploy:
pre-steps:
- aws-cli/setup
name: deploy-staging
template: ./path/to/template.yml
stack-name: staging-stack
Expand All @@ -24,6 +27,8 @@ usage:
requires:
- deploy-staging
- sam/deploy:
pre-steps:
- aws-cli/setup
name: deploy-production
template: "./path/to/template.yml"
stack-name: "production-stack"
Expand Down
3 changes: 2 additions & 1 deletion src/examples/deploy_lambda_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ description: >
usage:
version: 2.1
orbs:
sam: circleci/aws-sam-serverless@3.0
sam: circleci/aws-sam-serverless@4.0
aws-cli: circleci/aws-cli@3.1
jobs:
test_my_api:
docker:
Expand Down
4 changes: 3 additions & 1 deletion src/examples/install-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ description: >
usage:
version: 2.1
orbs:
sam: circleci/aws-sam-serverless@3.0
sam: circleci/aws-sam-serverless@4.0
aws-cli: circleci/aws-cli@3.1
jobs:
build_app:
executor: sam/default
steps:
- checkout
- aws-cli/setup
- sam/install
- run: sam build # run SAM CLI commands directly once the CLI has been installed.
workflows:
Expand Down
4 changes: 3 additions & 1 deletion src/examples/local_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ description: >
usage:
version: 2.1
orbs:
sam: circleci/aws-sam-serverless@3.0
sam: circleci/aws-sam-serverless@4.0
aws-cli: circleci/aws-cli@3.1
jobs:
build_and_package:
executor: sam/default
steps:
- checkout
- aws-cli/install
- sam/install
- sam/local-start-api
1 change: 0 additions & 1 deletion src/jobs/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ steps:
- checkout
- install:
version: << parameters.version >>
profile-name: << parameters.profile-name >>
python_version: << parameters.python_version >>
- build:
validate: << parameters.validate >>
Expand Down
36 changes: 33 additions & 3 deletions src/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
#!/bin/bash
cd /tmp || true
if [[ $EUID == 0 ]]; then export SUDO=""; else # Check if we are root
export SUDO="sudo";
export SUDO="sudo"
fi

# Check if the AWS CLI is installed
if ! command -v aws &>/dev/null; then
echo "AWS CLI could not be found. Please install it before initiating the SAM CLI."
echo
echo "Use the circleci/aws-cli orb to install the AWS CLI."
echo "https://circleci.com/developer/orbs/orb/circleci/aws-sam-serverless#usage-examples"
echo
echo "Job example:"
echo "
jobs:
build_app:
executor: sam/default
steps:
- checkout
- aws-cli/setup
- sam/install
"
echo
echo "Workflow example:"
echo "
workflows:
test_and_deploy:
jobs:
- sam/deploy:
pre-steps:
- aws-cli/setup
"
exit 1
fi

if [[ $SAM_PARAM_VERSION == "latest" ]]; then
Expand All @@ -14,5 +44,5 @@ fi
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
$SUDO ./sam-installation/install
which sam
echo "export PATH=$PATH:/usr/local/bin/sam" >> "$BASH_ENV"
sam --version
echo "export PATH=$PATH:/usr/local/bin/sam" >>"$BASH_ENV"
sam --version