-
Notifications
You must be signed in to change notification settings - Fork 5
Feature request: CodePipeline Lambda Event #5
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
Comments
Cool, i will have a look. Is there any additional docs on the schema for this? I would assume their would some utils needed for this as well. |
@michaelbrewer i haven’t seen any other docs beyond that page. There is sample python code on there as well. |
@jplock tracked down more docs :) |
@jplock initial PR: aws-powertools/powertools-lambda-python#416 |
@jplock @heitorlessa any insights to what kind of utility short cuts (like setting up the S3 session) to add to the event type :) |
@michaelbrewer how about something like: def get_artifact(self, artifact_name: str, filename: str) -> Optional[str]:
s3 = boto3.client(
"s3",
aws_access_key_id=self.data.artifact_credentials.access_key_id,
aws_secret_access_key=self.data.artifact_credentials.secret_access_key,
aws_session_token=self.data.artifact_credentials.session_token
)
for artifact in self.data.input_artifacts:
if artifact.name == artifact_name:
bucket = artifact.location.s3_location.bucket_name
key = artifact.location.s3_location.key
with tempfile.NamedTemporaryFile() as tmp_file:
s3.download_file(bucket, key, tmp_file.name)
with zipfile.ZipFile(tmp_file.name, 'r') as zip:
return zip.read(filename)
return None
|
@jplock zip.read returns bytes and Cloudformation So i might have to add a decode("UTF-8") to this. |
@jplock this has been officially released now: CodePipeline Job |
Thank you for pushing this through @michaelbrewer ! |
Is your feature request related to a problem? Please describe.
A CodePipeline data class for Lambda events with helper methods to use the embedded credentials to download an artifact from S3.
https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example
Describe the solution you'd like
see above
Describe alternatives you've considered
Manually accessing the event
Additional context
The text was updated successfully, but these errors were encountered: