-
Notifications
You must be signed in to change notification settings - Fork 272
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
support latest in distribution build urls #1569
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sharing, good progress on this space.
Do you know why the package-lock.json change is so big? I wouldn't expect much of any change to it.
Will this enable us to hit |
This feature will only replace the |
Codecov Report
@@ Coverage Diff @@
## main #1569 +/- ##
============================================
- Coverage 94.62% 94.61% -0.02%
Complexity 14 14
============================================
Files 164 165 +1
Lines 3459 3489 +30
Branches 21 25 +4
============================================
+ Hits 3273 3301 +28
- Misses 183 185 +2
Partials 3 3
Continue to review full report at Codecov.
|
Experiment a bit about this comment about pagination support #1569 (comment) I wrote a script to put >1K objects under a version ("1.7.1") in my personal AWS account to simulate the situation where distribution build generates more than 1K builds for a version. Without making the change to support pagination, I run the Lambda function and can indeed see the limitation of ListObjectsV2 API about CommonPrefixes field as documented https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html#AmazonS3-ListObjectsV2-response-CommonPrefixes After my change, I am able to see the full result being retrieved. The CloudWatch log snippet shows: |
bfa2284
to
97e7bdc
Compare
Added the logic to upload
|
Created a Github issue to track the S3 permission which could be worked in parallel. #1601 I temporarily upload to |
Tuning the Lambda function to get
The one with real number works But the Need to dig more why the Lambda is not working. |
is result cached by cloudfront cdn? |
Thanks for the reminder. After digging more with @seraphjiang , the new logic needs to go through new version publish and deployment to Lambda@Edge to take effect. Now the latest url is working Next step: read yml to get the build number instead of hardcoding mapping |
I suggest redirecting |
Sure. I was able to make this happen in my Lambda. https://d271n53yru5cr7.cloudfront.net/distribution-build-opensearch/2.0.0/latest/test.png
|
experimenting on how to get the Option 1: download (e.g use JavaScript library 'https') the yml file from the URL d271n53yru5cr7.cloudfront.net/distribution-build-opensearch/2.0.0/dist/index.yml to a Lambda local file system. Read the yml and get the build number. Option 2: get the S3 keys from the url https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.1.1/latest/linux/x64/dist/opensearch/manifest.yml However, we do not know the S3 bucket name. May need a way to figure this out. |
struggled with Option 1 to download from url. Based on my research, the Will try to see if there is other library to handle the file download. |
Received the following error when tuning inside Lambda console. I suspect there is some version upgrade needed to support such in Lambda. Researching... |
Notes for reviewers:
|
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
The bundle role is the one used by the distribution-build jobs when vars/uploadArtifacts.groovy is processes. This change allows the uploading of an index.yml Signed-off-by: Peter Nied <[email protected]>
I pulled in a new library @aws-cdk/aws-lambda-nodejs that handles the transformation of javascript to typescript. Had to patch up a couple of things which made this change a little more complex that intended. - All of the CDK components were not version locked, that meant depending on the order of npm installs they could drift and get into a dependancy mismatch spiral. The version itself isn't important, its uniformity is all that matters. - Added permissions to the lambda role for interacting with cloudfronts distribution system, these were handled by the lambda function during deployment, but it seems this new library while handling the js -> ts brought some limitations and I had to manually implement the permssions see for details https://tinyurl.com/5xy3n8zt - Need to fix some typescript compliation issues, please feel free to re-work all of this and just keep the method signature Signed-off-by: Peter Nied <[email protected]>
Signed-off-by: Tianle Huang <[email protected]> Revert "support js-yaml" This reverts commit c78e701. Signed-off-by: Tianle Huang <[email protected]> add js-yaml Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]> clean up Signed-off-by: Tianle Huang <[email protected]> update lock json Signed-off-by: Tianle Huang <[email protected]> update Signed-off-by: Tianle Huang <[email protected]> update the s3 location for index.json Signed-off-by: Tianle Huang <[email protected]> delete unused from rebase Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
c747319
to
96b4670
Compare
Signed-off-by: Tianle Huang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am good with this if @peternied is good with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this change!
Can @opensearch-project/engineering-effectiveness update this PR after the change has been deployed? I know there are a bunch of folks that would love to use 'latest' in their codebases. |
Looking into it. Will update this PR once the change is deployed. Thanks! |
These changes have been deployed. @tianleh Can you check if it is working as expected? |
Signed-off-by: Tianle Huang [email protected]
Description
Add the logic to scan S3 bucket to get the max build number. The version and bucket name are hardcoded for demo purpose. Also move the Lambda function logic to a local js file instead of inline code.
Issues Resolved
#1492
Test
able to get the max build number in my test account.
INFO maxBuildNumber 21
The S3 structure is similar to distribution bucket.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.