Skip to content

Commit

Permalink
Merge pull request #540 from cloudify-cosmo/3.1.7-build
Browse files Browse the repository at this point in the history
3.1.7 build
  • Loading branch information
EarthmanT authored Jun 26, 2023
2 parents 45a39b2 + b047cb7 commit ea018c7
Show file tree
Hide file tree
Showing 12 changed files with 229 additions and 22 deletions.
44 changes: 37 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ executors:

commands:

ec2_image_verify:
steps:
- run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
- run: |
aws configure set default.region us-east-1
aws configure set aws_access_key_id $(echo $aws_access_key_id | base64 -d -w 0)
aws configure set aws_secret_access_key $(echo $aws_secret_access_key | base64 -d -w 0)
aws configure set output json
- run: |
ret=`aws ec2 describe-images --filters Name=name,Values=CentOS7-cloudify-examples-image | jq '.Images' | jq -r '.[0].Name'`
if [ $ret != "CentOS7-cloudify-examples-image" ]; then
echo "The current AWS account cannot find the required examples image. Tests cannot pass.";
exit 1;
else
echo "Found it!";
exit 0;
fi
eks_prepare_test_manager:
steps:
- run: ls -alR
Expand All @@ -66,7 +88,7 @@ commands:

run_cf_test:
steps:
- run: ecosystem-test local-blueprint-test -b examples/blueprint-examples/virtual-machine/aws-cloudformation.yaml --test-id=virtual-machine -i aws_region_name=eu-west-3 -i resource_suffix=$CIRCLE_BUILD_NUM --on-failure=uninstall-force --timeout=3000
- run: ecosystem-test local-blueprint-test -b examples/virtual-machine/aws-cloudformation.yaml --test-id=virtual-machine -i aws_region_name=eu-west-3 -i resource_suffix=$CIRCLE_BUILD_NUM --on-failure=uninstall-force --timeout=3000

run_eks_test:
steps:
Expand Down Expand Up @@ -138,12 +160,11 @@ commands:

jobs:

run_sample_job:
executor: cloudify-machine-py3
environment:
CLOUDIFY_SSL_TRUST_ALL: true
verify_ec2_image:
executor: py36
steps:
- run_sample_test
- checkout
- ec2_image_verify

cf_integration_tests_py3:
executor: cloudify-machine-py3
Expand Down Expand Up @@ -353,6 +374,7 @@ workflows:
version: 2
tests:
jobs:
- verify_ec2_image
- node/check_py3_compat_job
- node/unittests_job:
context:
Expand Down Expand Up @@ -430,6 +452,7 @@ workflows:
only:
- master
jobs:
- verify_ec2_image
- node/check_py3_compat_job
- node/unittests_job:
context:
Expand Down Expand Up @@ -464,6 +487,7 @@ workflows:
- slack-secrets
<<: *job-post-steps
requires:
- verify_ec2_image
- wagonorb/wagon
- wagonorb/rhel_wagon
- wagonorb/arch64_wagon
Expand All @@ -475,6 +499,7 @@ workflows:
- slack-secrets
<<: *job-post-steps
requires:
- verify_ec2_image
- wagonorb/wagon
- wagonorb/rhel_wagon
- wagonorb/arch64_wagon
Expand Down Expand Up @@ -515,6 +540,7 @@ workflows:
only:
- master
jobs:
- verify_ec2_image
- node/check_py3_compat_job
- node/unittests_job:
context:
Expand Down Expand Up @@ -549,6 +575,7 @@ workflows:
- slack-secrets
<<: *job-post-steps
requires:
- verify_ec2_image
- wagonorb/wagon
- wagonorb/rhel_wagon
- wagonorb/arch64_wagon
Expand Down Expand Up @@ -610,6 +637,7 @@ workflows:
only:
- master
jobs:
- verify_ec2_image
- node/check_py3_compat_job
- node/unittests_job:
context:
Expand All @@ -633,6 +661,7 @@ workflows:
- slack-secrets
<<: *job-post-steps
requires:
- verify_ec2_image
- wagonorb/wagon
- wagonorb/rhel_wagon
- wagonorb/arch64_wagon
Expand Down Expand Up @@ -693,4 +722,5 @@ workflows:
- wagonorb/arch64_wagon
filters:
branches:
only: /([0-9\.]*\-build|master|dev)/
only: /([0-9\.]*\-build|master|dev)/

