-
Notifications
You must be signed in to change notification settings - Fork 20
Extract tsuru.yaml from docker context #49
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -697,6 +697,43 @@ kubernetes: | |
| }, appFiles) | ||
| }) | ||
|
|
||
| t.Run("Extract tsuru.yaml from context when is not present on container fs", func(t *testing.T) { | ||
| destImage := baseRegistry(t, "my-app", "") | ||
|
|
||
| dockerfile, err := os.ReadFile("./testdata/tsuru-files-from-context/Dockerfile") | ||
| require.NoError(t, err) | ||
|
|
||
| req := &pb.BuildRequest{ | ||
| Kind: pb.BuildKind_BUILD_KIND_APP_BUILD_WITH_CONTAINER_FILE, | ||
| App: &pb.TsuruApp{ | ||
| Name: "my-app", | ||
| }, | ||
| DestinationImages: []string{destImage}, | ||
| Containerfile: string(dockerfile), | ||
| Data: compressGZIP(t, "./testdata/tsuru-files-from-context/"), | ||
| PushOptions: &pb.PushOptions{ | ||
| InsecureRegistry: registryHTTP, | ||
| }, | ||
| } | ||
|
|
||
| appFiles, err := NewBuildKit(bc, BuildKitOptions{TempDir: t.TempDir()}).Build(context.TODO(), req, os.Stdout) | ||
| require.NoError(t, err) | ||
| assert.Equal(t, &pb.TsuruConfig{ | ||
| Procfile: "", | ||
|
||
| TsuruYaml: `healthcheck: | ||
| path: /healthz | ||
| interval_seconds: 3 | ||
| timeout_seconds: 1 | ||
| ports: | ||
| - port: 443 | ||
| `, | ||
| ImageConfig: &pb.ContainerImageConfig{ | ||
| Cmd: []string{"echo", "Hello from Tsuru files from context!"}, | ||
| WorkingDir: "/tmp", | ||
| }, | ||
| }, appFiles) | ||
| }) | ||
|
|
||
| t.Run("Dockerfile mounting the app's env vars", func(t *testing.T) { | ||
| destImage := baseRegistry(t, "my-app", "") | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| FROM busybox:latest | ||
|
|
||
| WORKDIR /tmp | ||
| CMD ["echo", "Hello from Tsuru files from context!"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| web: my-server --addr 0.0.0.0:${PORT} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| healthcheck: | ||
| path: /healthz | ||
| interval_seconds: 3 | ||
| timeout_seconds: 1 | ||
| ports: | ||
| - port: 443 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test data directory contains a Procfile, but the implementation only extracts tsuru.yaml from the context directory. Consider implementing similar fallback logic for Procfile extraction when it's not present in the container filesystem. The test case "Dockerfile w/ build context (adds tsuru.yaml and Procfile)" (line 649) shows that both files should be handled consistently when they exist in the build context.