Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/config/defaults/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ resources:
product: aws-lambda
# Lambda's `support` date is the first/actionable runtime EOL date.
# The upstream `eol` date is AWS's later terminal deprecated-support
# date. Keep both in the finding's eol block, but warn on the first date.
# date. Keep both in the finding's eol block, but use the actionable
# date as the status-driving EOLDate so past-support runtimes are RED.
schema: declarative
lifecycle:
deprecation_date:
Expand All @@ -329,7 +330,7 @@ resources:
field: eol
deprecated_window: deprecated_support
eol_date:
field: eol
field: support

# To add a new resource type, follow skills/add-version-guard-resource.
# Standalone copy-paste templates live in skills/add-version-guard-resource/examples/.
17 changes: 17 additions & 0 deletions pkg/config/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@ func TestLoadResourcesConfig_EmbeddedDefault(t *testing.T) {
assert.NotEmpty(t, r.Inventory.RequiredMappings["resource_id"],
"resource %q missing required_mappings.resource_id", r.ID)
}

byID := make(map[string]ResourceConfig, len(cfg.Resources))
for _, r := range cfg.Resources {
byID[r.ID] = r
}

eks := byID["eks"]
require.NotNil(t, eks.EOL.Lifecycle)
assert.Equal(t, "extendedSupport", eks.EOL.Lifecycle.EOLDate.Field,
"EKS eol_date must stay on extendedSupport so the terminal EOL is end of extended support")

lambda := byID["lambda"]
require.NotNil(t, lambda.EOL.Lifecycle)
assert.Equal(t, "support", lambda.EOL.Lifecycle.EOLDate.Field,
"Lambda eol_date must stay on support so the actionable runtime EOL drives RED status")
assert.Equal(t, "eol", lambda.EOL.Lifecycle.DeprecatedSupportEnd.Field,
"Lambda deprecated_support_end should preserve AWS's later terminal date")
}

// TestLoadResourcesConfig_OverridePath asserts the override semantic:
Expand Down
7 changes: 4 additions & 3 deletions pkg/eol/endoflife/ADAPTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,16 @@ eol:
lifecycle:
deprecation_date:
field: support
extended_support_end:
deprecated_support_end:
field: eol
deprecated_window: deprecated_support
eol_date:
field: support
```

For `python3.8` (`support: 2024-10-14`, `eol: 2027-03-03`), the emitted
`EOLDate` is `2024-10-14`, while `ExtendedSupportEnd` preserves the later
AWS terminal date for downstream consumers that need it. Dates after
`EOLDate` is `2024-10-14`, while `DeprecatedSupportEnd` preserves the
later AWS terminal date for downstream consumers that need it. Dates after
`support` become true EOL / RED.

---
Expand Down
16 changes: 10 additions & 6 deletions pkg/eol/endoflife/adapters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func lambdaActionableEOLAdapter(t *testing.T) *DeclarativeSchemaAdapter {
adapter, err := NewDeclarativeSchemaAdapter(&DeclarativeLifecycleConfig{
DeprecationDate: LifecycleDateSource{Field: lifecycleFieldSupport},
DeprecatedSupportEnd: LifecycleDateSource{Field: lifecycleFieldEOL},
EOLDate: LifecycleDateSource{Field: lifecycleFieldEOL},
EOLDate: LifecycleDateSource{Field: lifecycleFieldSupport},
DeprecatedWindow: lifecycleActionDeprecatedSupport,
})
require.NoError(t, err)
Expand Down Expand Up @@ -394,15 +394,15 @@ func TestDeclarativeSchemaAdapter_LambdaPreservesActionableAndTerminalDates(t *t
require.NotNil(t, lifecycle.DeprecationDate)
require.NotNil(t, lifecycle.DeprecatedSupportEnd)
assert.Nil(t, lifecycle.ExtendedSupportEnd)
assert.Equal(t, terminal.Format("2006-01-02"), lifecycle.EOLDate.Format("2006-01-02"))
assert.Equal(t, support.Format("2006-01-02"), lifecycle.EOLDate.Format("2006-01-02"))
assert.Equal(t, support.Format("2006-01-02"), lifecycle.DeprecationDate.Format("2006-01-02"))
assert.Equal(t, terminal.Format("2006-01-02"), lifecycle.DeprecatedSupportEnd.Format("2006-01-02"))
assert.True(t, lifecycle.IsSupported)
assert.False(t, lifecycle.IsDeprecated)
assert.False(t, lifecycle.IsEOL)
}

func TestDeclarativeSchemaAdapter_LambdaPastActionableDateIsDeprecatedSupport(t *testing.T) {
func TestDeclarativeSchemaAdapter_LambdaPastActionableDateIsEOL(t *testing.T) {
adapter := lambdaActionableEOLAdapter(t)

cycle := &ProductCycle{
Expand All @@ -415,11 +415,15 @@ func TestDeclarativeSchemaAdapter_LambdaPastActionableDateIsDeprecatedSupport(t
lifecycle, err := adapter.AdaptCycle(cycle)
require.NoError(t, err)

assert.True(t, lifecycle.IsSupported)
assert.False(t, lifecycle.IsSupported)
assert.True(t, lifecycle.IsDeprecated)
assert.False(t, lifecycle.IsEOL)
assert.True(t, lifecycle.IsDeprecatedSupport)
assert.True(t, lifecycle.IsEOL)
assert.False(t, lifecycle.IsDeprecatedSupport)
assert.False(t, lifecycle.IsExtendedSupport)
require.NotNil(t, lifecycle.EOLDate)
require.NotNil(t, lifecycle.DeprecatedSupportEnd)
assert.Equal(t, cycle.Support, lifecycle.EOLDate.Format("2006-01-02"))
assert.Equal(t, cycle.EOL, lifecycle.DeprecatedSupportEnd.Format("2006-01-02"))
}

func TestDeclarativeSchemaAdapter_EKSCurrentVersion(t *testing.T) {
Expand Down
Loading