DataDog / datadog-lambda-js

The Datadog AWS Lambda Library for Node
Apache License 2.0
105 stars 35 forks source link

Release layer versions as GitHub releases #556

Closed samchungy closed 3 weeks ago

samchungy commented 1 month ago

Expected Behavior

I can use dependency management tooling on layers

Actual Behavior

Steps to Reproduce the Problem

  1. Use datadog CDK and manually specify layer versions
  2. Cry because nothing can update them.

Specifications

duncanista commented 4 weeks ago

Hey @samchungy,

Thanks for reaching out. I'm confused with the expected behavior. For your comment https://github.com/DataDog/datadog-cdk-constructs/issues/232#issuecomment-2155878743, if you look at the minor version of our package, that will be the layer version. For example, latest version is v9.112.0, which directly matches layer 112, let me know if this is of help, or if there's anything else you propose we do.

Let me know if you have any questions!

samchungy commented 3 weeks ago

Hey @samchungy,

Thanks for reaching out. I'm confused with the expected behavior. For your comment DataDog/datadog-cdk-constructs#232 (comment), if you look at the minor version of our package, that will be the layer version. For example, latest version is v9.112.0, which directly matches layer 112, let me know if this is of help, or if there's anything else you propose we do.

Let me know if you have any questions!

Oooo that might work. I'll have to play around with Renovate.

With renovate you can tell it to track versions based on releases, so I was hoping that this repo could post releases with the exact version.

Eg. this repo could publish GitHub releases similar to how a changesets monorepo would.

Eg. a datadog-lambda-js@9.112.0 release alongside lambda-layer@112

samchungy commented 3 weeks ago

Okay, figured out a way to work with that. Cheers @duncanista

https://github.com/samchungy/renovate-experiments/pull/9

For prosperity:

My code looks like:

const datadog = new Datadog(this, 'datadog', {
  apiKeySecret: datadogSecret,
  enableDatadogLogs: false,
  flushMetricsToLogs: false,
  extensionLayerVersion: 58,
  nodeLayerVersion: 111,
});

My renovate config:

{
  customManagers: [
    {
      customType: 'regex',
      fileMatch: ['test.ts'],
      matchStrings: [
        'new Datadog\\([\\S\\s]+nodeLayerVersion:\\s?(?<currentValue>\\d+)',
      ],
      packageNameTemplate: 'DataDog/datadog-lambda-js',
      depNameTemplate: 'datadog lambda layer',
      extractVersionTemplate: '^v\\d+\\.(?<version>\\d+)\\..*',
      datasourceTemplate: 'github-releases',
    },
  ],
}
duncanista commented 2 weeks ago

Hey @samchungy ,

Thanks for sharing your insights on this!

Again, sorry we cannot provide an automatic layer updater like the Serverless Plugin, yet. But please, feel free to re-open the issue whenever you feel like needing it.

Feel free to ping me back or send me an email at jgb@datadoghq.com if you want to send me direct feedback!