Skip to content

Commit be158d1

Browse files
authored
chore: remove deprecated properties for v0.13.0 (dagger#8281)
* chore: allow specifying version to make test queries with Signed-off-by: Justin Chadwell <[email protected]> * chore: bump next version to v0.13.0 Signed-off-by: Justin Chadwell <[email protected]> * chore: remove skipEntrypoint arg Signed-off-by: Justin Chadwell <[email protected]> * chore: remove pipeline args Signed-off-by: Justin Chadwell <[email protected]> * chore: remove cloneURL property Signed-off-by: Justin Chadwell <[email protected]> * chore: add CHANGELOG Signed-off-by: Justin Chadwell <[email protected]> * chore: remove pipeline calls in java/php tests Signed-off-by: Justin Chadwell <[email protected]> --------- Signed-off-by: Justin Chadwell <[email protected]>
1 parent 4cf2b74 commit be158d1

File tree

39 files changed

+245
-959
lines changed

39 files changed

+245
-959
lines changed

.changes/.next

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# automagically determined from release note entries (and then adding to the
99
# patch release).
1010

11-
v0.12.8
11+
v0.13.0
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
kind: Breaking
2+
body: |
3+
Remove deprecated fields and arguments
4+
5+
- Remove `Container.withExec`'s `skipEntrypoint` argument - this is now the default (see `useEntrypoint`)
6+
- Remove `pipeline`, `Container.pipeline` and `Directory.pipeline`
7+
- Remove `GitModuleSource.cloneURL` (see `GitModuleSource.cloneRef`)
8+
time: 2024-09-03T15:33:59.531219349+01:00
9+
custom:
10+
Author: jedevc
11+
PR: "8065"

cmd/dagger/session.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import (
2020
enginetel "github.com/dagger/dagger/engine/telemetry"
2121
)
2222

23-
var sessionLabels = enginetel.NewLabelFlag()
23+
var (
24+
sessionLabels = enginetel.NewLabelFlag()
25+
sessionVersion string
26+
)
2427

2528
func sessionCmd() *cobra.Command {
2629
cmd := &cobra.Command{
@@ -30,6 +33,7 @@ func sessionCmd() *cobra.Command {
3033
RunE: EngineSession,
3134
SilenceUsage: true,
3235
}
36+
cmd.Flags().StringVar(&sessionVersion, "version", "", "")
3337
cmd.Flags().Var(&sessionLabels, "label", "label that identifies the source of this session (e.g, --label 'dagger.io/sdk.name:python' --label 'dagger.io/sdk.version:0.5.2' --label 'dagger.io/sdk.async:true')")
3438
return cmd
3539
}
@@ -80,6 +84,7 @@ func EngineSession(cmd *cobra.Command, args []string) error {
8084
return withEngine(ctx, client.Params{
8185
SecretToken: sessionToken.String(),
8286
UserAgent: labelsFlag.Labels.WithCILabels().WithAnonymousGitLabels(workdir).UserAgent(),
87+
Version: sessionVersion,
8388
}, func(ctx context.Context, sess *client.Client) error {
8489
// Requests maintain their original trace context from the client, rather
8590
// than appearing beneath the dagger session span, so in order to see any

core/container_exec.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ type ContainerExecOpts struct {
2424
// Command to run instead of the container's default command
2525
Args []string
2626

27-
// If the container has an entrypoint, ignore it for this exec rather than
28-
// calling it with args
29-
SkipEntrypoint *bool `default:"true"`
30-
3127
// If the container has an entrypoint, prepend it to this exec's args
3228
UseEntrypoint bool `default:"false"`
3329

core/integration/client_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,22 @@ func (ClientSuite) TestClientStableID(ctx context.Context, t *testctx.T) {
142142
require.NoError(t, err)
143143
require.NotEmpty(t, stableID)
144144
}
145+
146+
// TestQuerySchemaVersion checks that we can set the QueryOptions.Version
147+
// parameter to determine which schema version we're served.
148+
//
149+
// We use this in tests to do quick-and-easy checks against the schemas served
150+
// (without needing to do fancy module manipulation).
151+
func (ClientSuite) TestQuerySchemaVersion(ctx context.Context, t *testctx.T) {
152+
v := struct {
153+
SchemaVersion string `json:"__schemaVersion"`
154+
}{}
155+
err := testutil.Query(t,
156+
`{
157+
__schemaVersion
158+
}`, &v, &testutil.QueryOptions{
159+
Version: "v123.456.789",
160+
})
161+
require.NoError(t, err)
162+
require.Equal(t, "v123.456.789", v.SchemaVersion)
163+
}

core/integration/container_test.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -792,40 +792,6 @@ func (ContainerSuite) TestExecWithEntrypoint(ctx context.Context, t *testctx.T)
792792
})
793793
}
794794

795-
func (ContainerSuite) TestExecWithSkipEntrypointCompat(ctx context.Context, t *testctx.T) {
796-
// Tests backwards compatibility with `skipEntrypoint: false` option.
797-
// Doesn't work on Go because it can't distinguish between unset and
798-
// empty value.
799-
800-
res := struct {
801-
Container struct {
802-
From struct {
803-
WithEntrypoint struct {
804-
WithExec struct {
805-
Stdout string
806-
}
807-
}
808-
}
809-
}
810-
}{}
811-
812-
err := testutil.Query(t,
813-
`{
814-
container {
815-
from(address: "`+alpineImage+`") {
816-
withEntrypoint(args: ["sh", "-c"]) {
817-
withExec(args: ["echo $HOME"], skipEntrypoint: false) {
818-
stdout
819-
}
820-
}
821-
}
822-
}
823-
}`, &res, nil)
824-
825-
require.NoError(t, err)
826-
require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.WithExec.Stdout)
827-
}
828-
829795
func (ContainerSuite) TestExecWithoutEntrypoint(ctx context.Context, t *testctx.T) {
830796
c := connect(ctx, t)
831797

core/integration/legacy_test.go

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/creack/pty"
1313
"github.com/stretchr/testify/require"
1414

15+
"github.com/dagger/dagger/internal/testutil"
1516
"github.com/dagger/dagger/testctx"
1617
)
1718

@@ -297,6 +298,45 @@ func (m *Test) Skip() *dagger.Container {
297298
require.Equal(t, "hello\n", out)
298299
}
299300

301+
func (LegacySuite) TestExecWithSkipEntrypointCompat(ctx context.Context, t *testctx.T) {
302+
// Changed in dagger/dagger#8281
303+
//
304+
// Ensure that old schemas still have skipEntrypoint API
305+
//
306+
// Tests backwards compatibility with `skipEntrypoint: false` option.
307+
// Doesn't work on Go because it can't distinguish between unset and
308+
// empty value.
309+
310+
res := struct {
311+
Container struct {
312+
From struct {
313+
WithEntrypoint struct {
314+
WithExec struct {
315+
Stdout string
316+
}
317+
}
318+
}
319+
}
320+
}{}
321+
err := testutil.Query(t,
322+
`{
323+
container {
324+
from(address: "`+alpineImage+`") {
325+
withEntrypoint(args: ["sh", "-c"]) {
326+
withExec(args: ["echo $HOME"], skipEntrypoint: false) {
327+
stdout
328+
}
329+
}
330+
}
331+
}
332+
}`, &res, &testutil.QueryOptions{
333+
Version: "v0.12.6",
334+
})
335+
336+
require.NoError(t, err)
337+
require.Equal(t, "/root\n", res.Container.From.WithEntrypoint.WithExec.Stdout)
338+
}
339+
300340
func (LegacySuite) TestLegacyNoExec(ctx context.Context, t *testctx.T) {
301341
// Changed in dagger/dagger#7857
302342
//
@@ -442,3 +482,56 @@ func (m *Test) Proto(proto NetworkProtocol) NetworkProtocol {
442482
require.NoError(t, err)
443483
require.Contains(t, out, "UDP")
444484
}
485+
486+
func (LegacySuite) TestPipeline(ctx context.Context, t *testctx.T) {
487+
// Changed in dagger/dagger#8281
488+
//
489+
// Ensure that pipeline still exists in old schemas.
490+
491+
res := struct {
492+
Pipeline struct {
493+
Version string
494+
}
495+
}{}
496+
err := testutil.Query(t,
497+
`{
498+
pipeline(name: "foo") {
499+
version
500+
}
501+
}`, &res, &testutil.QueryOptions{
502+
Version: "v0.12.6",
503+
})
504+
505+
require.NoError(t, err)
506+
require.NotEmpty(t, res.Pipeline.Version)
507+
}
508+
509+
func (LegacySuite) TestModuleSourceCloneURL(ctx context.Context, t *testctx.T) {
510+
// Changed in dagger/dagger#8281
511+
//
512+
// Ensure that cloneURL still exists in old schemas.
513+
514+
res := struct {
515+
ModuleSource struct {
516+
AsGitSource struct {
517+
CloneRef string
518+
CloneURL string
519+
}
520+
}
521+
}{}
522+
err := testutil.Query(t,
523+
`{
524+
moduleSource(refString: "https://github.com/dagger/[email protected]") {
525+
asGitSource {
526+
cloneRef
527+
cloneURL
528+
}
529+
}
530+
}`, &res, &testutil.QueryOptions{
531+
Version: "v0.12.6",
532+
})
533+
534+
require.NoError(t, err)
535+
require.Equal(t, "https://github.com/dagger/dagger.git", res.ModuleSource.AsGitSource.CloneRef)
536+
require.Equal(t, res.ModuleSource.AsGitSource.CloneRef, res.ModuleSource.AsGitSource.CloneURL)
537+
}

core/modfunc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ func moduleAnalyticsProps(mod *Module, prefix string, props map[string]string) {
376376
git := source.AsGitSource.Value
377377
props[prefix+"source_kind"] = "git"
378378
props[prefix+"git_symbolic"] = git.Symbolic()
379-
props[prefix+"git_clone_url"] = git.CloneURL // todo(guillaume): remove as deprecated
379+
props[prefix+"git_clone_url"] = git.CloneRef // todo(guillaume): remove as deprecated
380380
props[prefix+"git_clone_ref"] = git.CloneRef
381381
props[prefix+"git_subpath"] = git.RootSubpath
382382
props[prefix+"git_version"] = git.Version

core/modulesource.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,6 @@ type GitModuleSource struct {
680680
Version string `field:"true" doc:"The specified version of the git repo this source points to."`
681681
Commit string `field:"true" doc:"The resolved commit of the git repo this source points to."`
682682

683-
CloneURL string `field:"true" name:"cloneURL" doc:"The URL to clone the root of the git repo from" deprecated:"Use CloneRef instead. CloneRef supports both URL-style and SCP-like SSH references"`
684683
CloneRef string `field:"true" name:"cloneRef" doc:"The ref to clone the root of the git repo from"`
685684

686685
HTMLRepoURL string `field:"true" name:"htmlRepoURL" doc:"The URL to access the web view of the repository (e.g., GitHub, GitLab, Bitbucket)"`

core/schema/container.go

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func (s *containerSchema) Install() {
4343
`It doesn't run the default command if no exec has been set.`),
4444

4545
dagql.Func("pipeline", s.pipeline).
46+
View(BeforeVersion("v0.13.0")).
4647
Deprecated("Explicit pipeline creation is now a no-op").
4748
Doc(`Creates a named sub-pipeline.`).
4849
ArgDoc("name", "Name of the sub-pipeline.").
@@ -312,6 +313,36 @@ func (s *containerSchema) Install() {
312313
dagql.Func("withExec", s.withExec).
313314
View(AllVersion).
314315
Doc(`Retrieves this container after executing the specified command inside it.`).
316+
ArgDoc("args",
317+
`Command to run instead of the container's default command (e.g., ["run", "main.go"]).`,
318+
`If empty, the container's default command is used.`).
319+
ArgDoc("useEntrypoint",
320+
`If the container has an entrypoint, prepend it to the args.`).
321+
ArgRemove("skipEntrypoint").
322+
ArgDoc("stdin",
323+
`Content to write to the command's standard input before closing (e.g.,
324+
"Hello world").`).
325+
ArgDoc("redirectStdout",
326+
`Redirect the command's standard output to a file in the container (e.g.,
327+
"/tmp/stdout").`).
328+
ArgDoc("redirectStderr",
329+
`Redirect the command's standard error to a file in the container (e.g.,
330+
"/tmp/stderr").`).
331+
ArgDoc("experimentalPrivilegedNesting",
332+
`Provides Dagger access to the executed command.`,
333+
`Do not use this option unless you trust the command being executed;
334+
the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST
335+
FILESYSTEM.`).
336+
ArgDoc("insecureRootCapabilities",
337+
`Execute the command with all root capabilities. This is similar to
338+
running a command with "sudo" or executing "docker run" with the
339+
"--privileged" flag. Containerization does not provide any security
340+
guarantees when using this option. It should only be used when
341+
absolutely necessary and only with trusted commands.`),
342+
343+
dagql.Func("withExec", s.withExec).
344+
View(BeforeVersion("v0.13.0")).
345+
Doc(`Retrieves this container after executing the specified command inside it.`).
315346
ArgDoc("args",
316347
`Command to run instead of the container's default command (e.g., ["run", "main.go"]).`,
317348
`If empty, the container's default command is used.`).
@@ -670,12 +701,16 @@ func (s *containerSchema) rootfs(ctx context.Context, parent *core.Container, ar
670701

671702
type containerExecArgs struct {
672703
core.ContainerExecOpts
704+
705+
// If the container has an entrypoint, ignore it for this exec rather than
706+
// calling it with args
707+
SkipEntrypoint *bool `default:"true"`
673708
}
674709

675710
func (s *containerSchema) withExec(ctx context.Context, parent *core.Container, args containerExecArgs) (*core.Container, error) {
676-
if args.ContainerExecOpts.SkipEntrypoint != nil {
711+
if args.SkipEntrypoint != nil {
677712
slog.Warn("The 'skipEntrypoint' argument is deprecated. Use 'useEntrypoint' instead.")
678-
if !args.ContainerExecOpts.UseEntrypoint && !*args.ContainerExecOpts.SkipEntrypoint {
713+
if !args.ContainerExecOpts.UseEntrypoint && !*args.SkipEntrypoint {
679714
args.ContainerExecOpts.UseEntrypoint = true
680715
}
681716
}
@@ -713,7 +748,6 @@ func (s *containerSchema) withExecLegacy(ctx context.Context, parent *core.Conta
713748
opts := core.ContainerExecOpts{
714749
Args: args.Args,
715750
UseEntrypoint: !args.SkipEntrypoint,
716-
SkipEntrypoint: &args.SkipEntrypoint,
717751
Stdin: args.Stdin,
718752
RedirectStdout: args.RedirectStdout,
719753
RedirectStderr: args.RedirectStderr,

0 commit comments

Comments
 (0)