-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
questionClarification and/or additional information required to move forwardClarification and/or additional information required to move forward
Description
Implementation PR
No response
Reference Issues
No response
Summary
Validate support for jq syntax used in recent TTP development - see new-m ttps.
Basic Example
Example TTP:
steps:
- name: ensure-aws-creds-present
inline: |
set -e
if [[ -z "${AWS_DEFAULT_REGION}" ]]; then
echo "AWS_DEFAULT_REGION must be set."
exit 1
fi
if [[ -n "${AWS_ACCESS_KEY_ID}" && -n "${AWS_SECRET_ACCESS_KEY}" ]]; then
if [[ -z "${AWS_SESSION_TOKEN}" ]]; then
echo "AWS_SESSION_TOKEN must be set when using AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY."
exit 1
fi
elif [[ -z "${AWS_PROFILE}" ]]; then
echo "Either AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN, or AWS_PROFILE must be set."
exit 1
fi
- name: ensure-aws-cli-present
inline: |
set -e
if ! [ -x "$(command -v aws)" ]; then
echo 'Error: AWS CLI is not installed.' >&2
else
echo -e "AWS CLI is installed: $(aws --version)"
fi
- name: populate_buckets_file
inline: |
set -e
if [ "{{args.create-buckets-file}}" == true ]; then
BUCKETS_FILE={{args.buckets}}
buckets=$(aws s3api list-buckets --query "Buckets[].Name" --output json | jq -r '.[]')
# Clear the output file
echo "" > $BUCKETS_FILE
for bucket in $buckets; do
bucket_region=$(aws s3api get-bucket-location --bucket "$bucket" --output json | jq -r '.LocationConstraint')
if [[ "$bucket_region" == "${AWS_DEFAULT_REGION}" ]]; then
echo "$bucket" | tee -a "${BUCKETS_FILE}"
fi
done
fiDesired End State of one of the steps:
- name: create_buckets_file_content
inline: |
aws s3api list-buckets --query "Buckets[].Name" --output json'
outputs:
- name: buckets_file
json: '.[]'Drawbacks
No response
Unresolved questions
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionClarification and/or additional information required to move forwardClarification and/or additional information required to move forward