Skip to content
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

feat: add datasource for AWS Lambda Layers #28251

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

kayman-mk
Copy link

@kayman-mk kayman-mk commented Apr 5, 2024

Changes

This PR adds a new datasource to update the versioned layer arns for AWS Lambda Layers.

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

kayman-mk and others added 28 commits November 22, 2022 09:14
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
…apag-Lloyd/renovate into kayma/add-aws-versioned-arn-datasource
@kayman-mk
Copy link
Author

kayman-mk commented Apr 5, 2024

Reopens #19081

I stopped working on that PR because I found out that you usually do not have the lambda:listLayerVersion policy for layers you do not own. So I thought this whole datasource didn't make any sense. But in fact it is useful as we found out in a team internal discussion today:

  • you can use it to update lambda layers you own
  • you can ask the maintainer of the layer you do not own to add the respective permission so Renovate can list the version numbers as well
aws lambda add-layer-version-permission \
    --layer-name my-layer \
    --statement-id xaccount \
    --action lambda:ListLayerVersions  \
    --principal 123456789012 \
    --version-number 1

@kayman-mk
Copy link
Author

Still have to work on the documentation

@kayman-mk kayman-mk marked this pull request as ready for review April 5, 2024 21:13
@kayman-mk
Copy link
Author

Todo: test this on a real repository

@kayman-mk kayman-mk marked this pull request as draft April 6, 2024 04:36

@cache({
namespace: `datasource-${AwsLambdaLayerDataSource.id}`,
key: (serializedLayerFilter: string) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong, parameters are same as the function parameters below

Comment on lines +55 to +57
const filter: AwsLambdaLayerFilter = JSON.parse(
serializedLambdaLayerFilter
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be done inside the function call below

import { Datasource } from '../datasource';
import type { GetReleasesConfig, ReleaseResult } from '../types';

export interface AwsLambdaLayerFilter {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use zod Schema parsing to validate user input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants