Skip to content

Elimneted magic string - #13105

Merged
ndeloof merged 4 commits into
docker:mainfrom
suwakei:fix/transformers.go
Jul 28, 2025
Merged

Elimneted magic string#13105
ndeloof merged 4 commits into
docker:mainfrom
suwakei:fix/transformers.go

Conversation

@suwakei

Copy link
Copy Markdown
Contributor

What I did
The path string “/templates” is hard-coded in several places, I have combined it into a constant.
This change facilitates future changes and prevents typos.

const (
TransformerLabel = "com.docker.compose.bridge"
DefaultTransformerImage = "docker/compose-bridge-kubernetes"
+++ templatesPath = "/templates"
)
type CreateTransformerOptions struct {
created, err := dockerCli.Client().ContainerCreate(ctx, &container.Config{
Image: options.From,
}, &container.HostConfig{}, &network.NetworkingConfig{}, nil, "")
defer func() {
_ = dockerCli.Client().ContainerRemove(context.Background(), created.ID, container.RemoveOptions{Force: true})
}()
if err != nil {
return err
}
--- content, stat, err := dockerCli.Client().CopyFromContainer(ctx, created.ID, "/templates")
+++ content, stat, err := dockerCli.Client().CopyFromContainer(ctx, created.ID, templatesPath)
if err != nil {
return err
}
defer func() {
_ = content.Close()
}()
srcInfo := archive.CopyInfo{
--- Path: "/templates",
+++ Path: templatesPath,
Exists: true,
IsDir: stat.Mode.IsDir(),
}

@suwakei
suwakei requested a review from a team as a code ownerJuly 27, 2025 07:42
@suwakei
suwakei requested review from glours and ndeloofJuly 27, 2025 07:42
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
@suwakei
suwakeiforce-pushed the fix/transformers.go branch from 3921429 to fe9d015CompareJuly 27, 2025 07:42
@ndeloof
ndeloof enabled auto-merge (rebase) July 27, 2025 12:46
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
auto-merge was automatically disabled July 27, 2025 13:05

Head branch was pushed to by a user without write access

@suwakei

Copy link
Copy Markdown
ContributorAuthor

Thanks for the review, I fixed the lint error.

However, it seems that automatic merging is disabled.
Can you please merge manually if there is no problem?

@ndeloof
ndeloof enabled auto-merge (rebase) July 27, 2025 13:30
Signed-off-by: keitosuwahara <keitosuwahara0816@gmail.com>
auto-merge was automatically disabled July 27, 2025 13:52

Head branch was pushed to by a user without write access

@suwakei

Copy link
Copy Markdown
ContributorAuthor

Thanks for the review! Since I don’t have write access, auto-merge is disabled.
Could you please merge it manually if everything looks good?

@ndeloof
ndeloof merged commit 52f0422 into docker:mainJul 28, 2025
26 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Aug 11, 2025
This MR contains the following updates:
| Package | Update | Change |
|---|---|---|
| [docker/compose](https://github.com/docker/compose) | patch | `v2.39.1` -> `v2.39.2` |
MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).
**Proposed changes to behavior should be submitted there as MRs.**
---
### Release Notes
<details>
<summary>docker/compose (docker/compose)</summary>
### [`v2.39.2`](https://github.com/docker/compose/releases/tag/v2.39.2)
[Compare Source](docker/compose@v2.39.1...v2.39.2)
#### What's Changed
##### 🐛 Fixes
- Fix (regression): compose build render build output with tty support by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#13107
- Add missing `_MODEL` suffix to model variable pass to dependent services of a model by [@&#8203;glours](https://github.com/glours) in docker/compose#13109
- Apply `BUILDKIT_PROGRESS` value when building with bake by [@&#8203;glours](https://github.com/glours) in docker/compose#13110
- Define `pull` and `no_cache` from either service or flags values when building with bake by [@&#8203;glours](https://github.com/glours) in docker/compose#13133
- Only monitor attached services on `up` command by [@&#8203;glours](https://github.com/glours) in docker/compose#13114
##### 🔧 Internal
- Add Streams Comment by [@&#8203;suwakei](https://github.com/suwakei) in docker/compose#13103
- Add test of `json.go` by [@&#8203;suwakei](https://github.com/suwakei) in docker/compose#13106
- Refactoring of redundant condition checks by [@&#8203;suwakei](https://github.com/suwakei) in docker/compose#13104
- Eliminated magic string by [@&#8203;suwakei](https://github.com/suwakei) in docker/compose#13105
- Use log API for containers we didn't attached to by [@&#8203;ndeloof](https://github.com/ndeloof) in docker/compose#13111
- Use `cli-plugins/metadata` package by [@&#8203;thaJeztah](https://github.com/thaJeztah) in docker/compose#13130
- `pkg/compose`: simplify getting auth-config key by [@&#8203;thaJeztah](https://github.com/thaJeztah) in docker/compose#13120
- Add go as a prerequisite in build instructions by [@&#8203;mattrunyon](https://github.com/mattrunyon) in docker/compose#13131
##### ⚙️ Dependencies
- Build(deps): bump github.com/docker/cli from `28.3.2+incompatible` to `28.3.3+incompatible` by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in docker/compose#13116
- Build(deps): bump github.com/docker/docker from `28.3.2+incompatible` to `28.3.3+incompatible` by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in docker/compose#13115
- Build(deps): bump github.com/containerd/containerd/v2 from `2.1.3` to `2.1.4` by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in docker/compose#13119
- Build(deps): bump github.com/docker/go-connections from `0.5.0` to `0.6.0` by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in docker/compose#13137
- Build(deps): bump golang.org/x/sys from `0.34.0` to `0.35.0` by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in docker/compose#13138
- Bump golang to `1.23.12` by [@&#8203;austinvazquez](https://github.com/austinvazquez) in docker/compose#13142
#### New Contributors
- [@&#8203;mattrunyon](https://github.com/mattrunyon) made their first contribution in docker/compose#13131
- [@&#8203;austinvazquez](https://github.com/austinvazquez) made their first contribution in docker/compose#13142
**Full Changelog**: docker/compose@v2.39.1...v2.39.2
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this MR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box
---
This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS41OC4yIiwidXBkYXRlZEluVmVyIjoiNDEuNTguMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@suwakei@ndeloof