Repository navigation
Add a self-hosted image server for CML reports - #1499
Open
shcheklein wants to merge 1 commit into
Open
shcheklein wants to merge 1 commit into
shcheklein wants to merge 1 commit into
Conversation
asset.cml.dev no longer accepts uploads, so reports that embed local images need their own server for --publish-url / CML_COMMENT_PUBLISH_URL. image-server/ contains a CloudFormation template (private S3 bucket + Lambda function URL, inline Python handler) that stores uploads under the SHA-256 of their contents, requires a token in the publish URL, and serves images publicly by hash. The README covers deploy, CI setup, token rotation, limits and cleanup; test_template.py exercises the handler against a mocked S3 bucket. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
asset.cml.devno longer accepts uploads. Reports that embed local images now need either--publish-native(GitLab and Bitbucket) or an image server of their own, configured with--publish-url/CML_COMMENT_PUBLISH_URL. This PR adds a reference server that people can deploy in a few commands. It replaces the oldminroud-s3reference, which hasn't been updated since 2022.What's in
image-server/template.yml: a CloudFormation template that creates a private S3 bucket and a Lambda function URL. The Python handler is inline in the template.POST /?token=…stores the body under the SHA-256 of its contents and returns the image URL.GET /<sha256>serves the image publicly.403, which CML reports asEmpty response from asset backend with status code 403.README.md: deploy, CI setup, token rotation, limits, cost and cleanup.test_template.py: tests the inline handler against moto-mocked S3.The root README's "Images" section now links to it and to https://cml.dev/doc/image-hosting, which is added in iterative/cml.dev#541.
Testing
cfn-lint template.ymlpasses, and the 12 tests intest_template.pypass.cml asset publishviaCML_ASSET_URLandcml comment createviaCML_COMMENT_PUBLISH_URLboth upload to it.Content-Type.lambda:InvokeFunctionUrlandlambda:InvokeFunction(withInvokedViaFunctionUrl), which public function URLs have required since October 2025.🤖 Generated with Claude Code