You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: update lifecycle API validation for experimental flag solve issue #2414 (#2432)
* fix: allow image extensions based on buildpack API
Signed-off-by: vky5 <vky05@proton.me>
* Move extension validation to client layer and check Platform API version
- Move validation from command layer (builder_create.go, create_builder.go)
to client layer (pkg/client/create_builder.go)
- Check Platform API version instead of lifecycle version to determine
if extensions are stable (>= 0.13) or experimental (< 0.13)
- Use lifecycle's LessThan() method for version comparison
- Add comprehensive tests for Platform API validation scenarios:
* Platform API >= 0.13 allows extensions without experimental flag
* Platform API < 0.13 requires experimental flag for extensions
* Builders without extensions work regardless of Platform API version
- Create platform-0.13 test lifecycle data with Platform API 0.3-0.13
- Add prepareExtensions() test helper that configures both extensions
and appropriate lifecycle for testing
This fixes the issue where users get experimental extension errors even
when using lifecycle with Platform API 0.13 where extensions are stable.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
* Run make format to remove extra blank lines
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
* Fix linting errors by removing deprecated API usage
- Remove fallback to deprecated descriptor.API.PlatformVersion
- Use only descriptor.APIs.Platform.Supported (new API)
- Skip validation if Platform API information is unavailable
- Remove unused github.com/buildpacks/lifecycle/api import
This fixes staticcheck SA1019 warnings about using deprecated API fields.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
---------
Signed-off-by: vky5 <vky05@proton.me>
Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
Co-authored-by: Juan Bustamante <bustamantejj@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: internal/commands/builder_create_test.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ package commands_test
2
2
3
3
import (
4
4
"bytes"
5
+
"errors"
5
6
"fmt"
6
7
"os"
7
8
"path/filepath"
@@ -420,11 +421,13 @@ func testCreateCommand(t *testing.T, when spec.G, it spec.S) {
420
421
})
421
422
422
423
it("errors", func() {
424
+
mockClient.EXPECT().CreateBuilder(gomock.Any(), gomock.Any()).Return(errors.New("builder config contains image extensions, but the lifecycle Platform API version (0.12) is older than 0.13; support for image extensions with Platform API < 0.13 is currently experimental"))
425
+
423
426
command.SetArgs([]string{
424
427
"some/builder",
425
428
"--config", builderConfigPath,
426
429
})
427
-
h.AssertError(t, command.Execute(), "builder config contains image extensions; support for image extensions is currently experimental")
430
+
h.AssertError(t, command.Execute(), "support for image extensions with Platform API < 0.13 is currently experimental")
Copy file name to clipboardExpand all lines: internal/commands/create_builder_test.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ package commands_test
2
2
3
3
import (
4
4
"bytes"
5
+
"errors"
5
6
"os"
6
7
"path/filepath"
7
8
"testing"
@@ -171,11 +172,13 @@ func testCreateBuilderCommand(t *testing.T, when spec.G, it spec.S) {
171
172
})
172
173
173
174
it("errors", func() {
175
+
mockClient.EXPECT().CreateBuilder(gomock.Any(), gomock.Any()).Return(errors.New("builder config contains image extensions, but the lifecycle Platform API version (0.12) is older than 0.13; support for image extensions with Platform API < 0.13 is currently experimental"))
176
+
174
177
command.SetArgs([]string{
175
178
"some/builder",
176
179
"--config", builderConfigPath,
177
180
})
178
-
h.AssertError(t, command.Execute(), "builder config contains image extensions; support for image extensions is currently experimental")
181
+
h.AssertError(t, command.Execute(), "support for image extensions with Platform API < 0.13 is currently experimental")
0 commit comments