Skip to content
This repository was archived by the owner on Mar 21, 2023. It is now read-only.

Commit 0660edd

Browse files
authored
Merge pull request #5 from aws-solutions/release/v1.0.2
Release v1.0.2
2 parents b34da87 + 1327001 commit 0660edd

File tree

9 files changed

+57
-44
lines changed

9 files changed

+57
-44
lines changed

.gitignore

Lines changed: 0 additions & 34 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.0.2] - 2021-12-31
8+
### Fixed
9+
- Custom Resource Lambda function failing to publish a new version of the Lambda edge function.
10+
711
## [1.0.1] - 2021-09-01
812
### Changed
913
- Update Lambda versions to Node.js 14.

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ information to effectively respond to your bug report or contribution.
1111

1212
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
1313

14-
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
14+
When filing an issue, please check [existing open](https://github.com/aws-solutions/operations-conductor/issues), or [recently closed](https://github.com/aws-solutions/operations-conductor/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
1515
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
1616

1717
* A reproducible test case or series of steps
@@ -41,7 +41,7 @@ GitHub provides additional document on [forking a repository](https://help.githu
4141

4242

4343
## Finding contributions to work on
44-
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
44+
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels ((enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/aws-solutions/operations-conductor/labels/help%20wanted) issues is a great place to start.
4545

4646

4747
## Code of Conduct
@@ -56,6 +56,6 @@ If you discover a potential security issue in this project we ask that you notif
5656

5757
## Licensing
5858

59-
See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
59+
See the [LICENSE](https://github.com/aws-solutions/operations-conductor/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
6060

6161
We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ aws s3 cp $OPS_CO_PATH/deployment/regional-s3-assets/ s3://$DIST_OUTPUT_BUCKET-$
4949
## Collection of operational metrics
5050
This solution collects anonymous operational metrics to help AWS improve the quality and features of the solution. For more information, including how to disable this capability, please see the [implementation guide](https://docs.aws.amazon.com/solutions/latest/operations-conductor/appendix-f.html).
5151

52-
5352
***
5453

5554
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -58,4 +57,4 @@ Licensed under the Apache License, Version 2.0 (the "License"). You may not use
5857

5958
http://www.apache.org/licenses/LICENSE-2.0
6059

61-
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
60+
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

deployment/build-s3-dist.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Parameters:
1010
# - source-bucket-base-name: Name for the S3 bucket location where the template will source the Lambda
1111
# code from. The template will append '-[region_name]' to this bucket name.
12-
# For example: ./build-s3-dist.sh solutions my-solution v1.0.1
12+
# For example: ./build-s3-dist.sh solutions my-solution v1.0.2
1313
# The template will then expect the source code to be located in the solutions-[region_name] bucket
1414
#
1515
# - trademarked-solution-name: name of the solution for consistency
@@ -19,7 +19,7 @@
1919
# Check to see if input has been provided:
2020
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then
2121
echo "Please provide the base source bucket name, trademark approved solution name and version where the lambda code will eventually reside."
22-
echo "For example: ./build-s3-dist.sh solutions trademarked-solution-name v1.0.1"
22+
echo "For example: ./build-s3-dist.sh solutions trademarked-solution-name v1.0.2"
2323
exit 1
2424
fi
2525

deployment/operations-conductor.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ Resources:
252252
- "lambda:CreateFunction"
253253
- "lambda:PublishVersion"
254254
- "lambda:UpdateFunctionConfiguration"
255+
- "lambda:GetFunctionConfiguration"
255256
Resource:
256257
- !Sub "arn:aws:lambda:us-east-1:${AWS::AccountId}:function:${AWS::StackName}-Lambda-Edge"
257258
# To create/delete UserPoolClient by custom resource

source/console/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "operations-conductor-console",
33
"description": "The Operations Conductor Web console",
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"private": true,
66
"dependencies": {
77
"aws-amplify": "^1.2.3",

source/services/custom-resource/index.ts

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,30 @@ export const handler = async (event: any, context: Context, callback: Callback)
186186
LOGGER.error('Creating Edge Lambda failed.', error);
187187
throw Error('Creating Edge Lambda failed.');
188188
}
189-
189+
190190
// Publishes Edge Lambda version
191191
try {
192+
let isFunctionStateActive = false
193+
let retry = 0
194+
let delayinMilliseconds = 5000;
195+
while (!isFunctionStateActive) {
196+
let response = await lambda.getFunctionConfiguration({
197+
FunctionName: functionArn
198+
}).promise();
199+
LOGGER.debug(`Response from get function configuration ${JSON.stringify(response)}`)
200+
if(response.State === 'Active' || retry > 10) {
201+
isFunctionStateActive = true
202+
} else {
203+
await waitForTime(delayinMilliseconds)
204+
retry++
205+
delayinMilliseconds += 5000;
206+
}
207+
}
208+
192209
let params: AWS.Lambda.PublishVersionRequest = {
193210
FunctionName: functionArn
194211
};
212+
195213
let result = await lambda.publishVersion(params).promise();
196214
responseData = {
197215
FunctionArn: `${functionArn}:${result.Version}`
@@ -220,9 +238,27 @@ export const handler = async (event: any, context: Context, callback: Callback)
220238
}
221239
// Publishes Edge Lambda version
222240
try {
241+
let isFunctionStateActive = false
242+
let retry = 0
243+
let delayinMilliseconds = 5000
244+
while (!isFunctionStateActive) {
245+
let response = await lambda.getFunctionConfiguration({
246+
FunctionName: functionArn
247+
}).promise();
248+
LOGGER.debug(`Response from get function configuration ${JSON.stringify(response)}`)
249+
if(response.State === 'Active' || retry > 10) {
250+
isFunctionStateActive = true
251+
} else {
252+
await waitForTime(delayinMilliseconds)
253+
retry++
254+
delayinMilliseconds += 5000;
255+
}
256+
}
257+
223258
let params: AWS.Lambda.PublishVersionRequest = {
224259
FunctionName: functionArn
225260
};
261+
226262
let result = await lambda.publishVersion(params).promise();
227263
responseData = {
228264
FunctionArn: `${functionArn}:${result.Version}`
@@ -498,4 +534,11 @@ const sendResponse = async (event: any, callback: Function, logStreamName: strin
498534
LOGGER.error('Custom resource sendResponse error', error);
499535
callback(error);
500536
}
537+
};
538+
539+
/** Function to add delay for waiting on process.
540+
* @param ms time in milliseconds
541+
*/
542+
const waitForTime = async (ms: number) => {
543+
return new Promise(resolve => setTimeout(resolve, ms));
501544
};

source/services/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "operations-conductor-services",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Operations Conductor solution services Lambda function package",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)