Skip to content

Commit

Permalink
feat!: v3.0.0 (#98)
Browse files Browse the repository at this point in the history
* rerun

* rerun

* fix linting errors

* fix linting errors

* fix: edited command

* fix: edited profile name

* feat: added usage example

* feat: added usage example for role-arn-setup

* feat: added usage example for role-arn-setup

* fix: updated example and fixed configure.sh script

* feat: Added deprecation warning

* testing config file

* fix: added validation

* ci: added testing for role-arn-setup

* feat: added alpine support

* fix: added SC2002 exclusion

* fix: added SC2002 exclusion

* fix: added matrix executors to tests

* fix: edited name

* test: added longer no_output_timeout

* test: adding source  to page test

* test: edited install script for alpine

* fix: fixed install script for alpine

* test: removed source

* fix: added validation to test-paging for alpine

* test: adding windows executor

* test: edited requires

* test: testing shell parameter

* fix: changed windows image name

* fix: added resource class

* fix: fixed formatting

* fix: fixed formatting

* fix: fixed formatting

* test: switched to windows 2022

* test: switched to windows 2022

* test: switched to windows 2022

* test: switched to windows 2022

* test: changed shell to bash

* test: removed Bypass

* fix: changed image to windows-server-2019-vs2019

* fix: added uninstall for version 1

* test: testing cli install for version 1

* test: removed sudo for windows

* test: replaced cat with type

* test: testing override

* test: testing override param

* test: testing override param

* test: added override param to test install job

* test: added specified version test

* test: checking images for preinstalled aws

* fix: replaced  with AWS_CLI_VER_STRING

* fix: removed command -v

* test: removed executors with AWS pre-installed

* test: removed executors with AWS pre-installed

* test: removed executors with AWS pre-installed

* test: testing override

* refactor: install without aws pre-installed

* ci: testing refactor with specific version

* ci: testing refactor for override

* test: removing version in override

* test: debug windows install

* test: debug windows install

* test: testing windows executor

* feat: added chocolatey install and uninstall for windows

* fix: edited AWS_CLI_VERSION_STRING

* fix: added PATH

* fix: used setx to set aws path

* fix: added
path to config

* fix: added
path to config

* test: checking path for aws V1

* test: checking path for aws V1

* test: testing export

* test: testing export

* fix: removed if statement

* fix: removed if statement

* fix: removed if statement

* fix: edited AWS_CLI_VER_STRING

* test: testing windows

* fix: export to path for windows

* test: testing export

* testing

* testing

* testing

* testing

* testing

* testing

* testing

* testing

* testing

* fix: grep correct version

* fix: grep correct version

* fix: added echo

* ci: final testing

* ci: final testing

* ci: final testing

* ci: final testing

* ci: final testing

* ci: final testing

* ci: final testing

* ci: final testing

* ci: final testing

* ci: final testing

* fix: added use case for latest installation

* fix: added validation for windows and alpine

* feat: added install directories

* test:empty commit

* fix: added params to job

* fix: added params to job

* fix: added params to job

* fix: lint issues

* fix: changed orb version

* fix: added params to setup command

* fix: packed and publish orb

* fix: updated README

* ci: Orb tools 11 migration (#100)

* fix: removed AWS_CLI_VER_STRING

* fix: editing merge conflicts

* fix: corrected linting errors
  • Loading branch information
brivu authored Apr 5, 2022
1 parent be7effe commit a23cf78
Show file tree
Hide file tree
Showing 12 changed files with 366 additions and 272 deletions.
212 changes: 26 additions & 186 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,196 +1,36 @@
version: 2.1

setup: true
orbs:
orb-tools: circleci/orb-tools@10.0
shellcheck: circleci/shellcheck@2.0
aws-cli: circleci/aws-cli@<<pipeline.parameters.dev-orb-version>>

# Pipeline Parameters
## These parameters are used internally by orb-tools. Skip to the Jobs section.
parameters:
run-integration-tests:
description: An internal flag to prevent integration test from running before a development version has been created.
type: boolean
default: false
dev-orb-version:
description: >
The development version of the orb to test.
This value is automatically adjusted by the "trigger-integration-tests-workflow" job to correspond with the specific version created by the commit and should not be edited.
A "dev:alpha" version must exist for the initial pipeline run.
type: string
default: "dev:alpha"

executors:
docker-base:
docker:
- image: cimg/base:stable
macos:
macos:
xcode: 12.4.0
arm:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium
linuxvm:
machine:
image: ubuntu-2004:202101-01
commands:
check_aws_version:
parameters:
version:
type: string
default: ""
steps:
- run:
name: check_aws_version
command: |
if [ -n "<<parameters.version>>" ]; then
INSTALLED_AWS_VERSION="$(aws --version)"
aws --version | grep <<parameters.version>>
else
if ! command -v aws &> /dev/null; then exit 1; else exit 0; fi
fi
test-paging:
steps:
- run:
name: Test that paging is disabled
command: |
# Test with aws command that would require paging if a pager is enabled
aws ec2 describe-images \
--owners amazon \
--filters "Name=platform,Values=windows" "Name=root-device-type,Values=ebs"
orb-tools: circleci/orb-tools@11.1
shellcheck: circleci/shellcheck@3.1

jobs:
integration-test-install:
parameters:
executor:
type: executor
version:
description: Select a specific version of the AWS v2 CLI. By default the latest version will be used.
default: latest
type: string
override-installed:
type: boolean
default: false
executor: <<parameters.executor>>
steps:
- aws-cli/setup:
version: <<parameters.version>>
- test-paging

integration-test-role-arn-setup:
executor: docker-base
parameters:
profile-name:
description: Name of new profile associated with role arn.
type: string
role-arn:
description: Role ARN that the profile should take.
type: string
source-profile:
description: Source profile containing credentials to assume the role with role-arn.
type: string
default: "default"
steps:
- aws-cli/setup
- aws-cli/role-arn-setup:
profile-name: <<parameters.profile-name>>
role-arn: <<parameters.role-arn>>
- run:
name: Check profiles were created
command: |
which aws
ROLE_ARN=$(aws configure get role_arn --profile <<parameters.profile-name>>)
SOURCE_PROFILE=$(aws configure get source_profile --profile <<parameters.profile-name>>)
if [ "${ROLE_ARN}" == "<<parameters.role-arn>>" ] && [ "${SOURCE_PROFILE}" == "<<parameters.source-profile>>" ]; then
echo configuration is correctly set.
else
echo Wrong configuration set.
exit 1
fi
filters: &filters
tags:
only: /.*/

workflows:
# Prior to producing a development orb (which requires credentials) basic validation, linting, and even unit testing can be performed.
# This workflow will run on every commit
test-pack:
unless: << pipeline.parameters.run-integration-tests >>
lint-pack:
jobs:
- orb-tools/lint # Lint Yaml files
- orb-tools/pack # Pack orb source
- orb-tools/lint:
filters: *filters
- orb-tools/pack:
filters: *filters
- orb-tools/review:
filters: *filters
- shellcheck/check:
dir: ./src/scripts
exclude: SC2148
# Publish development version(s) of the orb.
- orb-tools/publish-dev:
exclude: SC2148,SC2038,SC2086,SC2002,SC2016,SC1090
filters: *filters
- orb-tools/publish:
orb-name: circleci/aws-cli
context: orb-publisher # A restricted context containing your private publishing credentials. Will only execute if approved by an authorized user.
vcs-type: << pipeline.project.type >>
requires:
- orb-tools/lint
- orb-tools/pack
- shellcheck/check
# Trigger an integration workflow to test the
# dev:${CIRCLE_SHA1:0:7} version of your orb
- orb-tools/trigger-integration-tests-workflow:
name: trigger-integration-dev
[orb-tools/lint, orb-tools/review, orb-tools/pack, shellcheck/check]
# Use a context to hold your publishing token.
context: orb-publisher
requires:
- orb-tools/publish-dev

# This `integration-test_deploy` workflow will only run
# when the run-integration-tests pipeline parameter is set to true.
# It is meant to be triggered by the "trigger-integration-tests-workflow"
# job, and run tests on <your orb>@dev:${CIRCLE_SHA1:0:7}.
integration-test_deploy:
when: << pipeline.parameters.run-integration-tests >>
jobs:
# Run any integration tests defined within the `jobs` key.
- integration-test-install:
matrix:
parameters:
executor: ["linuxvm", "docker-base", "macos", "arm"]
post-steps:
- check_aws_version
- integration-test-install:
name: integration-test-install-version
executor: docker-base
version: "2.1.10"
post-steps:
- check_aws_version:
version: "2.1.10"
- integration-test-install:
name: integration-test-install-override-version
executor: docker-base
version: "2.1.10"
post-steps:
- check_aws_version:
version: "2.1.10"
- aws-cli/setup:
version: "2.0.20"
override-installed: true
- check_aws_version:
version: "2.0.20"
- integration-test-role-arn-setup:
name: test-role-arn-config
profile-name: "CircleCI-Tester"
role-arn: "arn:aws:iam::0123456789:role/foo-bar"

# Publish a semver version of the orb. relies on
# the commit subject containing the text "[semver:patch|minor|major|skip]"
# as that will determine whether a patch, minor or major
# version will be published or if publishing should
# be skipped.
# e.g. [semver:patch] will cause a patch version to be published.
- orb-tools/dev-promote-prod-from-commit-subject:
orb-name: circleci/aws-cli
context: orb-publisher
add-pr-comment: false
fail-if-semver-not-indicated: true
publish-version-tag: false
requires:
- integration-test-install
- integration-test-install-version
- integration-test-install-override-version
filters:
branches:
only:
- master
filters: *filters
# Triggers the next workflow in the Orb Development Kit.
- orb-tools/continue:
pipeline-number: << pipeline.number >>
vcs-type: << pipeline.project.type >>
requires: [orb-tools/publish]
filters: *filters
Loading

0 comments on commit a23cf78

Please sign in to comment.