4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
3.1.7:
- Fix bug after Cloudify 7 release.
- Support for ACL deprecation in s3 buckets.
- Fix bug in cloudformation-feature-demo blueprint
3.1.6: add __version__.py file in cloudify_aws folder.
3.1.5: RD-6735 Do not stop existing resource.
3.1.4: Update Check Drift Status
Expand Down
2 changes: 1 addition & 1 deletion cloudify_aws/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '3.1.6'
version = '3.1.7'
32 changes: 30 additions & 2 deletions cloudify_aws/s3/resources/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
AWS S3 Bucket interface
"""
# Cloudify
from cloudify_aws.common import decorators
from cloudify_aws.s3 import S3Base
from cloudify_aws.common import decorators
from cloudify.exceptions import NonRecoverableError

# Boto
from botocore.exceptions import ClientError, ParamValidationError

Expand Down Expand Up @@ -72,6 +74,20 @@ def delete(self, params=None):
% (self.type_name, params))
self.client.delete_bucket(**params)

def put_public_access_block(self, params):
"""
put PublicAccessBlock configuration.
"""
self.client.put_public_access_block(
Bucket=params['Bucket'],
PublicAccessBlockConfiguration={
'BlockPublicAcls': True,
'IgnorePublicAcls': True,
'BlockPublicPolicy': False,
'RestrictPublicBuckets': False
}
)

def delete_objects(self, bucket):
list_objects = self.client.list_objects(Bucket=bucket)
for object in list_objects.get('Contents', []):
Expand Down Expand Up @@ -109,7 +125,19 @@ def create(ctx, iface, resource_config, params, **_):
del params['CreateBucketConfiguration']

# Actually create the resource
bucket = iface.create(params)
try:
bucket = iface.create(params)
except NonRecoverableError as e:
acl = params.pop('ACL', '')
if "InvalidBucketAclWithObjectOwnership" not in str(e) \
and "Bucket cannot have ACLs" not in str(e) \
and 'public-read' not in acl:
raise e
ctx.logger.error('Deprecation warning, the AWS API has changed \
and ACL-public is no longer valid.')
bucket = iface.create(params)

iface.put_public_access_block(params)
ctx.instance.runtime_properties[LOCATION] = bucket.get(LOCATION)


Expand Down
12 changes: 11 additions & 1 deletion cloudify_aws/s3/resources/bucket_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,17 @@ def create(ctx, iface, resource_config, **_):
ctx.instance.runtime_properties[BUCKET] = bucket_name

# Actually create the resource
iface.create(resource_config)
try:
iface.create(resource_config)
except NonRecoverableError as e:
acl = resource_config.pop('ACL', '')
if 'AccessControlListNotSupported' not in str(e) \
and 'The bucket does not allow ACLs' not in str(e) \
and 'public-read' not in acl:
raise e
ctx.logger.error('Deprecation warning, the AWS API has changed and \
ACL-public is no longer valid.')
iface.create(resource_config)


@decorators.check_swift_resource
Expand Down
3 changes: 1 addition & 2 deletions examples/cloudformation-feature-demo/blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ inputs:

aws_region_name:
type: string
default: { get_secret: ec2_region_name }
default: eu-west-2

availability_zone:
type: string
Expand Down Expand Up @@ -81,7 +81,6 @@ node_templates:
HelloBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: error.html
Expand Down
9 changes: 4 additions & 5 deletions examples/s3-feature-demo/blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ inputs:
type: string
default: { concat: [ { get_input: aws_region_name}, 'b' ] }

name_bucket:
type: string
default: cloudify-aws-testing-bucket

dsl_definitions:

Expand All @@ -37,8 +40,7 @@ node_templates:
type: cloudify.nodes.aws.s3.Bucket
properties:
resource_config:
Bucket: cloudify-aws-testing-bucket
ACL: public-read-write
Bucket: { get_input: name_bucket }
CreateBucketConfiguration:
LocationConstraint: { get_input: aws_region_name }
client_config: *client_config
Expand Down Expand Up @@ -98,7 +100,6 @@ node_templates:
properties:
source_type: 'bytes'
resource_config:
ACL: 'public-read'
Bucket: { get_property: [ bucket, resource_config, Bucket ] }
Key: 'test-byte-data.txt'
kwargs:
Expand All @@ -116,7 +117,6 @@ node_templates:
source_type: 'local'
path: './local-s3-object.txt'
resource_config:
ACL: 'public-read'
Bucket: { get_property: [ bucket, resource_config, Bucket ] }
Key: 'local-s3-object.txt'
client_config: *client_config
Expand All @@ -132,7 +132,6 @@ node_templates:
source_type: 'remote'
path: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf'
resource_config:
ACL: 'public-read'
Bucket: { get_property: [ bucket, resource_config, Bucket ] }
Key: 'dummy.pdf'
client_config: *client_config
Expand Down
Loading

0 comments on commit ea018c7

Please sign in to comment.